Module usb :: Class DeviceHandle
[hide private]
[frames] | no frames]

Class DeviceHandle




DeviceHandle object

Instance Methods [hide private]
  __new__(T, S, ...)
  bulkRead(endpoint, size, timeout=100)
Performs a bulk read request to the endpoint specified.
  bulkWrite(endpoint, buffer, timeout=100)
Performs a bulk write request to the endpoint specified.
  claimInterface(interface)
Claims the interface with the Operating System.
  clearHalt(endpoint)
Clears any halt status on the specified endpoint.
  controlMsg(requestType, request, buffer, value=0, index=0, timeout=100)
Performs a control request to the default control pipe on a device.
  getDescriptor(...)
getDescriptor(type, index, len, endpoint = -1) -> descriptor Retrieves a descriptor from the device identified by the type and index of the descriptor.
  getString(...)
getString(index, len, langid = -1) -> string Retrieves the string descriptor specified by index and langid from a device.
  interruptRead(endpoint, size, timeout=100)
Performs a interrupt read request to the endpoint specified.
  interruptWrite(endpoint, buffer, timeout=100)
Performs a interrupt write request to the endpoint specified.
  releaseInterface()
Releases an interface previously claimed with claimInterface.
  reset()
Resets the specified device by sending a RESET down the port it is connected to.
  resetEndpoint(endpoint)
Resets all state (like toggles) for the specified endpoint.
  setAltInterface(alternate)
Sets the active alternate setting of the current interface.
  setConfiguration(configuration)
Sets the active configuration of a device.

Inherited from object: __delattr__, __getattribute__, __hash__, __init__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__


Properties [hide private]

Inherited from object: __class__


Method Details [hide private]

__new__(T, S, ...)

 
Returns:
a new object with type S, a subtype of T

Overrides: object.__new__

bulkRead(endpoint, size, timeout=100)

 
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.

Returns:
buffer

bulkWrite(endpoint, buffer, timeout=100)

 
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.

Returns:
bytesWritten

claimInterface(interface)

 
Claims the interface with the Operating System.
Arguments:
        interface: interface number or an Interface object.

Returns:
None

clearHalt(endpoint)

 
Clears any halt status on the specified endpoint.
Arguments:
        endpoint: endpoint number.

Returns:
None

controlMsg(requestType, request, buffer, value=0, index=0, timeout=100)

 
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.

Returns:
bytesWritten|buffer

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(endpoint, size, timeout=100)

 
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.

Returns:
buffer

interruptWrite(endpoint, buffer, timeout=100)

 
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.

Returns:
bytesWritten

releaseInterface()

 
Releases an interface previously claimed with claimInterface.
Returns:
None

reset()

 
Resets the specified device by sending a RESET down the port it is connected to.
Returns:
None

resetEndpoint(endpoint)

 
Resets all state (like toggles) for the specified endpoint.
Arguments:
        endpoint: endpoint number.

Returns:
None

setAltInterface(alternate)

 
Sets the active alternate setting of the current interface.
Arguments:
        alternate: an alternate setting number or an Interface object.

Returns:
None

setConfiguration(configuration)

 
Sets the active configuration of a device.
Arguments:
        configuration: a configuration value or a Configuration object.

Returns:
None