PNG  IHDR;IDATxܻn0K )(pA 7LeG{ §㻢|ذaÆ 6lذaÆ 6lذaÆ 6lom$^yذag5bÆ 6lذaÆ 6lذa{ 6lذaÆ `}HFkm,mӪôô! x|'ܢ˟;E:9&ᶒ}{v]n&6 h_tڠ͵-ҫZ;Z$.Pkž)!o>}leQfJTu іچ\X=8Rن4`Vwl>nG^is"ms$ui?wbs[m6K4O.4%/bC%t Mז -lG6mrz2s%9s@-k9=)kB5\+͂Zsٲ Rn~GRC wIcIn7jJhۛNCS|j08yiHKֶۛkɈ+;SzL/F*\Ԕ#"5m2[S=gnaPeғL lذaÆ 6l^ḵaÆ 6lذaÆ 6lذa; _ذaÆ 6lذaÆ 6lذaÆ RIENDB`  7Tc@s$dZdZddlZddljZdZdZdZdZdZ d Z d Z d Z dZ dZdZdZdZdZdZd ZdZdZdZd Zd Zd Zd ZdZd Zd Zd ZdZ dZ!dZ"e#ddZ%dZ&dZ'dZ(ddZ)dS(smusb.util - Utility functions. This module exports: endpoint_address - return the endpoint absolute address. endpoint_direction - return the endpoint transfer direction. endpoint_type - return the endpoint type ctrl_direction - return the direction of a control transfer build_request_type - build a bmRequestType field of a control transfer. find_descriptor - find an inner descriptor. claim_interface - explicitly claim an interface. release_interface - explicitly release an interface. dispose_resources - release internal resources allocated by the object. get_string - retrieve a string descriptor from the device. sWander Lairson CostaiNiiiiiiiicCs|t@S(sReturn the endpoint absolute address. The address parameter is the bEndpointAddress field of the endpoint descriptor. (t_ENDPOINT_ADDR_MASK(taddress((s,/usr/lib/python2.7/site-packages/usb/util.pytendpoint_addressXscCs|t@S(sReturn the endpoint direction. The address parameter is the bEndpointAddress field of the endpoint descriptor. The possible return values are ENDPOINT_OUT or ENDPOINT_IN. (t_ENDPOINT_DIR_MASK(R((s,/usr/lib/python2.7/site-packages/usb/util.pytendpoint_direction`scCs|t@S(sReturn the transfer type of the endpoint. The bmAttributes parameter is the bmAttributes field of the endpoint descriptor. The possible return values are: ENDPOINT_TYPE_CTRL, ENDPOINT_TYPE_ISO, ENDPOINT_TYPE_BULK or ENDPOINT_TYPE_INTR. (t_ENDPOINT_TRANSFER_TYPE_MASK(t bmAttributes((s,/usr/lib/python2.7/site-packages/usb/util.pyt endpoint_typeiscCs|t@S(sReturn the direction of a control request. The bmRequestType parameter is the value of the bmRequestType field of a control transfer. The possible return values are CTRL_OUT or CTRL_IN. (t_CTRL_DIR_MASK(t bmRequestType((s,/usr/lib/python2.7/site-packages/usb/util.pytctrl_directionsscCs ||B|BS(sBuild a bmRequestType field for control requests. These is a conventional function to build a bmRequestType for a control request. The direction parameter can be CTRL_OUT or CTRL_IN. The type parameter can be CTRL_TYPE_STANDARD, CTRL_TYPE_CLASS, CTRL_TYPE_VENDOR or CTRL_TYPE_RESERVED values. The recipient can be CTRL_RECIPIENT_DEVICE, CTRL_RECIPIENT_INTERFACE, CTRL_RECIPIENT_ENDPOINT or CTRL_RECIPIENT_OTHER. Return the bmRequestType value. ((t directionttypet recipient((s,/usr/lib/python2.7/site-packages/usb/util.pytbuild_request_type|sc sfd}|j|j}}|rQg|||D] }|^qASytj|||SWntk rdSXdS(sFind an inner descriptor. find_descriptor works in the same way the core.find() function does, but it acts on general descriptor objects. For example, suppose you have a Device object called dev and want a Configuration of this object with its bConfigurationValue equals to 1, the code would be like so: >>> cfg = util.find_descriptor(dev, bConfigurationValue=1) You can use any field of the Descriptor as a match criteria, and you can supply a customized match just like core.find() does. The find_descriptor function also accepts the find_all parameter to get a list of descriptor instead of just one. c 3snxgD]_dks%rtjdttj|tfd|trVqqWdS(NcSs |o |S(N((tatb((s,/usr/lib/python2.7/site-packages/usb/util.pytscs t|S(N(tgetattr(ti(td(s,/usr/lib/python2.7/site-packages/usb/util.pyRs(tNonet_interopt_reducetmaptoperatorteqtTrue(tktv(t custom_matchtdesc(Rs,/usr/lib/python2.7/site-packages/usb/util.pyt desc_iters  N(tkeystvaluesRt_nextt StopIterationR(Rtfind_allRtargsR RRR((RRs,/usr/lib/python2.7/site-packages/usb/util.pytfind_descriptors  cCs|jj||dS(sExplicitly claim an interface. PyUSB users normally do not have to worry about interface claiming, as the library takes care of it automatically. But there are situations where you need deterministic interface claiming. For these uncommon cases, you can use claim_interface. If the interface is already claimed, either through a previously call to claim_interface or internally by the device object, nothing happens. N(t_ctxtmanaged_claim_interface(tdevicet interface((s,/usr/lib/python2.7/site-packages/usb/util.pytclaim_interfaces cCs|jj||dS(s;Explicitly release an interface. This function is used to release an interface previously claimed, either through a call to claim_interface or internally by the device object. Normally, you do not need to worry about claiming policies, as the device object takes care of it automatically. N(R(tmanaged_release_interface(R*R+((s,/usr/lib/python2.7/site-packages/usb/util.pytrelease_interfaces cCs|jj|dS(s"Release internal resources allocated by the object. Sometimes you need to provide deterministic resources freeing, for example to allow another application to talk to the device. As Python does not provide deterministic destruction, this function releases all internal resources allocated by the device, like device handle and interface policy. After calling this function, you can continue using the device object normally. If the resources will be necessary again, it will allocate them automatically. N(R(tdispose(R*((s,/usr/lib/python2.7/site-packages/usb/util.pytdispose_resourcesscCsddlm}|d krb||dtd}t|dksIt|d|dd>B}n|||ddt||}|d|d!jjd S( sRetrieve a string descriptor from the device. dev is the Device object to which the request will be sent to. length is the maximum length of the string in number of characters. index is the string descriptor index and langid is the Language ID of the descriptor. If langid is omitted, the string descriptor of the first Language ID will be returned. The return value is the unicode string present in the descriptor. i(tget_descriptoriiiiiis utf-16-leN(t usb.controlR1RtDESC_TYPE_STRINGtlentAssertionErrorttostringtdecode(tdevtlengthtindextlangidR1tbuf((s,/usr/lib/python2.7/site-packages/usb/util.pyt get_strings     ii i@i`(*t__doc__t __author__Rt usb._interopRtDESC_TYPE_DEVICEtDESC_TYPE_CONFIGR3tDESC_TYPE_INTERFACEtDESC_TYPE_ENDPOINTt ENDPOINT_INt ENDPOINT_OUTtENDPOINT_TYPE_CTRLtENDPOINT_TYPE_ISOtENDPOINT_TYPE_BULKtENDPOINT_TYPE_INTRtCTRL_TYPE_STANDARDtCTRL_TYPE_CLASStCTRL_TYPE_VENDORtCTRL_TYPE_RESERVEDtCTRL_RECIPIENT_DEVICEtCTRL_RECIPIENT_INTERFACEtCTRL_RECIPIENT_ENDPOINTtCTRL_RECIPIENT_OTHERtCTRL_OUTtCTRL_INRRRRRRRR RtFalseRR'R,R.R0R=(((s,/usr/lib/python2.7/site-packages/usb/util.pyt+sL   (