File: //usr/lib/python3.9/site-packages/usb/__pycache__/core.cpython-39.pyc
a
j��Yp� � @ s< d Z dZg d�ZddlmZ ddlZddlZddlmZ ddl m
Z
ddlmZ
ddlZddlZddlZddlZe�d�ZdZdd� Zd&dd�Zd'd
d�ZG dd� de�Zdd� ZG dd� de�ZG dd� de�ZG dd� de�Z G dd� de�Z!G dd� de�Z"G dd� de�Z#G dd � d e
j$�Z%d(d"d#�Z&d)d$d%�Z'dS )*av usb.core - Core USB features.
This module exports:
Device - a class representing a USB device.
Configuration - a class representing a configuration descriptor.
Interface - a class representing an interface descriptor.
Endpoint - a class representing an endpoint descriptor.
find() - a function to find USB devices.
show_devices() - a function to show the devices present.
zWander Lairson Costa)�Device�
Configuration� Interface�Endpoint�find�show_devices� Nzusb.corei� c C s |D ]}t ||t| |�� qd S �N)�setattr�getattr)�input�output�fields�f� r �,/usr/lib/python3.9/site-packages/usb/core.py� _set_attr= s r � �Error Accessing Stringc C sL |dkr|}n:z(|du r&t �| |�}nt �| ||�}W n |}Y n0 |S )z= try to get a string, but return a string no matter what
r N)�util�
get_string)�dev�indexZlangidZdefault_str_i0Zdefault_access_error�stringr r r �_try_get_stringA s
r c C s( z| | }W n t y" |}Y n0 |S )zS try to get a string from the lookup table, return "" instead of key
error
)�KeyError)�table�value�defaultr r r r �_try_lookupQ s
r c @ s e Zd ZdZdd� ZdS )�_DescriptorInfozc this class is used so that when a descriptor is shown on the
terminal it is propely formatted c C s | S r r ��selfr r r �__repr__^ s z_DescriptorInfo.__repr__N)�__name__�
__module__�__qualname__�__doc__r"