Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 14 Jan 2007 21:08:30 +0100 (CET)
From:      Julian Stacey <jhs@berklix.org>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        Bernd Walter <ticso@cicely12.cicely.de>, Julian Stacey <jhs@berklix.com>, Atom Smasher <atom@smasher.org>
Subject:   usb/107924: usbd does not call detach
Message-ID:  <200701142008.l0EK8U7c048974@fire.jhs.private>
Resent-Message-ID: <200701142010.l0EKAGqG062355@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         107924
>Category:       usb
>Synopsis:       usbd does not call detach
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-usb
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jan 14 20:10:15 GMT 2007
>Closed-Date:
>Last-Modified:
>Originator:     Julian Stacey <jhs@berklix.com>
>Release:        FreeBSD 6.2-RELEASE i386
>Organization:
hrrp://berklix.com
>Environment:
System: FreeBSD fire.jhs.private 6.2-RELEASE FreeBSD 6.2-RELEASE #0: Mon Dec 11 15:29:22 CET 2006 jhs@fire.jhs.private:/usr2/release/6.1-RELEASE/src/sys/i386/compile/FIRE32.small i386


	
>Description:
usbd does not call detach

>How-To-Repeat:
	
	Atom Smasher <atom @ smasher.org> reported it.
	Julian Stacey <jhs @ berklix.com> verified it in practice
	& read the code to verify it doesnt get called, 
	commented in patch below
	Bernd Walter <ticso @ cicely12.cicely.de> wrote:
		usbd is depricated, use devd instead.
>Fix:

Apply patch created bt diff -c
storedd in http://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 <atom@smasher.org> 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);

>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200701142008.l0EK8U7c048974>