en
Книжки
Packt Publishing

Raspberry Pi for Secret Agents

    Ingridцитуєторік
    Let's break down exactly what's happening here. The sox command accepts an input file and an output file, in that order, together with a myriad of optional parameters. In this case, -t alsa plughw:1 is the input file and -d is the output file. -t alsa plughw:1 means ALSA card number one and -d means default ALSA card, which is the Raspberry Pi sound core. The status line that is continuously updated while sox is running provides many helpful pieces of information, starting from the left-hand side
    Ingridцитуєторік
    Type in the following command to install SoX and an add-on for dealing with MP3 files:
    pi@raspberrypi ~ $ sudo apt-get install sox libsox-fmt-mp3
    Now type in the following command to start what we call a monitoring loop:
    pi@raspberrypi ~ $ sox -t alsa plughw:1 -d
    Ingridцитуєторік
    We can check if ALSA has detected our new audio device and added it to the list of cards using the following command:
    pi@raspberrypi ~ $ cat /proc/asound/cards
    Ingridцитуєторік
    pi@raspberrypi ~ $ speaker-test -c2 -t wav
    Ingridцитуєторік
    amixer cset numid=3 1: Sets the audio out to the 3.5 mm analog jack.
    amixer cset numid=3 2: Sets the audio out to the HDMI cable
    Ingridцитуєторік
    It's time to make some noise! Let's start up the AlsaMixer to make sure the volume is loud enough for us to hear anything, using the following command:
    pi@raspberrypi ~ $ alsamixer
    Ingridцитуєторік
    Type in the following command to list the contents of the asound directory:
    pi@raspberrypi ~ $ ls -l /proc/asound
    The black/white names are files that you can output with cat. The blue ones are directories and the cyan ones are symbolic links, or symlinks , that just point to other files or directories. You might be puzzled by the total 0 output. Usually it'll tell you the number of files in the directory, but because /proc/asound is a special information-only directory where the file sizes are zero; it appears empty to the ls command
    Ingridцитуєторік
    Type in the following command to view a list of all connected audio devices that ALSA knows about:
    pi@raspberrypi ~ $ cat /proc/asound/cards
    The cat command is commonly used to output the contents of text files, and /proc/asound is a directory (or "folder" in the Windows world) where ALSA provides detailed status information about the sound system
    Ingridцитуєторік
    The Advanced Linux Sound Architecture (ALSA), is the underlying framework responsible for making all the sound stuff work on the Pi. ALSA provides kernel drivers for the Pi itself and for most USB gadgets that produce or record sound. The framework also includes code to help programmers make audio applications and a couple of command-line utilities that will prove very useful to us.
    Ingridцитуєторік
    Before we can use the script, we need to install Git, a version control system used by the Raspberry Pi firmware developers, with the following command:
    pi@raspberrypi ~ $ sudo apt-get install git-core
    Notice how easy it is to download and install new software packages from the Internet using apt-get.
    Now, whenever you want to check for firmware updates, type sudo rpi-update and reboot once the script says it has updated your system successfully
    Ingridцитуєторік
    sudo apt-get update: To fetch information about what packages have been updated.
    sudo apt-get dist-upgrade: Proceed to install the updated packages. Answer yes when prompted
    Ingridцитуєторік
    Open up a Terminal (located in /Applications/Utilities on the Mac).
    Type in the following command, but replace [IP address] with the particular IP address of your Pi that we found out previously:
    ssh pi@[IP address]
    If your network provides a convenient local DNS service, you might be able to type raspberrypi instead of the IP address, try it and see if it works.
    The first time you connect to the Pi or any foreign system over SSH, you'll be prompted with a warning and a chance to verify the remote system's RSA key fingerprint before continuing. This is a security feature designed to ensure the authenticity of the remote system. Since we know that our Pi is indeed our Pi, answer yes to continue the connection.
    Type the password of the user pi that you chose earlier with Raspi-config.
    You're now logged in as the user pi. When you've had enough pranking for the day, type exit to quit your SSH session
    Ingridцитуєторік
    The next thing that needs to happen is for the router to assign an IP address to the Pi using Dynamic Host Configuration Protocol (DHCP). DHCP is a common service on network equipment that hands out unique IP addresses to all computers that want to join the network
    Ingridцитуєторік
    free -h
    Displays memory usage information
    Ingridцитуєторік
    df / -h
    Displays the amount of disk space available on your SD card
    Ingridцитуєторік
    sudo su
    Become the root user. Just be careful not to erase anything by mistake
    Ingridцитуєторік
    sudo shutdown -h now
    Prepares the Pi to be powered off. Always type this before pulling the plug!
    Ingridцитуєторік
    sudo shutdown -h now
    Prepares the Pi to be powered off. Always type this before pulling the plug
    Ingridцитуєторік
    sudo reboot
    Reboots the Pi.
    Ingridцитуєторік
    sudo raspi-config
    Starts Raspi-config, which lets you reconfigure your system
fb2epub
Перетягніть файли сюди, не більш ніж 5 за один раз