def __init__(self, vid, pid, iface=0, timeout=500): ''' @type vid: string @param vid: Vendor ID of device in hex @type pid: string @param pid: Product ID of device in hex @type iface: number @param iface: Device Interface to use @type timeout: number @param timeout: number of usecs to wait for reply ''' BulkPipe.__init__(self, vid, pid, iface, timeout)
def __init__(self, vid, pid, iface = 0, timeout = 500): ''' @type vid: string @param vid: Vendor ID of device in hex @type pid: string @param pid: Product ID of device in hex @type iface: number @param iface: Device Interface to use @type timeout: number @param timeout: number of usecs to wait for reply ''' BulkPipe.__init__(self, vid, pid, iface, timeout)
def is_alive(self): if not BulkPipe.is_alive(self): return False self.send(str(CCID(bSeq=self.next_seq())/PC_to_RDR_XfrBlock()/APDU())) data = self.receive(100) if len(data) < 1: print "Device not responding!" return False reply = CCID(data) if reply.bSeq != self._seq: print "Sequence number mismatch %u != %u!" % (reply.bSeq, self._seq) return False if RDR_to_PC_DataBlock in reply or RDR_to_PC_SlotStatus in reply: return True print "Failed is_alive() test!" reply.show2() if Raw in reply: print self.hex_dump(str(reply[Raw])) return False
def __init__(self, vid, pid, iface=0, wait=1, timeout=500): ''' @type vid: string @param vid: Vendor ID of device in hex @type pid: string @param pid: Product ID of device in hex @type iface: number @param iface: Device Interface to use @type timeout: wait @param timeout: number of usecs to wait before asking for reply @type timeout: number @param timeout: number of usecs to wait for reply to arrive ''' BulkPipe.__init__(self, vid, pid, iface, timeout) self._wait = int(wait) self._session = 0
def __init__(self, vid, pid, iface = 0, wait = 1, timeout = 500): ''' @type vid: string @param vid: Vendor ID of device in hex @type pid: string @param pid: Product ID of device in hex @type iface: number @param iface: Device Interface to use @type timeout: wait @param timeout: number of usecs to wait before asking for reply @type timeout: number @param timeout: number of usecs to wait for reply to arrive ''' BulkPipe.__init__(self, vid, pid, iface, timeout) self._wait = int(wait) self._session = 0
def is_alive(self): if not BulkPipe.is_alive(self): return False try: self.send(MSCCBW(ReqTag=self.next_tag())/Read10()) reply = self.read_reply() except USBException as e: print "%s in BOMSC.is_alive()!" % e return False return self.check_status(reply)
def is_alive(self): if not BulkPipe.is_alive(self): return False try: self.send(MSCCBW(ReqTag=self.next_tag()) / Read10()) reply = self.read_reply() except USBException as e: print "%s in BOMSC.is_alive()!" % e return False return self.check_status(reply)
def is_alive(self): if not BulkPipe.is_alive(self): return False try: self.send(Container()/Operation(OpCode=OpCodes["Skip"], TransactionID=0xdeadbeef)) response = self.read_response(0xdeadbeef) except USBException as e: print "%s in MTP.is_alive()!" % e return False if len(response) == 0: print "Device not responding in MTP.is_alive()!" return False return True
def is_alive(self): if not BulkPipe.is_alive(self): return False try: self.send( Container() / Operation(OpCode=OpCodes["Skip"], TransactionID=0xdeadbeef)) response = self.read_response(0xdeadbeef) except USBException as e: print "%s in MTP.is_alive()!" % e return False if len(response) == 0: print "Device not responding in MTP.is_alive()!" return False return True
def is_alive(self): if not BulkPipe.is_alive(self): return False self.send(QCDMFrame()/Command(code=0)) res = self.receive_response() if QCDMFrame not in res: print "Device not responding to DIAG commands!" print self.hex_dump(str(res)) return False if ord(str(res.payload)[0]) == 0: return True print "Device responed in an unexpected way!" print self.hex_dump(str(res.payload)) return False
def is_alive(self): if not BulkPipe.is_alive(self): return False self.send(QCDMFrame() / Command(code=0)) res = self.receive_response() if QCDMFrame not in res: print "Device not responding to DIAG commands!" print self.hex_dump(str(res)) return False if ord(str(res.payload)[0]) == 0: return True print "Device responed in an unexpected way!" print self.hex_dump(str(res.payload)) return False
def reset(self): self.boms_reset() BulkPipe.reset(self)