def read(self):
readCmd = [0xD2, 0x0E, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x48, 0x49, 0x44,
0x43, 0x80, 0x02, 0x00, 0x00, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,
0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,
0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,
0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC]
readCmd_pack = self.pack_bytes(readCmd)
# assert len(self.hid.write(self.ep_out_address, readCmd_pack, 100)) == len(readCmd_pack)
self.hid.write(self.ep_out_address, readCmd_pack, 100)
data_pack = self.hid.read(self.ep_in_address, self.packet_len, 100)
np_arr8 = numpy.uint8([data_pack[2], data_pack[3]])
arr16 = np_arr8.view('uint16')
mask = arr16[0]
return mask
评论列表
文章目录