Application not notified when usb device disconnected in linux 2.4.21
by ColdElectron from LinuxQuestions.org on (#6CA3C)
I'm supporting an old linux system running on 2.4.21 and I'm trying to get "hotplug" support working on a usb power sensor.
Right now the application is using "select" to determine when there is a read or write operation available in the device file. I would like to have a way to notify the application when the usb device is disconnected, so that it can close the file and attempt to open a new one with whatever new device appears. This should be the same device, which occasionally reboots. Right now what happens is that since it hasn't released the minor number for that device we create a new device node when I unplug and plug the device back in:
Before Removal:
/dev/usb/nrpz-0
After removal and reinsertion:
/dev/usb/nrpz-1
Is there a way to signal to an application that a USB device has disconnected on these old linux distributions?
Right now the application is using "select" to determine when there is a read or write operation available in the device file. I would like to have a way to notify the application when the usb device is disconnected, so that it can close the file and attempt to open a new one with whatever new device appears. This should be the same device, which occasionally reboots. Right now what happens is that since it hasn't released the minor number for that device we create a new device node when I unplug and plug the device back in:
Before Removal:
/dev/usb/nrpz-0
After removal and reinsertion:
/dev/usb/nrpz-1
Is there a way to signal to an application that a USB device has disconnected on these old linux distributions?