Python: module usb

 
 
usb
index
/usr/lib/python2.4/site-packages/usb.so

USB access module

 
Classes
       
__builtin__.object
Bus
Configuration
Device
DeviceHandle
Endpoint
Interface

 
class Bus(__builtin__.object)
    Bus object
 
  Data and other attributes defined here:
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new object with type S, a subtype of T
devices = <member 'devices' of 'usb.Bus' objects>
Tuple with the bus devices
dirname = <member 'dirname' of 'usb.Bus' objects>
location = <member 'location' of 'usb.Bus' objects>

 
class Configuration(__builtin__.object)
    Configuration descriptor object
 
  Data and other attributes defined here:
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new object with type S, a subtype of T
iConfiguration = <member 'iConfiguration' of 'usb.Configuration' objects>
Index to a string that describes the
configuration.
interfaces = <member 'interfaces' of 'usb.Configuration' objects>
Tuple with a tuple of the configuration interfaces.
Each element represents a sequence of the
alternate settings for each interface.
maxPower = <member 'maxPower' of 'usb.Configuration' objects>
Specifies the device current. This is the absolute value,
already multiplied by 2
remoteWakeup = <member 'remoteWakeup' of 'usb.Configuration' objects>
True if the device supports remote wakeup feature.
selfPowered = <member 'selfPowered' of 'usb.Configuration' objects>
True if the device is self powered.
totalLength = <member 'totalLength' of 'usb.Configuration' objects>
The number of data bytes that the device returns,
including the bytes for all of the configuration's interfaces and
endpoints.
value = <member 'value' of 'usb.Configuration' objects>
Identifies the configuration.

 
class Device(__builtin__.object)
    Device descriptor object
 
  Methods defined here:
open(...)
open() -> DeviceHandle
 
Open the device for use.
Returns a DeviceHandle object.

Data and other attributes defined here:
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new object with type S, a subtype of T
configurations = <member 'configurations' of 'usb.Device' objects>
Tuple with the device configurations.
deviceClass = <member 'deviceClass' of 'usb.Device' objects>
For devices that belong to a class, this field may
name the class.
deviceProtocol = <member 'deviceProtocol' of 'usb.Device' objects>
This field may specify a protocol defined by the
selected class or subclass.
deviceSubClass = <member 'deviceSubClass' of 'usb.Device' objects>
For devices that belong to a class, this field may
specify a subclass within the class.
deviceVersion = <member 'deviceVersion' of 'usb.Device' objects>
String containing the device's release number.
filename = <member 'filename' of 'usb.Device' objects>
iManufacturer = <member 'iManufacturer' of 'usb.Device' objects>
An index that points to a string describing the
manufacturer.
iProduct = <member 'iProduct' of 'usb.Device' objects>
An index that points to a string describing the product.
iSerialNumber = <member 'iSerialNumber' of 'usb.Device' objects>
An index that points to a string containing the
device's serial number.
idProduct = <member 'idProduct' of 'usb.Device' objects>
The manufacturer assigns a Product ID to identify the
device.
idVendor = <member 'idVendor' of 'usb.Device' objects>
Unique vendor identifier.
maxPacketSize = <member 'maxPacketSize' of 'usb.Device' objects>
The maximum packet size for Endpoint 0.
usbVersion = <member 'usbVersion' of 'usb.Device' objects>
String containing the USB specification number that
the device and its descriptors comply with.

 
class DeviceHandle(__builtin__.object)
    DeviceHandle object
 
  Methods defined here:
bulkRead(...)
bulkRead(endpoint, size, timeout=100) -> buffer
 
Performs a bulk read request to the endpoint specified.
Arguments:
        endpoint: endpoint number.
        size: number of bytes to read.
        timeout: operation timeout in miliseconds. (default: 100)
Returns a tuple with the data read.
bulkWrite(...)
bulkWrite(endpoint, buffer, timeout=100) -> bytesWritten
 
Performs a bulk write request to the endpoint specified.
Arguments:
        endpoint: endpoint number.
        buffer: sequence data buffer to write.
              This parameter can be any sequence type
        timeout: operation timeout in miliseconds. (default: 100)
Returns the number of bytes written.
claimInterface(...)
claimInterface(interface) -> None
 
Claims the interface with the Operating System.
Arguments:
        interface: interface number or an Interface object.
clearHalt(...)
clearHalt(endpoint) -> None
 
Clears any halt status on the specified endpoint.
Arguments:
        endpoint: endpoint number.
controlMsg(...)
controlMsg(requestType, request, buffer, value=0, index=0, timeout=100) -> bytesWritten|buffer
 
Performs a control request to the default control pipe on a device.
Arguments:
        requestType: specifies the direction of data flow, the type
                     of request, and the recipient.
        request: specifies the request.
        buffer: if the transfer is a write transfer, buffer is a sequence 
                with the transfer data, otherwise, buffer is the number of
                bytes to read.
        value: specific information to pass to the device. (default: 0)
        index: specific information to pass to the device. (default: 0)
        timeout: operation timeout in miliseconds. (default: 100)
Returns the number of bytes written.
getDescriptor(...)
getDescriptor(type, index, len, endpoint = -1) -> descriptor
 
Retrieves a descriptor from the device identified by the type
and index of the descriptor.
Arguments:
        type: descriptor type.
        index: index of the descriptor.
        len: descriptor length.
        endpoint: endpoint number from descriptor is read. If it is
                  omitted, the descriptor is read from default control pipe.
getString(...)
getString(index, len, langid = -1) -> string
 
Retrieves the string descriptor specified by index
and langid from a device.
Arguments:
        index: index of descriptor in the device.
        len: number of bytes of the string
        langid: Language ID. If it is omittedi, will be
                used the first language.
interruptRead(...)
interruptRead(endpoint, size, timeout=100) -> buffer
 
Performs a interrupt read request to the endpoint specified.
Arguments:
        endpoint: endpoint number.
        size: number of bytes to read.
        timeout: operation timeout in miliseconds. (default: 100)
Returns a tuple with the data read.
interruptWrite(...)
interruptWrite(endpoint, buffer, timeout=100) -> bytesWritten
 
Performs a interrupt write request to the endpoint specified.
Arguments:
        endpoint: endpoint number.
        buffer: sequence data buffer to write.
              This parameter can be any sequence type
        timeout: operation timeout in miliseconds. (default: 100)
Returns the number of bytes written.
releaseInterface(...)
releaseInterface() -> None
 
Releases an interface previously claimed with claimInterface.
reset(...)
reset() -> None
 
Resets the specified device by sending a RESET
down the port it is connected to.
resetEndpoint(...)
resetEndpoint(endpoint) -> None
 
Resets all state (like toggles) for the specified endpoint.
Arguments:
        endpoint: endpoint number.
setAltInterface(...)
setAltInterface(alternate) -> None
 
Sets the active alternate setting of the current interface.
Arguments:
        alternate: an alternate setting number or an Interface object.
setConfiguration(...)
setConfiguration(configuration) -> None
 
Sets the active configuration of a device.
Arguments:
        configuration: a configuration value or a Configuration object.

Data and other attributes defined here:
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new object with type S, a subtype of T

 
class Endpoint(__builtin__.object)
    Endpoint descriptor object
 
  Data and other attributes defined here:
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new object with type S, a subtype of T
address = <member 'address' of 'usb.Endpoint' objects>
Contains the endpoint address.
interval = <member 'interval' of 'usb.Endpoint' objects>
The maximum latency for polling interrupt endpoints, or
the interval for polling isochronous endpoints, or the maximum NAK
rate for high-speed bulk OUT or control endpoints.
maxPacketSize = <member 'maxPacketSize' of 'usb.Endpoint' objects>
The maximum number of data bytes the endpoint
can transfer in a transaction.
type = <member 'type' of 'usb.Endpoint' objects>
It contains one of the following values, 
indicating the endpoint transfer type:
        ENDPOINT_TYPE_CONTROL
        ENDPOINT_TYPE_ISOCHRONOUS
        ENDPOINT_TYPE_BULK
        ENDPOINT_TYPE_INTERRUPT

 
class Interface(__builtin__.object)
    Interface descriptor object
 
  Data and other attributes defined here:
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new object with type S, a subtype of T
alternateSetting = <member 'alternateSetting' of 'usb.Interface' objects>
Alternate setting number.
endpoints = <member 'endpoints' of 'usb.Interface' objects>
Tuple with interface endpoints.
interfaceClass = <member 'interfaceClass' of 'usb.Interface' objects>
Similar to DeviceClass in the device descriptor, but
for devices with a class specified by the interface.
interfaceNumber = <member 'interfaceNumber' of 'usb.Interface' objects>
Identifies the interface.
interfaceProtocol = <member 'interfaceProtocol' of 'usb.Interface' objects>
Similar to bDeviceProtocol in the device
descriptor, but for devices whose class is defined by the interface.
interfaceSubClass = <member 'interfaceSubClass' of 'usb.Interface' objects>
Similar to bDeviceSubClass in the device
descriptor, but for devices with a class defined by the interface.

 
Functions
       
busses(...)
Returns a tuple with the usb busses

 
Data
        CLASS_AUDIO = 1
CLASS_COMM = 2
CLASS_DATA = 10
CLASS_HID = 3
CLASS_HUB = 9
CLASS_MASS_STORAGE = 8
CLASS_PER_INTERFACE = 0
CLASS_PRINTER = 7
CLASS_VENDOR_SPEC = 255
DT_CONFIG = 2
DT_CONFIG_SIZE = 9
DT_DEVICE = 1
DT_DEVICE_SIZE = 18
DT_ENDPOINT = 5
DT_ENDPOINT_AUDIO_SIZE = 9
DT_ENDPOINT_SIZE = 7
DT_HID = 33
DT_HUB = 41
DT_HUB_NONVAR_SIZE = 7
DT_INTERFACE = 4
DT_INTERFACE_SIZE = 9
DT_PHYSICAL = 35
DT_REPORT = 34
DT_STRING = 3
ENDPOINT_ADDRESS_MASK = 15
ENDPOINT_DIR_MASK = 128
ENDPOINT_IN = 128
ENDPOINT_OUT = 0
ENDPOINT_TYPE_BULK = 2
ENDPOINT_TYPE_CONTROL = 0
ENDPOINT_TYPE_INTERRUPT = 3
ENDPOINT_TYPE_ISOCHRONOUS = 1
ENDPOINT_TYPE_MASK = 3
ERROR_BEGIN = 500000
MAXALTSETTING = 128
MAXCONFIG = 8
MAXENDPOINTS = 32
MAXINTERFACES = 32
RECIP_DEVICE = 0
RECIP_ENDPOINT = 2
RECIP_INTERFACE = 1
RECIP_OTHER = 3
REQ_CLEAR_FEATURE = 1
REQ_GET_CONFIGURATION = 8
REQ_GET_DESCRIPTOR = 6
REQ_GET_INTERFACE = 10
REQ_GET_STATUS = 0
REQ_SET_ADDRESS = 5
REQ_SET_CONFIGURATION = 9
REQ_SET_DESCRIPTOR = 7
REQ_SET_FEATURE = 3
REQ_SET_INTERFACE = 11
REQ_SYNCH_FRAME = 12
TYPE_CLASS = 32
TYPE_RESERVED = 96
TYPE_STANDARD = 0
TYPE_VENDOR = 64

 
wiki/projects/python/pyusb/pydoc.txt · Last modified: 2006/06/16 19:03 (external edit)
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki