unitelabs.bus.factories.usb_factory

Attributes

  • Name
    P
    Type
    Value

    = typing.TypeVar('P', bound=asyncio.Protocol)

    Description

Functions

  • create_usb_connection(
      protocol_factory : typing.Callable[..., P],
      vendor : int,
      product : int,
      **kwargs
    ) -> tuple[Transport, P]

    Create a USB connection with a device based on specified `vendor` and `product` IDs.

    Parameters

    • Name
      protocol_factory
      Type
      typing.Callable[..., P]
      Default
      Description

      A callable that returns an instance of the protocol to be used.

    • Name
      vendor
      Type
      int
      Default
      Description

      The vendor ID of the USB device.

    • Name
      product
      Type
      int
      Default
      Description

      The product ID of the USB device.

    • Name
      **kwargs
      Type
      Default
      = {}
      Description

      Additional keyword arguments to be passed to the `UsbTransport` constructor.

    Response

    Type
    tuple[Transport, P]
    Description

    A tuple containing the `UsbTransport` instance and the protocol instance.

  • open_usb_connection(
      vendor : int,
      product : int,
      **kwargs
    ) -> tuple[asyncio.streams.StreamReader, asyncio.streams.StreamWriter]

    Establish a USB connection with a device based on specified `vendor` and `product` IDs.

    Parameters

    • Name
      vendor
      Type
      int
      Default
      Description

      The vendor ID of the USB device.

    • Name
      product
      Type
      int
      Default
      Description

      The product ID of the USB device.

    • Name
      **kwargs
      Type
      Default
      = {}
      Description

      Additional keyword arguments to be passed to the `UsbTransport` constructor.

    Response

    Type
    tuple[asyncio.streams.StreamReader, asyncio.streams.StreamWriter]
    Description

    A tuple containing the `asyncio.streams.StreamReader` and `asyncio.streams.StreamWriter` instances for the USB connection.

Copyright © 2024