Module Expr Str Assign NameStore Str Import alias Import alias ImportFrom alias Import alias identifier Assign NameStore Num Assign NameStore Num Assign NameStore Num Assign NameStore Num Assign NameStore Num Assign NameStore Num Assign NameStore Num Assign NameStore Num Assign NameStore Num Assign NameStore Num Assign NameStore Num Assign NameStore BinOpLShift Num Num Assign NameStore BinOpLShift Num Num Assign NameStore BinOpLShift Num Num Assign NameStore BinOpLShift Num Num Assign NameStore Num Assign NameStore Num Assign NameStore Num Assign NameStore Num Assign NameStore Num Assign NameStore Num Assign NameStore Num Assign NameStore Num Assign NameStore Num Assign NameStore Num Assign NameStore Call AttributeLoad Str attr Str Assign NameStore Num Assign NameStore Num Assign NameStore Num Assign NameStore Num Assign NameStore Num FunctionDef arguments args NameParam defaults body Expr Str Return BinOpBitAnd NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Return BinOpBitAnd NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Return BinOpBitAnd NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Return BinOpBitAnd NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str Return BinOpBitOr BinOpBitOr NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Return Call AttributeLoad NameLoad attr Str BinOpMult NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad NameLoad kwarg body Expr Str FunctionDef arguments args defaults kwarg body For NameStore NameLoad body Assign NameStore GeneratorExp CompareEq NameLoad Call NameLoad NameLoad NameLoad comprehension TupleStore NameStore NameStore Call AttributeLoad NameLoad attr If BoolOpAnd Call AttributeLoad NameLoad attr NameLoad BoolOpOr CompareIs NameLoad NameLoad Call NameLoad NameLoad body Expr Yield NameLoad decorator_list If NameLoad body Return Call NameLoad NameLoad orelse TryExcept body Return Call AttributeLoad NameLoad attr Call NameLoad NameLoad handlers ExceptHandler type NameLoad body Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str ImportFrom alias Assign NameStore Call NameLoad NameLoad Num NameLoad Num If BoolOpOr CompareLt Call NameLoad NameLoad Num CompareLt SubscriptLoad NameLoad Index Num Num CompareNotEq BinOpBitAnd SubscriptLoad NameLoad Index Num Num Num body Return TupleLoad Return Call NameLoad Call NameLoad Lambda arguments args NameParam NameParam defaults BinOpAdd NameLoad BinOpLShift NameLoad Num SubscriptLoad NameLoad Slice Num SubscriptLoad NameLoad Index Num Num SubscriptLoad NameLoad Slice Num SubscriptLoad NameLoad Index Num Num decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Expr Str If CompareEq Num NameLoad body Return NameLoad ImportFrom alias Assign NameStore AttributeLoad NameLoad attr If CompareEq Num Call NameLoad NameLoad body Raise Call NameLoad Str If CompareIs NameLoad NameLoad body Assign NameStore SubscriptLoad NameLoad Index Num orelse If CompareNotIn NameLoad NameLoad body Raise Call NameLoad Str Assign NameStore Call NameLoad NameLoad Num NameLoad NameLoad NameLoad If CompareGtE NameLoad Num body Return Call AttributeLoad Call AttributeLoad SubscriptLoad NameLoad Slice Num SubscriptLoad NameLoad Index Num attr attr Str orelse Return Call AttributeLoad Call AttributeLoad SubscriptLoad NameLoad Slice Num SubscriptLoad NameLoad Index Num attr attr Str decorator_list
N/A N/A usb.util - Utility functions.

This module exports:

endpoint_address - return the endpoint absolute address.
endpoint_direction - return the endpoint transfer direction.
endpoint_type - return the endpoint type
ctrl_direction - return the direction of a control transfer
build_request_type - build a bmRequestType field of a control transfer.
find_descriptor - find an inner descriptor.
claim_interface - explicitly claim an interface.
release_interface - explicitly release an interface.
dispose_resources - release internal resources allocated by the object.
get_langids - retrieve the list of supported string languages from the device.
get_string - retrieve a string descriptor from the device.
 N/A __author__ Wander Lairson Costa N/A operator N/A array sys hexversion N/A usb._interop _interop N/A DESC_TYPE_DEVICE 1 N/A DESC_TYPE_CONFIG 2 N/A DESC_TYPE_STRING 3 N/A DESC_TYPE_INTERFACE 4 N/A DESC_TYPE_ENDPOINT 5 N/A ENDPOINT_IN 128 N/A ENDPOINT_OUT 0 N/A ENDPOINT_TYPE_CTRL 0 N/A ENDPOINT_TYPE_ISO 1 N/A ENDPOINT_TYPE_BULK 2 N/A ENDPOINT_TYPE_INTR 3 N/A CTRL_TYPE_STANDARD N/A 0 5 N/A CTRL_TYPE_CLASS N/A 1 5 N/A CTRL_TYPE_VENDOR N/A 2 5 N/A CTRL_TYPE_RESERVED N/A 3 5 N/A CTRL_RECIPIENT_DEVICE 0 N/A CTRL_RECIPIENT_INTERFACE 1 N/A CTRL_RECIPIENT_ENDPOINT 2 N/A CTRL_RECIPIENT_OTHER 3 N/A CTRL_OUT 0 N/A CTRL_IN 128 N/A _ENDPOINT_ADDR_MASK 15 N/A _ENDPOINT_DIR_MASK 128 N/A _ENDPOINT_TRANSFER_TYPE_MASK 3 N/A _CTRL_DIR_MASK 128 N/A _dummy_s N/A N/A encode utf-8 N/A SPEED_LOW 1 N/A SPEED_FULL 2 N/A SPEED_HIGH 3 N/A SPEED_SUPER 4 N/A SPEED_UNKNOWN 0 endpoint_address N/A N/A address N/A N/A N/A Return the endpoint absolute address.

    The address parameter is the bEndpointAddress field
    of the endpoint descriptor.
     N/A N/A address _ENDPOINT_ADDR_MASK N/A endpoint_direction N/A N/A address N/A N/A N/A Return the endpoint direction.

    The address parameter is the bEndpointAddress field
    of the endpoint descriptor.
    The possible return values are ENDPOINT_OUT or ENDPOINT_IN.
     N/A N/A address _ENDPOINT_DIR_MASK N/A endpoint_type N/A N/A bmAttributes N/A N/A N/A Return the transfer type of the endpoint.

    The bmAttributes parameter is the bmAttributes field
    of the endpoint descriptor.
    The possible return values are: ENDPOINT_TYPE_CTRL,
    ENDPOINT_TYPE_ISO, ENDPOINT_TYPE_BULK or ENDPOINT_TYPE_INTR.
     N/A N/A bmAttributes _ENDPOINT_TRANSFER_TYPE_MASK N/A ctrl_direction N/A N/A bmRequestType N/A N/A N/A Return the direction of a control request.

    The bmRequestType parameter is the value of the
    bmRequestType field of a control transfer.
    The possible return values are CTRL_OUT or CTRL_IN.
     N/A N/A bmRequestType _CTRL_DIR_MASK N/A build_request_type N/A N/A direction type recipient N/A N/A N/A Build a bmRequestType field for control requests.

    These is a conventional function to build a bmRequestType
    for a control request.

    The direction parameter can be CTRL_OUT or CTRL_IN.
    The type parameter can be CTRL_TYPE_STANDARD, CTRL_TYPE_CLASS,
    CTRL_TYPE_VENDOR or CTRL_TYPE_RESERVED values.
    The recipient can be CTRL_RECIPIENT_DEVICE, CTRL_RECIPIENT_INTERFACE,
    CTRL_RECIPIENT_ENDPOINT or CTRL_RECIPIENT_OTHER.

    Return the bmRequestType value.
     N/A N/A N/A recipient type direction N/A create_buffer N/A N/A length N/A N/A N/A Create a buffer to be passed to a read function.

    A read function may receive an out buffer so the data
    is read inplace and the object can be reused, avoiding
    the overhead of creating a new object at each new read
    call. This function creates a compatible sequence buffer
    of the given length.
     N/A N/A N/A array array B N/A _dummy_s length N/A find_descriptor N/A N/A desc find_all custom_match N/A False None args N/A N/A Find an inner descriptor.

    find_descriptor works in the same way as the core.find() function does,
    but it acts on general descriptor objects. For example, suppose you
    have a Device object called dev and want a Configuration of this
    object with its bConfigurationValue equals to 1, the code would
    be like so:

    >>> cfg = util.find_descriptor(dev, bConfigurationValue=1)

    You can use any field of the Descriptor as a match criteria, and you
    can supply a customized match just like core.find() does. The
    find_descriptor function also accepts the find_all parameter to get
    an iterator instead of just one descriptor.
     desc_iter N/A N/A N/A kwargs N/A N/A d desc N/A N/A tests N/A N/A val N/A getattr d key N/A N/A key val N/A N/A kwargs items N/A N/A N/A N/A _interop _all tests N/A N/A custom_match None N/A custom_match d N/A N/A N/A d N/A N/A find_all N/A N/A N/A desc_iter args N/A N/A N/A N/A N/A N/A _interop _next N/A desc_iter args N/A N/A N/A StopIteration N/A N/A None N/A claim_interface N/A N/A device interface N/A N/A N/A Explicitly claim an interface.

    PyUSB users normally do not have to worry about interface claiming,
    as the library takes care of it automatically. But there are situations
    where you need deterministic interface claiming. For these uncommon
    cases, you can use claim_interface.

    If the interface is already claimed, either through a previously call
    to claim_interface or internally by the device object, nothing happens.
     N/A N/A N/A N/A device _ctx managed_claim_interface device interface N/A release_interface N/A N/A device interface N/A N/A N/A Explicitly release an interface.

    This function is used to release an interface previously claimed,
    either through a call to claim_interface or internally by the
    device object.

    Normally, you do not need to worry about claiming policies, as
    the device object takes care of it automatically.
     N/A N/A N/A N/A device _ctx managed_release_interface device interface N/A dispose_resources N/A N/A device N/A N/A N/A Release internal resources allocated by the object.

    Sometimes you need to provide deterministic resources
    freeing, for example to allow another application to
    talk to the device. As Python does not provide deterministic
    destruction, this function releases all internal resources
    allocated by the device, like device handle and interface
    policy.

    After calling this function, you can continue using the device
    object normally. If the resources will be necessary again, it
    will be allocated automatically.
     N/A N/A N/A N/A device _ctx dispose device N/A get_langids N/A N/A dev N/A N/A N/A Retrieve the list of supported Language IDs from the device.

    Most client code should not call this function directly, but instead use
    the langids property on the Device object, which will call this function as
    needed and cache the result.

    USB LANGIDs are 16-bit integers familiar to Windows developers, where
    for example instead of en-US you say 0x0409. See the file USB_LANGIDS.pdf
    somewhere on the usb.org site for a list, which does not claim to be
    complete. It requires "system software must allow the enumeration and
    selection of LANGIDs that are not currently on this list." It also requires
    "system software should never request a LANGID not defined in the LANGID
    code array (string index = 0) presented by a device." Client code can
    check this tuple before issuing string requests for a specific language ID.

    dev is the Device object whose supported language IDs will be retrieved.

    The return value is a tuple of integer LANGIDs, possibly empty if the
    device does not support strings at all (which USB 3.1 r1.0 section
    9.6.9 allows). In that case client code should not request strings at all.

    A USBError may be raised from this function for some devices that have no
    string support, instead of returning an empty tuple. The accessor for the
    langids property on Device catches that case and supplies an empty tuple,
    so client code can ignore this detail by using the langids property instead
    of directly calling this function.
     usb.control get_descriptor N/A buf N/A get_descriptor dev 254 DESC_TYPE_STRING 0 N/A N/A N/A N/A len buf 4 N/A N/A buf N/A 0 4 N/A N/A N/A buf N/A 0 1 0 N/A N/A N/A N/A N/A tuple N/A map N/A N/A N/A x y N/A N/A x N/A y 8 N/A buf N/A 2 N/A buf N/A 0 2 N/A buf N/A 3 N/A buf N/A 0 2 N/A get_string N/A N/A dev index langid N/A None N/A N/A Retrieve a string descriptor from the device.

    dev is the Device object which the string will be read from.

    index is the string descriptor index and langid is the Language
    ID of the descriptor. If langid is omitted, the string descriptor
    of the first Language ID will be returned.

    Zero is never the index of a real string. The USB spec allows a device to
    use zero in a string index field to indicate that no string is provided.
    So the caller does not have to treat that case specially, this function
    returns None if passed an index of zero, and generates no traffic
    to the device.

    The return value is the unicode string present in the descriptor, or None
    if the requested index was zero.

    It is a ValueError to request a real string (index not zero), if: the
    device's langid tuple is empty, or with an explicit langid the device does
    not support.
     N/A N/A 0 index N/A N/A None usb.control get_descriptor N/A langids N/A dev langids N/A N/A 0 N/A len langids N/A N/A N/A ValueError The device has no langid N/A N/A langid None N/A N/A langid N/A langids N/A 0 N/A N/A N/A langid langids N/A N/A N/A ValueError The device does not support the specified langid N/A buf N/A get_descriptor dev 255 DESC_TYPE_STRING index langid N/A N/A hexversion 50462720 N/A N/A N/A N/A N/A N/A N/A buf N/A 2 N/A buf N/A 0 tobytes decode utf-16-le N/A N/A N/A N/A N/A N/A N/A buf N/A 2 N/A buf N/A 0 tostring decode utf-16-le N/A