
    
                     4    d Z  G d de      Z G d de      Zy)zImplement base classes for hid package.

This module provides the base classes implemented by the
platform-specific modules.  It includes a base class for
all implementations built on interacting with file-like objects.
c                   >    e Zd ZdZed        Zd Zd Zd Zd Z	d Z
y)		HidDevicez/Base class for all HID devices in this package.c                       y)aP  Enumerates all the hid devices.

    This function enumerates all the hid device and provides metadata
    for helping the client select one.

    Returns:
      A list of dictionaries of metadata.  Each implementation is required
      to provide at least: vendor_id, product_id, product_string, usage,
      usage_page, and path.
    N r       )platform/bq/third_party/pyu2f/hid/base.py	EnumeratezHidDevice.Enumerate   s     	r   c                      y)zInitialize the device at path.Nr   )selfpaths     r   __init__zHidDevice.__init__)   s    r   c                      y)zReturns the max input report data length in bytes.

    Returns the max input report data length in bytes.  This excludes the
    report id.
    Nr   r
   s    r   GetInReportDataLengthzHidDevice.GetInReportDataLength-        	r   c                      y)zReturns the max output report data length in bytes.

    Returns the max output report data length in bytes.  This excludes the
    report id.
    Nr   r   s    r   GetOutReportDataLengthz HidDevice.GetOutReportDataLength5   r   r   c                      y)zWrites packet to device.

    Writes the packet to the device.

    Args:
      packet: An array of integers to write to the device.  Excludes the report
      ID. Must be equal to GetOutReportLength().
    Nr   )r
   packets     r   WritezHidDevice.Write=        	r   c                      y)zReads packet from device.

    Reads the packet from the device.

    Returns:
      An array of integers read from the device.  Excludes the report ID.
      The length is equal to GetInReportDataLength().
    Nr   r   s    r   ReadzHidDevice.ReadH   r   r   N)__name__
__module____qualname____doc__staticmethodr   r   r   r   r   r   r   r   r   r   r      s0    7	 								r   r   c                   6    e Zd ZdZdZdZdZdZdZdZ	dZ
dZd Zy)DeviceDescriptorz.Descriptor for basic attributes of the device.N    c                     i }t        | j                  j                               D ]  \  }}|j                  d      r|||<    |S )N	internal_)list__dict__items
startswith)r
   outkvs       r   ToPublicDictzDeviceDescriptor.ToPublicDicta   sC    
CT]]((*+1\\+&A , Jr   )r   r   r   r   
usage_pageusage	vendor_id
product_idproduct_stringr   internal_max_in_report_leninternal_max_out_report_lenr*   r   r   r   r   r   T   s4    6*
%)*.	$  !r   r   N)r   objectr   r   r   r   r   <module>r3      s#    9	 9	xv r   