From jhs @ *.berklix.net Sun Jan 14 21:09:09 2007 Date: Sun, 14 Jan 2007 21:08:30 +0100 (CET) Message-Id: <200701142008.l0EK8U7c048974 @ fire> To: FreeBSD-gnats-submit @ freebsd.org Subject: usbd does not call detach From: Julian H. Stacey cc: Atom Smasher , Julian H. Stacey , Bernd Walter Reply-To: Julian H. Stacey X-send-pr-version: 3.113 X-GNATS-Notify: >Submitter-Id: current-users >Originator: Julian H. Stacey >Organization: hrrp://www.berklix.com >Confidential: no >Synopsis: usbd does not call detach >Severity: serious >Priority: medium >Category: usb >Class: change-request >Release: FreeBSD 6.2-RELEASE i386 >Environment: System: FreeBSD fire 6.2-RELEASE FreeBSD 6.2-RELEASE #0: Mon Dec 11 15:29:22 CET 2006 jhs @ fire:/usr2/release/6.1-RELEASE/src/sys/i386/compile/FIRE32.small i386 >Description: usbd does not call detach >How-To-Repeat: Atom Smasher reported it. Julian H. Stacey verified it in practice & read the code to verify it doesnt get called, commented in patch below Bernd Walter wrote: usbd is depricated, use devd instead. >Fix: Apply patch created bt diff -c storedd in http://www.berklix.com/~jhs/src/bsd/fixes/FreeBSD/src/gen/usr.sbin/usbd/ to document the deficiency & work round. *** usbd.8.o Sun Jan 14 20:48:31 2007 --- usbd.8 Sun Jan 14 20:52:06 2007 *************** *** 130,138 **** --- 130,141 ---- .It Pa /dev/usb1 .It etc . .El + .Sh BUGS + Detach does not work. Use Devd if you need to call a script on detach. .Sh SEE ALSO .Xr usb 4 , .Xr usbd.conf 5 + .Xr devd 8 .Sh HISTORY The .Nm The error is still there in 6-Stable too. There is no src/usr.sbin/usbd/usbd.c in current. I don't know the code, & too tired & busy to fix this, Someone else here able to fix it & post a patch ? If not, Atom Smasher please use dmesg send-pr to report this identified bug. *** 6.1-RELEASE/src/usr.sbin/usbd/usbd.c Fri Jul 1 17:49:52 2005 --- new-generic/src/usr.sbin/usbd/usbd.c Wed Jan 10 01:54:54 2007 *************** *** 879,886 **** --- 879,891 ---- devinfo = &events.u.ue_device; for (i = 0; i < USB_MAX_DEVNAMES; i++) { + printf(" \nJHS1\n" ); if (devinfo->udi_devnames[i][0] == '\0') break; + /* This break is a problem it prevents + USB_EVENT_IS_DETACH being run at JHS3 + */ + printf(" \nJHS2\n" ); memcpy(&the_event, &events, sizeof(the_event)); the_devinfo = &the_event.u.ue_device; *************** *** 925,930 **** --- 930,936 ---- if (USB_EVENT_IS_ATTACH(the_event.ue_type) && action_match.action->attach) execute_command(action_match.action->attach); + printf(" \nJHS3\n" ); if (USB_EVENT_IS_DETACH(the_event.ue_type) && action_match.action->detach) execute_command(action_match.action->detach); -------- Subject: Re: usb/107924: usbd does not call detach From: FreeBSD-gnats-submit @ FreeBSD.org Date: Sun, 14 Jan 2007 20:10:15 GMT (21:10 CET) To: Julian H. Stacey Thank you very much for your problem report. It has the internal identification `usb/107924'. The individual assigned to look at your report is: freebsd-usb. You can access the state of your problem report at any time via this link: http://www.freebsd.org/cgi/query-pr.cgi?pr=107924 >Category: usb >Responsible: freebsd-usb >Synopsis: usbd does not call detach >Arrival-Date: Sun Jan 14 20:10:15 GMT 2007