官术网_书友最值得收藏!

  • Raspberry Pi Zero Cookbook
  • Edward Snajder
  • 451字
  • 2021-07-09 19:12:12

Adding USB functions to Raspbian Jessie

The latest release of Raspbian Jessie added some wonderful hacks that make the Raspberry Pi both an ideal test device and at the same time the most inexpensive awesome little Linux server you could fit into a box of mints. With the next series of hacks, we will use the USB port to connect as a serial device, a network device, or even a mass storage device (like a USB flash drive). The possibilities grow with every release!

If you are using Mac OS X, you should be all set-the Bonjour services come installed. If on Windows, Apple's Bonjour print services will be the only installation you need to get things working. Finally, on Linux, avanti-daemon needs to be installed, which it is by default as of Ubuntu 14.04.

Note

The USB OTG functions are only available on the Raspberry Pi Zero. The reason for this is that the USB port is connected directly to the processor for the Zero but runs through a USB hub on its larger siblings. This is an RPZ-only hack!

Getting ready

For this recipe, you can work directly over your SSH connection to your Raspberry Pi, or you can shut down the Pi, put the SD card into another computer, and edit the files there.

How to do it...

  1. First, let's make sure our OS, service, and applications are up to date. First, run these two commands:
            sudo apt-get update
            sudo apt-get upgrade
    

    If there are things that need to be updated to the latest version, these commands will take care of it for you. We will pe into the apt-get command later on in the book. If you are using a Raspbian build newer than 2016-06-15, then the kernel updates are already installed.

    Note

    To set things up for the next bunch of recipes, we are going to be looking in the Raspberry Pi Zero's /boot volume, specifically, the config.txt and cmdline.txt files. These files are used at startup to get the Pi Zero configured and booted.

    I recommend first making a backup of the files. This way, if you do something wrong that causes the Pi not to start up, you can just put the SD card in a computer and copy the original file back:

            sudo cp /boot/config.txt /boot/config.txt.bak
            sudo cp /boot/cmdline.txt /boot/cmdline.txt.bak
    
  2. Now we can go ahead and edit our original files. The command is as follows:
            sudo nano /boot/config.txt
    
  3. To the very end of the file, add the following and save:
            dtoverlay=dwc2
    

This sets up the config.txt file for USB OTG access. In the following recipes, we will make additional configuration changes to leverage some of the unique capabilities of our Raspberry Pi Zero.

主站蜘蛛池模板: 塔城市| 桐城市| 安溪县| 延庆县| 二连浩特市| 二连浩特市| 江阴市| 嘉善县| 四平市| 海晏县| 华亭县| 东乌珠穆沁旗| 盈江县| 微山县| 佛山市| 牙克石市| 德庆县| 普陀区| 聂荣县| 乌海市| 聂荣县| 巴彦县| 乐业县| 纳雍县| 漯河市| 天峻县| 漳平市| 克什克腾旗| 宣恩县| 格尔木市| 颍上县| 利川市| 凌云县| 罗甸县| 忻州市| 布拖县| 静宁县| 松潘县| 阿克| 章丘市| 阳东县|