Author Topic: Closing a HID handle for booloader  (Read 13470 times)

arador

  • Member
  • ***
  • Posts: 3
Closing a HID handle for booloader
« on: October 23, 2014, 03:08:46 am »
Hi,
Using a HID host application (based on generic_hid_cs_46) I connect to my device with a certain VID/PID, then I send a  message to the device to switch to bootloader mode, and then need to re-connect the device with new VID/PID.
I get "Device not connected" when trying the connect with the second VID/PID.
Is there a function that completely shuts down the previous HID handle?

Thanks

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Closing a HID handle for booloader
« Reply #1 on: October 23, 2014, 03:10:14 pm »
Did you physically detach and reattach the device or emulate it by disconnecting/reconnecting the pull-up/pull-down to cause the host to re-enumerate the device with the new VID and PID?

arador

  • Member
  • ***
  • Posts: 3
Re: Closing a HID handle for booloader
« Reply #2 on: October 27, 2014, 05:53:13 am »
Sorry for the late reply.

I did not physically detach and reattach.
The idea is to implement a bootloadable device via usb (without a programmer):
The device enumerates with a VID/PID as a measurement device. When its firmware needs to be upgraded, the host application sends a message to the device which "tells" the device to run a bootloader firmware, and at that stage the host should close the connection with the original VID/PID, and initiate a new connection with the bootloader with a new VID/PID in order to transfer the upgraded firmware.
At the end of the upgrade process, the device resets itself and boots as the measurement device (original VID/PID again). The host should again disconnect from the device (as a bootloader) and reconnect with the original VID/PID.
The whole process is done without touching the USB cable.

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Closing a HID handle for booloader
« Reply #3 on: October 27, 2014, 10:07:22 am »
Thus you need to emulate detach/reattach by electronically switching the pull-up/pull-down on D+ or D- out and back in. That tells the host there is a device that may have a different VID/PID attached.