🔐 Sid Gifari File Manager Pro
v8.0.5 | 2026-08-08 02:14:04 | PHP 8.2.32
📂
/ (Root)
/
usr
/
lib
/
python3.6
/
site-packages
/
serial
/
tools
/
__pycache__
📍 /usr/lib/python3.6/site-packages/serial/tools/__pycache__
🔄 Refresh
✏️
Editing: list_ports_linux.cpython-36.pyc
Read Only
3 M�]W� � @ sn d dl Z d dlZd dlmZ G dd� dej�Zdd� Zedkrjx*ee� �D ]\Z Z Zedj e e e�� qJW dS ) � N)�list_ports_commonc s( e Zd ZdZ� fdd�Zdd� Z� ZS )�SysFSz-Wrapper for easy sysfs access and device infoc s� t t| �j|� tjj|�| _d | _tjjdj | j��rrtjj dj | j��| _tjjtjj tjj| jd���| _ nd | _d | _ | j dkr�tjjtjj| j��| _n"| j dkr�tjj| j�| _nd | _| jd k �rLt| j| jd�d�| _t| j| jd�d�| _| j| jd�| _tjj| j�| _| j| jd �| _| j| jd �| _| j| jd�| _| j dk�rb| j� nJ| j dk�r�| j| _| j| jd �| _n$| j dk�r�| j| _tjj| j�| _d S )Nz/sys/class/tty/{}/device� subsystem� usb-serial�usbZidVendor� Z idProduct�serial�manufacturer�product� interfaceZpnp�idZamba)r r )�superr �__init__�os�path�basename�nameZusb_device_path�exists�format�realpathZdevice_path�joinr �dirname�int� read_lineZvid�pidZ serial_number�locationr r r Zapply_usb_info�description�hwid)�selfZdevice)� __class__� �&/usr/lib/python3.6/list_ports_linux.pyr s: $ zSysFS.__init__c G sF y,t tjj|� ��}|j� j� }W dQ R X |S tk r@ dS X dS )z� Helper function to read a single line from a file. One or more parameters are allowed, they are joined with os.path.join. Returns None on errors.. N)�openr r r �readline�strip�IOError)r �args�f�liner r r! r 8 s zSysFS.read_line)�__name__� __module__�__qualname__�__doc__r r � __classcell__r r )r r! r s %r c C sb t j d�} | jt j d�� | jt j d�� | jt j d�� | jt j d�� dd� dd� | D �D �S ) Nz /dev/ttyS*z/dev/ttyUSB*z/dev/ttyACM*z/dev/ttyAMA*z/dev/rfcomm*c S s g | ]}|j d kr|�qS )�platform)r )�.0�infor r r! � <listcomp>L s zcomports.<locals>.<listcomp>c S s g | ]}t |��qS r )r )r/ �dr r r! r1 M s )�glob�extend)Zdevicesr r r! �comportsF s r5 �__main__z{}: {} [{}])r3 r Zserial.toolsr ZListPortInfor r5 r) �sortedZportZdescr �printr r r r r! �<module> s 6
💾 Save Changes
❌ Cancel