|
From: Cheng J. <che...@fa...> - 2006-06-06 00:39:45
|
Hi, I am working on a driver for an ethernet bypass unit under FreeBSD. The current code mostly works except under one scenario. It is unable to detect the event that the bypass unit has been unplugged from the USB port. I don't have a good handle on this problem to give a very good description. The following is what i notice. 1. while the software driver is running, if i unplug the device and plug it back in, the device would not resume normal operation (i suppose this is ok). However, even if i kill the program and restart, the program cannot open the device (when i turned debug on, libusb debug message says /dev/ugen0 busy sometimes, and /dev/ugen0 not configured at other times) i have to plug the bypass unit into another usb port for it to work. I have managed to crash the freebsd kernel by doing this repeatedly so the FreeBSD kernel has issues. 2. usb_bulk_write doesn't return any errors when the device isn't present, which seems strange. 3. i have tried to scan the bus/device using usb_find_busses and usb_find_devices hoping that if the device is not present, i can assume that it has been unplugged. however, this doesn't seem to work because once the device is usb_open'd, it becomes invisible to the usb_find routines. Maybe i did something wrong, but i am not sure what. 4. i tried disable freebsd's usbd, and that didnt help. comments would be greatly appreciated! Cheng |