在Debian上使用PyUSB从Nike + Sportband中提取数据

时间:2018-05-01 13:38:23

标签: python reverse-engineering pyusb

我有一个旧的Nike + Sportband(image here)。耐克决定取消对该产品的支持。我想提取数据然后解码它。有人在C中编写了一个有效的代码(link download)。我想用Python做,所以我决定使用 PyUSB

代码

import sys
import usb.core
import usb.util

VENDOR_ID = 0x11ac
PRODUCT_ID = 0x4269

device = usb.core.find(idVendor=VENDOR_ID, idProduct=PRODUCT_ID)

print device

if device is None:
    sys.exit("Device not found.")

if device.is_kernel_driver_active(0):
    try:
        device.detach_kernel_driver(0)
        print('Kernel driver detatched.\n')
    except usb.core.USBError as e:
        sys.exit("Could not detatch kernel driver: %s" % str(e))

try:
    device.set_configuration()
    #device.reset()
    print('Configuration Ok')
except usb.core.USBError as e:
    sys.exit("Could not set configuration: %s" % str(e))


# read a data packet
data = device.read(0x81,8,10000)

print data

我总是收到这个错误:

usb.core.USBError: [Errno 110] Operation timed out

有什么建议吗?

0 个答案:

没有答案