#include <LOW_portUsbDevice_Linux.h>
Inheritance diagram for LOW_portUsbDevice_Linux:
Public Types | |
typedef uint16_t | usbVendorID_t |
Type for USB vendor ID. | |
typedef uint16_t | usbProductID_t |
Type for USB product ID. | |
typedef uint8_t | usbConfig_t |
Type for USB configuration. | |
typedef uint8_t | usbInterface_t |
Type for USB interface. | |
typedef uint8_t | usbSetting_t |
Type for USB setting. | |
typedef uint8_t | bmRequestType_t |
Corresponds to type defined in USB 1.1 specification. | |
typedef uint8_t | bRequest_t |
Corresponds to type defined in USB 1.1 specification. | |
typedef uint16_t | wValue_t |
Corresponds to type defined in USB 1.1 specification. | |
typedef uint16_t | wIndex_t |
Corresponds to type defined in USB 1.1 specification. | |
typedef uint16_t | wLength_t |
Corresponds to type defined in USB 1.1 specification. | |
typedef uint8_t * | msgData_t |
Pointer type for I/O methods. | |
typedef uint16_t | usbTimeout_t |
Type for timeout on USB operations in ms. | |
typedef uint8_t | usbEndpoint_t |
Type for USB endpoint. | |
Public Member Functions | |
virtual | ~LOW_portUsbDevice_Linux () |
Destructor. | |
virtual usbVendorID_t | getVendorID () |
Get vendor ID of USB device. | |
virtual usbProductID_t | getProductID () |
Get product ID of USB device. | |
virtual void | setConfiguration (const usbConfig_t inConfig) |
Resets a device. | |
virtual void | claimInterface (const usbInterface_t inInterface) |
Claim an interface of a device. | |
virtual void | releaseInterface (const usbInterface_t inInterface) |
Releases a previously claimed interface. | |
virtual void | setIfaceAltSetting (const usbSetting_t inAltSetting) |
Sets the active alternate setting of the current interface. | |
virtual void | controlMsg (const bmRequestType_t inReqType, const bRequest_t inRequest, const wValue_t inValue, const wIndex_t inIndex, const wLength_t inLength, msgData_t inOutData, const usbTimeout_t inTimeout) |
Send a control message to a device. | |
virtual void | controlMsg (const bmRequestType_t inReqType, const bRequest_t inRequest, const wValue_t inValue, const wIndex_t inIndex, byteVec_t &inOutData, const usbTimeout_t inTimeout) |
Send a control message to a device. | |
virtual void | clearHalt (const usbEndpoint_t inEP) |
Clears any halt status on an endpoint. | |
virtual unsigned int | bulkWrite (const usbEndpoint_t inEP, const wLength_t inLength, const msgData_t inData, const usbTimeout_t inTimeout) |
Write data to a bulk endpoint. | |
virtual unsigned int | bulkWrite (const usbEndpoint_t inEP, const byteVec_t &inData, const usbTimeout_t inTimeout) |
Write data to a bulk endpoint. | |
virtual unsigned int | bulkRead (const usbEndpoint_t inEP, const wLength_t inLength, msgData_t outData, const usbTimeout_t inTimeout) |
Read data from a bulk endpoint. | |
virtual unsigned int | bulkRead (const usbEndpoint_t inEP, byteVec_t &outData, const usbTimeout_t inTimeout) |
Read data from a bulk endpoint. | |
class_DERIVE_FROM_EXCEPTION (portUsbDevice_error, LOW_exception) | |
Exception base class for all exceptions thrown by LOW_portUsbDevice. | |
class_DERIVE_FROM_EXCEPTION (noSuchDevice_error, portUsbDevice_error) | |
Exception class when a device could not be found. | |
Protected Member Functions | |
LOW_portUsbDevice_Linux (const LOW_portUsb_Factory::usbDeviceSpecifier_t inUsbDevSpec) | |
Constructor. | |
Static Protected Member Functions | |
LOW_portUsb_Factory::usbDevSpecVec_t | getPortSpecifiers (const usbVendorID_t inVendorID, const usbProductID_t inProductID) |
Get a list of port specifiers of devices with a certain vendor and product ID. | |
Private Member Functions | |
virtual std::string | libUsbErrMsg () |
Get libusb's error message as C++ string. | |
Static Private Member Functions | |
void | rescanBusses () |
Rescan all USB busses. | |
int | initialize () |
Static inizializer. | |
Private Attributes | |
usb_device * | usbLibDevice |
libusb's device structure | |
usb_dev_handle * | usbLibDevHdl |
libusb's handle to USB device | |
Static Private Attributes | |
int | initHelper = initialize() |
Needed for dirty little C++ hack to force static initialization on application start. | |
Friends | |
class | LOW_portUsb_Factory |
To allow construction. |
Requires libusb version 0.1.6a or higher.
USB Specification Version 1.1
Parts of the documentation taken from libusb.
Definition at line 41 of file LOW_portUsbDevice_Linux.h.
|
Corresponds to type defined in USB 1.1 specification.
Definition at line 78 of file LOW_portUsbDevice.h. |
|
Corresponds to type defined in USB 1.1 specification.
Definition at line 79 of file LOW_portUsbDevice.h. |
|
Pointer type for I/O methods.
Definition at line 83 of file LOW_portUsbDevice.h. Referenced by bulkRead(), bulkWrite(), and controlMsg(). |
|
Type for USB configuration.
Definition at line 75 of file LOW_portUsbDevice.h. |
|
Type for USB endpoint.
Definition at line 85 of file LOW_portUsbDevice.h. |
|
Type for USB interface.
Definition at line 76 of file LOW_portUsbDevice.h. |
|
Type for USB product ID.
Definition at line 74 of file LOW_portUsbDevice.h. Referenced by getProductID(). |
|
Type for USB setting.
Definition at line 77 of file LOW_portUsbDevice.h. |
|
Type for timeout on USB operations in ms.
Definition at line 84 of file LOW_portUsbDevice.h. |
|
Type for USB vendor ID.
Definition at line 73 of file LOW_portUsbDevice.h. Referenced by getVendorID(). |
|
|
Corresponds to type defined in USB 1.1 specification.
Definition at line 82 of file LOW_portUsbDevice.h. Referenced by LOW_linkDS2490::comCmd_readStraight(). |
|
|
Destructor.
Definition at line 75 of file LOW_portUsbDevice_Linux.cpp. References libUsbErrMsg(), LOW_helper_msglog::printPerror(), and usbLibDevHdl. |
|
Constructor. Not publicly constructable. Use LOW_portUsb_Factory.
Definition at line 48 of file LOW_portUsbDevice_Linux.cpp. References libUsbErrMsg(), rescanBusses(), usbLibDevHdl, and usbLibDevice. |
|
Read data from a bulk endpoint.
Implements LOW_portUsbDevice. Definition at line 265 of file LOW_portUsbDevice_Linux.cpp. References __LOW_SYNCHRONIZE_METHOD_WRITE__, bulkRead(), and LOW_portUsbDevice::msgData_t. |
|
Read data from a bulk endpoint.
Implements LOW_portUsbDevice. Definition at line 253 of file LOW_portUsbDevice_Linux.cpp. References __LOW_SYNCHRONIZE_METHOD_WRITE_WEAK__, libUsbErrMsg(), and usbLibDevHdl. Referenced by bulkRead(). |
|
Write data to a bulk endpoint.
Implements LOW_portUsbDevice. Definition at line 233 of file LOW_portUsbDevice_Linux.cpp. References __LOW_SYNCHRONIZE_METHOD_WRITE__, bulkWrite(), and LOW_portUsbDevice::msgData_t. |
|
Write data to a bulk endpoint.
Implements LOW_portUsbDevice. Definition at line 221 of file LOW_portUsbDevice_Linux.cpp. References __LOW_SYNCHRONIZE_METHOD_WRITE_WEAK__, libUsbErrMsg(), and usbLibDevHdl. Referenced by bulkWrite(). |
|
Claim an interface of a device. Claims the interface with the Operating System. Note: The method must be called before you perform any operations related to this interface (like setIfaceAltSetting(), bulkWrite(), etc).
Implements LOW_portUsbDevice. Definition at line 135 of file LOW_portUsbDevice_Linux.cpp. References __LOW_SYNCHRONIZE_METHOD_WRITE__, libUsbErrMsg(), and usbLibDevHdl. |
|
Exception class when a device could not be found.
|
|
Exception base class for all exceptions thrown by LOW_portUsbDevice.
|
|
Clears any halt status on an endpoint.
Implements LOW_portUsbDevice. Definition at line 209 of file LOW_portUsbDevice_Linux.cpp. References __LOW_SYNCHRONIZE_METHOD_WRITE__, libUsbErrMsg(), and usbLibDevHdl. |
|
Send a control message to a device. Performs a control request to the default control pipe on a device. The parameters mirror the types of the same name in the USB specification. Implements LOW_portUsbDevice. Definition at line 184 of file LOW_portUsbDevice_Linux.cpp. References __LOW_SYNCHRONIZE_METHOD_WRITE__, controlMsg(), and LOW_portUsbDevice::msgData_t. |
|
Send a control message to a device. Performs a control request to the default control pipe on a device. The parameters mirror the types of the same name in the USB specification. Implements LOW_portUsbDevice. Definition at line 168 of file LOW_portUsbDevice_Linux.cpp. References __LOW_SYNCHRONIZE_METHOD_WRITE__, libUsbErrMsg(), and usbLibDevHdl. Referenced by controlMsg(). |
|
Get a list of port specifiers of devices with a certain vendor and product ID.
Definition at line 293 of file LOW_portUsbDevice_Linux.cpp. References rescanBusses(), and LOW_portUsb_Factory::usbDevSpecVec_t. Referenced by LOW_portUsb_Factory::getPortSpecifiers(). |
|
Get product ID of USB device.
Implements LOW_portUsbDevice. Definition at line 98 of file LOW_portUsbDevice_Linux.cpp. References __LOW_SYNCHRONIZE_METHOD_READ__, usbLibDevice, and LOW_portUsbDevice::usbProductID_t. |
|
Get vendor ID of USB device.
Implements LOW_portUsbDevice. Definition at line 90 of file LOW_portUsbDevice_Linux.cpp. References __LOW_SYNCHRONIZE_METHOD_READ__, usbLibDevice, and LOW_portUsbDevice::usbVendorID_t. |
|
Static inizializer.
Definition at line 30 of file LOW_portUsbDevice_Linux.cpp. |
|
Get libusb's error message as C++ string.
Definition at line 338 of file LOW_portUsbDevice_Linux.cpp. Referenced by bulkRead(), bulkWrite(), claimInterface(), clearHalt(), controlMsg(), LOW_portUsbDevice_Linux(), releaseInterface(), setConfiguration(), setIfaceAltSetting(), and ~LOW_portUsbDevice_Linux(). |
|
Releases a previously claimed interface. Releases an interface previously claimed with claimInterface().
Implements LOW_portUsbDevice. Definition at line 146 of file LOW_portUsbDevice_Linux.cpp. References __LOW_SYNCHRONIZE_METHOD_WRITE__, libUsbErrMsg(), and usbLibDevHdl. |
|
Rescan all USB busses.
Definition at line 322 of file LOW_portUsbDevice_Linux.cpp. Referenced by getPortSpecifiers(), and LOW_portUsbDevice_Linux(). |
|
Resets a device. Resets the specified device by sending a RESET down the port it is connected to. Implements LOW_portUsbDevice. Definition at line 123 of file LOW_portUsbDevice_Linux.cpp. References __LOW_SYNCHRONIZE_METHOD_WRITE__, libUsbErrMsg(), and usbLibDevHdl. |
|
Sets the active alternate setting of the current interface.
Implements LOW_portUsbDevice. Definition at line 156 of file LOW_portUsbDevice_Linux.cpp. References __LOW_SYNCHRONIZE_METHOD_WRITE__, libUsbErrMsg(), and usbLibDevHdl. |
|
To allow construction.
Definition at line 114 of file LOW_portUsbDevice_Linux.h. |
|
Needed for dirty little C++ hack to force static initialization on application start.
Definition at line 29 of file LOW_portUsbDevice_Linux.cpp. |
|
libusb's handle to USB device
Definition at line 158 of file LOW_portUsbDevice_Linux.h. Referenced by bulkRead(), bulkWrite(), claimInterface(), clearHalt(), controlMsg(), LOW_portUsbDevice_Linux(), releaseInterface(), setConfiguration(), setIfaceAltSetting(), and ~LOW_portUsbDevice_Linux(). |
|
libusb's device structure
Definition at line 157 of file LOW_portUsbDevice_Linux.h. Referenced by getProductID(), getVendorID(), and LOW_portUsbDevice_Linux(). |