USB::Device Class Reference
Class representing a Device on the Bus. More...
#include <usbpp.h>
Public Member Functions | |
Device () | |
~Device () | |
std::string | fileName (void) |
OS representation of filename for this device. | |
u_int16_t | idVendor (void) |
The vendor ID number, as provided by the device. | |
u_int16_t | idProduct (void) |
The product ID number, as provided by the device. | |
u_int16_t | idRevision (void) |
The product's revision ID, as provided by the device. | |
u_int8_t | devClass (void) |
The device's USB class, as provided by the device. | |
u_int8_t | devSubClass (void) |
The device's USB subclass, as provided by the device. | |
u_int8_t | devProtocol (void) |
The device's USB protocol, as provided by the device. | |
std::string | Vendor (void) |
The vendor name string, as provided by the device. | |
std::string | Product (void) |
The product name string, as provided by the device. | |
std::string | SerialNumber (void) |
The serial number string, as provided by the device. | |
u_int8_t | numConfigurations (void) |
Number of Configurations that this device has. | |
int | string (std::string &buf, int index, u_int16_t lang=0) |
fetch an arbitrary string from the device | |
Configuration * | firstConfiguration (void) |
First Configuration for the Device. | |
Configuration * | nextConfiguration (void) |
Next Configuration for the Device. | |
Configuration * | lastConfiguration (void) |
Last Configuration for the Device. | |
int | controlTransfer (u_int8_t requestType, u_int8_t request, u_int16_t value, u_int16_t index, u_int16_t length, unsigned char *payload, int timeout=100) |
USB control transfer. | |
Friends | |
class | Busses |
Busses is a friend because it fills in the descriptor type information on initialisation and rescan. | |
class | Interface |
Interface is a friend because it needs the handle() function to perform claim(), release(). | |
class | Endpoint |
Endpoint is a friend because it needs the handle() function to perform reads, writes, and other transactions. |
Detailed Description
Class representing a Device on the Bus.The Device class represents a single device attached to a Universal Serial Bus.
- Author:
- Brad Hards
Definition at line 407 of file usbpp.h.
Member Function Documentation
|
OS representation of filename for this device. libusb++ provides a uniform way of accessing USB devices irrespective of the underlying Operation System representation. If you want to map the libusb++ representation to the Operating System representation, you can do this with filename(). On Linux, the filename is usually something like 002, which represents the second device (usually the first real device, after the root hub pseudo-device) on the bus.
|
|
The vendor ID number, as provided by the device. This method returns a number containing the vendor (manufacturer) identification number. These are allocated by the USB Implementers Forum, and you can construct a lookup based on the number to get the manufacturer's name, even if the device does not contain a vendor string.
Definition at line 244 of file usbpp.cpp. Referenced by USB::Busses::match(). |
|
The product ID number, as provided by the device. This method returns a number containing the product identification number. These are allocated by the manufacturer, and should be different on each device.
Definition at line 249 of file usbpp.cpp. Referenced by USB::Busses::match(). |
|
The product's revision ID, as provided by the device. This method returns a number containing the product's revision. This revision level is nominally binary coded decimal, but hexadecimal revision levels are not uncommon. The binary coded decimal version nominally has a major version in the high byte, and a minor version in the low byte. |
|
The device's USB class, as provided by the device. This method returns a number containing the device's class. These are defined by the USB Implementer's Forum. A code of Zero is special (and common) - it means that the class is found in the Interface descriptor, rather than in the Device descriptor. A code of 0xFF is also special (and far too common) - it means that the manufacturer didn't conform to one of the defined class specifications, and chose to implement a vendor specified protocol. Definition at line 259 of file usbpp.cpp. Referenced by USB::Busses::match(). |
|
The device's USB subclass, as provided by the device. This method returns a number containing the device's subclass. These subclasses are defined by the USB Implementer's Forum, and only have meaning in the context of a specified class. |
|
The device's USB protocol, as provided by the device. This method returns a number containing the device's protocol. These protocols are defined by the USB Implementer's Forum, and only have meaning in the context of a specified class and subclass. |
|
The vendor name string, as provided by the device. This method returns a string containing the name of the device's vendor (manufacturer), as encoded into the device. Note that not all devices contain a vendor name, and also that under some operating systems you may not be able to read the vendor name without elevated privledges (typically root privledges).
|
|
The product name string, as provided by the device. This method returns a string containing the name of the device's product name, as encoded into the device. Note that not all devices contain a product name, and also that under some operating systems you may not be able to read the vendor name without elevated privledges (typically root privledges).
|
|
The serial number string, as provided by the device. This method returns a string containing a serial number for the device, as encoded into the device. Note that few devices contain a serial number string, and also that under some operating systems you may not be able to read the serial number without elevated privledges (typically root privledges). The USB specification requires that serial numbers are unique if they are provided, but adherence to this requirement by manufacturers is not universal. |
|
Number of Configurations that this device has. This is a simple accessor method that specifies the number configurations that this device has. |
|
fetch an arbitrary string from the device
Definition at line 189 of file usbpp.cpp. Referenced by USB::Busses::rescan(). |
|
First Configuration for the Device. This method returns a pointer to the first Configuration for the Device. See nextConfiguration() for an example of how it might be used. |
|
Next Configuration for the Device. This method returns a pointer to the next Configuration for the Device. If you want to iterate through each Configuration on a device, you can use something like the following: USB::Configuration *this_Configuration; this_Configuration = device->firstConfiguration(); for (i=0; i < device->numConfigurations(); i++) { // do something with this_Configuration this_Configuration->nextConfiguration(); } |
|
Last Configuration for the Device. This method returns a pointer to the last Configuration for the Device. |
|
USB control transfer. This method performs a standard control transfer to the default endpoint. See the USB specification for more details on this.
|
Friends And Related Function Documentation
|
Busses is a friend because it fills in the descriptor type information on initialisation and rescan.
|
|
Interface is a friend because it needs the handle() function to perform claim(), release().
|
|
Endpoint is a friend because it needs the handle() function to perform reads, writes, and other transactions.
|
The documentation for this class was generated from the following files: