文件操作 - list_ports_osx.cpython-310.pyc
返回文件管理
返回主菜单
删除本文件
文件: /usr/lib/python3/dist-packages/serial/tools/__pycache__/list_ports_osx.cpython-310.pyc
编辑文件内容
o 1�_�+ � @ s^ d dl mZ d dlZd dlmZ ej�d�Zej�d�Zd Z ej �ed�Zd Z dZdZd Zd Zd ZejZej ej_ej ej ej gej_eej_ej ej ej gej_eej_ej ej ej ejgej_ej ej_ej ej ej gej_eej_ej ej gej_eej_ej ej gej_eej_ej gej_ej ej ej!gej"_ej ej"_ej ejgej#_ej ej#_ej ej ej$ejgej%_ej&ej%_ej ejej gej'_ej ej'_ej gej(_dej(_dZ)dZ*d Z+dZ,dd� Z-dd� Z.dd� Zdd� Zdd� Z/dd� Z0dd� Z1G dd� de2�Z3dd � Z4d!d"� Z5d(d$d%�Z6e7d&k�r+e8e6� �D ]\Z9Z:Z;e<d'�=e9e:e;�� �qdS dS ))� )�absolute_importN)�list_ports_commonz0/System/Library/Frameworks/IOKit.framework/IOKitzB/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation�kCFAllocatorDefaulti zUSB Vendor NamezUSB Serial Number� � � � � c C s� t �t|�d�t�}t�| |td�}d}|rCt �|d�}|dur&|�d�}nt � t�}t �|t � |�tt�}|r>|j�d�}t �|� |S )z� Search the given device for the specified string property @param device_type Type of Device @param property String to search for @return Python string containing the value, or None if not found. �utf-8r N)�cf�CFStringCreateWithCStringr �encode�kCFStringEncodingUTF8�iokit�IORegistryEntryCreateCFProperty�CFStringGetCStringPtr�decode�ctypes�create_string_buffer�io_name_size�CFStringGetCString�byref�value� CFRelease)�device_type�property�key�CFContainer�output�buffer�success� r! �=/usr/lib/python3/dist-packages/serial/tools/list_ports_osx.py�get_string_propertyc s, �� r# c C sr t �t|�d�t�}t�| |td�}|r7|tkrt� � }n|t kr%t�� }t �||t� |�� t �|� |jS dS )a Search the given device for the specified string property @param device_type Device to search @param property String to search for @param cf_number_type CFType number @return Python string containing the value, or None if not found. r r N)r r r r r r r �kCFNumberSInt32Typer �c_uint32�kCFNumberSInt16Type�c_uint16�CFNumberGetValuer r r )r r �cf_number_typer r �numberr! r! r"