USB bug fix for DETACH message.
Matthew Dillon
dillon at apollo.backplane.com
Thu Mar 18 21:29:26 PST 2004
A DragonFly user noticed that usbd does not seem to get DETACH events
for UMASS devices.
I tracked this down (in the FreeBSD-5 codebase for your convenience)
to line 1382 of usb_subr.c:
/*usbd_add_dev_event(USB_EVENT_DEVICE_DETACH, dev);*/
This line was apparently commented out by wpaul in rev 1.22, in
January 2000.
NetBSD has this line uncommented... that is, activated, and they
recently committed a bug fix (1.110 I believe in the NetBSD source
tree) that solves the problem I'm sure wpaul encountered that caused
him to comment the line out. The bug fix is trivial. Just above this
code, around line 1378, you simply need to NULL out dev->subdevs[i]
after detaching it:
printf(" port %d", up->portno);
printf(" (addr %d) disconnected\n", dev->address);
config_detach(dev->subdevs[i], DETACH_FORCE);
dev->subdevs[i] = NULL; <<<<<<<<<<<<<<<<<< ADDME
If you want DETACH events to work, uncomment the add_dev_event and
make the bug fix above and DETACH events will work again. If you are
going to do this, please do this in both FreeBSD-5.x and FreeBSD-4.x.
You may also wish to commit NetBSD's 1.111 of sub_subr.c, which reorders
an address assignment to work around certain non-compliant USB devices
and allow them to work. The NetBSD repository can be accessed via
CVS using the server string ':pserver:anoncvs at anoncvs.netbsd.org:/cvsroot'
(don't accidently overwrite your FBsd tree, though! :-)).
-Matt
More information about the freebsd-stable
mailing list