python-dfu icon indicating copy to clipboard operation
python-dfu copied to clipboard

can i reset from dfu mode to normal

Open premananda8 opened this issue 5 years ago • 5 comments

please help me on reset device from dfu mode to normal. i have device object need to reset. i did like this: dfu_device = dfu.DFU(device.open()) dfu_device._reset("Changed to normal")

but i'm getting error as: usb1.USBErrorNotSupported: LIBUSB_ERROR_NOT_SUPPORTED [-12]

premananda8 avatar Feb 10 '20 04:02 premananda8

Hello,

This means libusb_reset_device does not work for some reason. This may depend on what the HCI driver supports (so it may depend on the OS, and possibly on the type of HCI).

As this is a USB-level operation (and not a DFU-level operation), this should be no different from unplugging the device and replugging it: besides receiving bus power, a device get signaled an USB reset condition before being enumerated (added to the USB bus so it can be used by the host), which is what this function also does.

vpelletier avatar Feb 14 '20 22:02 vpelletier

thanks for reply. please check this,

with usb1.USBContext() as context:
    for device in context.getDeviceList():
        if (int(0xX) == device.getVendorID() and   (int(0xFFFF) == device.getProductID())):
               print(device)  #Here i'm getting device without serial number
               print(device.getSerialNumber())  #Here i'm getting error as usb1.USBErrorNotSupported: LIBUSB_ERROR_NOT_SUPPORTED [-12] 

anything wrong in my code if not why not getting serial number. please help me i'm unable to proceed further.

premananda8 avatar Feb 17 '20 05:02 premananda8

This would be a libusb error, and not really related to DFU nor this project. The reason for this error may depend on what the OS is, or on what the device firmware is responding (maybe it does not have a serial ?).

You will need to check what is being exchanged with the device. There are free usb capture software tools which should be able to get that for you at least on Windows and GNU/Linux (wireshark).

vpelletier avatar Feb 18 '20 01:02 vpelletier

code is not supporting to python version 3.7?

premananda8 avatar May 05 '20 14:05 premananda8

STM32 device in dfu mode can i detect serial_number any code is there any library in python present, i am hopeless to proceed, please help.(from this code i need serial number) with usb1.USBContext() as context: for device in context.getDeviceList(): if (int(0xX) == device.getVendorID() and (int(0xFFFF) == device.getProductID())): print(device) #Here i'm getting device without serial number print(device.getSerialNumber()) #Here i'm getting error as usb1.USBErrorNotSupported: LIBUSB_ERROR_NOT_SUPPORTED [-12]

premananda8 avatar May 05 '20 20:05 premananda8