The developer's resource for computer interfacing, especially USB, serial (COM) ports, mass storage, and embedded networking. (Formerly Lvr.com)

Home > USB Central > USB OTG and Embedded Hosts > BeagleBoard Code for Accessing USB Devices

BeagleBoard Linux Code for Accessing USB Devices

These are some Linux routines that demonstrate how to access USB devices from USB host port. The routines have been tested on a BeagleBoard-xM running Ubuntu 11.04.

Send comments, suggestions, etc. to jan (at) janaxelson.com.

Guide to using Eclipse to Cross-compile for the BeagleBoard-xM and other embedded systems.

Access USB Devices from a Linux USB Embedded Host (BeagleBoard article). A version of this article appeared in Nuts & Volts as Add USB Devices to Your Projects.

BeagleBone Getting Started Guide

Control the LEDs

Provides led_initialize() and led_control() functions to initialize and control the usr0 and usr1 LEDs on the BeagleBoard. Other routines on this page use these functions.

led_control.c
led_control.h

Keypress Detect (HID class)

Decodes keypresses and turns the usr0 LED on or off according to the key pressed. Non-blocking. Uses the ncurses library.

keyboard_read.c

Decodes keypresses and turns the usr0 LED on or off according to the key pressed. Non-blocking. Doesn't require the ncurses library.

keyboard_read2.c

Generic HID with hidapi

Demonstrates communicating with generic HID-class USB devices using hidapi and libusb-1.0. More info

Generic HID with libusb

Demonstrates communicating with generic HID-class USB devices using libusb-1.0.

generic_hid.c

Generic HID firmware for PIC

WinUSB with libusb

Demonstrates communicating with a device designed for use with WinUSB or another vendor-defined driver. Uses libusb-1.0.

winusb.c

WinUSB firmware for PIC

Mass Storage Write

Writes data to a USB drive at /usb/sda. To avoid writing to a no-longer-attached drive, verifies that the drive is mounted before writing to it.

mass_storage_write.c

Mass Storage Read

Reads data from a file on a USB drive and turns the usr0 and usr1 LEDs on or off according to the data read.

mass_storage_read.c

Printer

Prints a file to the default printer. Uses the CUPS API.

printer.c

Virtual Serial Port

Communicates with a remote serial port using a USB/serial-port adapter.

usb_serial_port.c