EIRTc@sddlZddlmZddlZejjejjdZejjejjdZejj edZ ejj edZ dZ ejej _ejejejgej_ejej_ejejejgej_ejejejejgej_ejej_ejejejgej_ejej_ejejgej_ejej_ejejgej_ejej_ejgej_ejejejgej_ejej_ejejgej_ejej_ejejejgej_ejej_dZd Zd Zd Zd Z d Z!e"dkrx5e#e!D]!\Z$Z%Z&de$e%e&fGHqWndS(iN(tutiltIOKittCoreFoundationtkIOMasterPortDefaulttkCFAllocatorDefaulticCs[tjt|jdt}tj||td}d}|rWtj|d}n|S(s Search the given device for the specified string property @param device_t Device to search @param property String to search for. @return Python string containing the value, or None if not found. t mac_romaniN( tcftCFStringCreateWithCStringRtencodetkCFStringEncodingMacRomantiokittIORegistryEntryCreateCFPropertytNonetCFStringGetCStringPtr(tdevice_ttpropertytkeyt CFContainertoutput((sH/opt/freeware/lib/python2.7/site-packages/serial/tools/list_ports_osx.pytget_string_propertyCs   cCsptjt|jdt}tj||td}tj}|ritj |dtj |}n|j S(s Search the given device for the specified string property @param device_t Device to search @param property String to search for. @return Python string containing the value, or None if not found. Rii( RRRRR R R tctypestc_uint16tCFNumberGetValuetbyreftvalue(RRRRtnumberR((sH/opt/freeware/lib/python2.7/site-packages/serial/tools/list_ports_osx.pytget_int_property^s    !cCs/tjd}tj|tj||jS(Nid(Rtcreate_string_bufferR tIOObjectGetClassRR(tdevicetpathname((sH/opt/freeware/lib/python2.7/site-packages/serial/tools/list_ports_osx.pytIORegistryEntryGetNameys cCsfx_t||kratj}tj|djdtj|}|dkrXdS|}qW|S(s Find the first parent of a device that implements the parent_type @param IOService Service to inspect @return Pointer to the parent type, or None if it was not found. t IOServiceRiN(RRtc_void_pR tIORegistryEntryGetParentEntryRRR (Rt parent_typetparenttresponse((sH/opt/freeware/lib/python2.7/site-packages/serial/tools/list_ports_osx.pytGetParentDeviceByTypes    cCstj}tjttj|tj|}g}x9tj|rttj|}|sdPn|j |q<Wtj ||S(s ( RR!R tIOServiceGetMatchingServicesRtIOServiceMatchingRtIOIteratorIsValidtIOIteratorNexttappendtIOObjectRelease(t service_typetserial_port_iteratorR%tservicestservice((sH/opt/freeware/lib/python2.7/site-packages/serial/tools/list_ports_osx.pytGetIOServicesByTypes   cCstd}g}x|D]}g}|jt|dt|d}|dkr|jt|d|jdt|dt|dt|dfn|jd |jd |j|qW|S( NtIOSerialBSDClienttIOCalloutDevicet IOUSBDevicesUSB Product NamesUSB VID:PID=%x:%x SNR=%stidVendort idProductsUSB Serial Numbersn/a(R1R+RR&R R(R/tportsR0tinfot usb_device((sH/opt/freeware/lib/python2.7/site-packages/serial/tools/list_ports_osx.pytcomportss"       t__main__s %s: %s [%s]('RRtretcdllt LoadLibraryt find_libraryR RR!tin_dllRRR R(trestypeR'targtypesR"tc_uint32R tIORegistryEntryGetPathRRR,tc_char_ptc_int32RR RRRR&R1R:t__name__tsortedtporttdescthwid(((sH/opt/freeware/lib/python2.7/site-packages/serial/tools/list_ports_osx.pytsF  $