handling physical disconnection and reconnection
Posted: Fri May 01, 2009 4:54 am
I've got a device on a battery, and I've finally managed to wrap my head around most of the custom class api.
Right now I'm trying to find any information on handling a physical disconnection from the usb port of a computer. Is there a way the device can know if it's plugged in? How can the device know when to call usb initialization functions? Is it possible to stop calling usbPoll when the device is not connected?
I was thinking I could trigger an interrupt on connection and disconnection and reinitialize and re-enumerate the device there, just like the samples for when the device is just turning on.
Is there a better way?
Thanks for any pointers,
Chris.
Right now I'm trying to find any information on handling a physical disconnection from the usb port of a computer. Is there a way the device can know if it's plugged in? How can the device know when to call usb initialization functions? Is it possible to stop calling usbPoll when the device is not connected?
I was thinking I could trigger an interrupt on connection and disconnection and reinitialize and re-enumerate the device there, just like the samples for when the device is just turning on.
Is there a better way?
Thanks for any pointers,
Chris.