예제 #1
0
 def control_transfer_in(self, cbk_fn, recipient, type_, request, value, index, length) -> ControlTransferResponse:
     if cbk_fn is None:
         run_until_done = RunUntilDone(1.0, 'control_transfer_in')
         self.control_transfer_in(run_until_done.cbk_fn, recipient, type_, request, value, index, length)
         while not run_until_done.is_done():
             self.process(0.01)
         return run_until_done.value_args0
     request_type = usb_core.RequestType(direction='in', type_=type_, recipient=recipient).u8
     setup_packet = usb_core.SetupPacket(request_type, request, value, index, length)
     return self._control_transfer.pend(cbk_fn, setup_packet, None)
예제 #2
0
 def control_transfer_out(self, cbk_fn, recipient, type_, request, value=0, index=0, data=None):
     if cbk_fn is None:
         run_until_done = RunUntilDone(1.0, 'control_transfer_out')
         self.control_transfer_out(run_until_done.cbk_fn, recipient, type_, request, value, index, data)
         while not run_until_done.is_done():
             self.process(0.01)
         return run_until_done.value_args0
     request_type = usb_core.RequestType(direction='out', type_=type_, recipient=recipient).u8
     length = 0 if data is None else len(data)
     setup_packet = usb_core.SetupPacket(request_type, request, value, index, length)
     return self._control_transfer.pend(cbk_fn, setup_packet, data)