Documentation
¶
Overview ¶
Package usbdev finds the USB serial ports and sound cards on the machine and groups the ones that belong to the same physical device (a radio's CAT port and its built-in sound card hang off the same USB hub). It reads sysfs and /dev only, so it needs no privileges.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Group ¶
Group is a set of devices that share a hub and so probably belong to one physical device. A hub inside a radio looks the same as a hub on your desk, so a group is a hint: when it holds several serial ports or sound cards, the user picks.
type Serial ¶
type Serial struct {
Tty string // /dev/ttyACM0
ByID string // /dev/serial/by-id/... (stable across ports and reboots), if present
VID, PID string
SerialNumber string
Manufacturer string
Product string
Interface int
Hub string // sysfs path of the hub it hangs off ("" when plugged straight into the computer)
// contains filtered or unexported fields
}
Serial is a USB serial port.
func (Serial) Identity ¶
Identity names a device in a way that survives replugging: vendor:product plus the USB serial number. When the device has no serial number it is empty and the device can only be told apart from an identical one by the port it is plugged into.
func (Serial) LooksLikeGPS ¶
LooksLikeGPS reports whether a serial port is probably a GPS receiver.
type Snapshot ¶
Snapshot is what is plugged in at one moment.
type Sound ¶
type Sound struct {
Card int
ID string // ALSA id, the bracketed name in /proc/asound/cards (use it in plughw:CARD=<id>)
VID, PID string
SerialNumber string
Product string
Hub string
// contains filtered or unexported fields
}
Sound is a USB sound card.