Your IP : 3.149.238.67


Current Path : /usr/lib/python3.6/site-packages/__pycache__/
Upload File :
Current File : //usr/lib/python3.6/site-packages/__pycache__/hwdata.cpython-36.pyc

3

U�Z��@sJddlZejddkZGdd�de�ZGdd�de�ZGdd�de�ZdS)	�N�c@s2eZdZdZdZdZd
dd�Zdd�Zdd	�ZdS)�USBz) Interace to usb.ids from hwdata package z/usr/share/hwdata/usb.idsNcCs�|r||_ntj|_d|_|jo&tj�r�it_trDt|jdd�}n
t|j�}d}d}d}�xb|j�D�]T}|d7}|j�}|jd�r�|jd�rfPnqfqft	|�dkr�qfqf|jd��r2|dj
�}t	|�d	kr�d
j|dd��}	nd}	y|	tj|d|d|<Wn,tk
�r.t
jjdj||j��YnXqf|jd
��rt|dj
�}d
j|dd��}
|
igtj|d|<qf|dj
�}d
j|dd��}|tjk�r�|igtj|<qf|tj|d<qfWdS)z Load pci.ids from file to internal data structure.
            parameter 'filename' can specify location of this file
        �z	ISO8859-1)�encodingrN�#z8# List of known device classes, subclasses and protocolsz		�� �z!Unknown line at line {0} in {1}.
�	)�filenamer�cache�devices�inPy3k�open�	readlines�split�
startswith�len�lower�join�	TypeError�sys�stderr�write�format)�selfr�f�lineno�vendor�device�line�lZinterface_idZinterface_name�device_name�vendor_name�r$�/usr/lib/python3.6/hwdata.py�__init__sN


zUSB.__init__cCs2|j�}|jr,|tjkr&tj|dSdSn�dS)z~ Return description of vendor. Parameter is two byte code in hexa.
            If vendor is unknown None is returned.
        rN)rrrr
)rrr$r$r%�
get_vendorOs
zUSB.get_vendorcCsZ|j�}|j�}|jrT|tjkrN|tj|dkrHtj|d|dSdSqVdSn�dS)z� Return description of device. Parameters are two byte code variables in hexa.
            If device is unknown None is returned.
        rrN)rrrr
)rrrr$r$r%�
get_device\s
zUSB.get_device)N)	�__name__�
__module__�__qualname__�__doc__rr
r&r'r(r$r$r$r%rs
4
rc@s2eZdZdZdZdZd
dd�Zdd�Zdd	�ZdS)�PCIz) Interace to pci.ids from hwdata package z/usr/share/hwdata/pci.idsNc	Cs(|r||_ntj|_d|_|jo&tj�r$it_trDt|jdd�}n
t|j�}d}x�|j�D]�}|j�}|jd�rvq\q\t	|�dkr�q\q\|jd�r�q\q\|jd�r�|dj
�}d	j|dd��}|tj|d|<q\|dj
�}d	j|dd��}|ttjj
��k�r|igtj|<q\|tj|d<q\WdS)
z Load pci.ids from file to internal data structure.
            parameter 'filename' can specify location of this file
        rz	ISO8859-1)rNrrz		r
r)rr-rr
rrrrrrrr�list�keys)	rrrrr r!rr"r#r$r$r%r&rs6



zPCI.__init__cCs:|j�}|jr4|ttjj��kr.tj|dSdSn�dS)z~ Return description of vendor. Parameter is two byte code in hexa.
            If vendor is unknown None is returned.
        rN)rrr.r-r
r/)rrr$r$r%r'�szPCI.get_vendorcCsf|j�}|j�}|jr`|ttjj��krZ|ttj|dj��krTtj|d|SdSqbdSn�dS)z� Return description of device. Parameters are two byte code variables in hexa.
            If device is unknown None is returned.
        rN)rrr.r-r
r/)rrrr$r$r%r(�szPCI.get_device)N)	r)r*r+r,rr
r&r'r(r$r$r$r%r-ms
&
r-c@s*eZdZdZdZdZddd�Zdd�ZdS)	�PNPz) Interace to pnp.ids from hwdata package z/usr/share/hwdata/pnp.idsNcCs�|r||_ntj|_d|_|jr�tjr�it_trBt|jdd�}n
t|j�}xZ|j�D]N}|j�}|jd�rpqVqVt	|�dkr�qVqV|dj
�}dj|dd��tj|<qVWdS)z Load pnp.ids from file to internal data structure.
            parameter 'filename' can specify location of this file
        rz	ISO8859-1)rrrrN)rr0r�VENDORSrrrrrr�upperr)rrrr r!�	vendor_idr$r$r%r&�s"

zPNP.__init__cCs6|j�}|jr0|ttjj��kr*tj|SdSn�dS)z� Return description of vendor. Parameter is 3 character long id of vendor.
            If vendor is unknown None is returned.
        N)r2rr.r0r1r/)rr3r$r$r%r'�s
zPNP.get_vendor)N)r)r*r+r,rr1r&r'r$r$r$r%r0�s

r0)r�version_infor�objectrr-r0r$r$r$r%�<module>sWI

?>