From jhs@flat.berklix.net  Sun Jan 14 20:08:37 2007
Return-Path: <jhs@flat.berklix.net>
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id CA04E16A407
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 14 Jan 2007 20:08:37 +0000 (UTC)
	(envelope-from jhs@flat.berklix.net)
Received: from thin.berklix.org (thin.berklix.org [194.246.123.68])
	by mx1.freebsd.org (Postfix) with ESMTP id 58E3D13C45A
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 14 Jan 2007 20:08:36 +0000 (UTC)
	(envelope-from jhs@flat.berklix.net)
Received: from js.berklix.net (p549A5D5E.dip.t-dialin.net [84.154.93.94])
	(authenticated bits=128)
	by thin.berklix.org (8.12.11/8.12.11) with ESMTP id l0EK8Wfn057853;
	Sun, 14 Jan 2007 21:08:33 +0100 (CET)
	(envelope-from jhs@flat.berklix.net)
Received: from fire.jhs.private (fire.jhs.private [192.168.91.41])
	by js.berklix.net (8.13.6/8.13.6) with ESMTP id l0EK8UEt008360;
	Sun, 14 Jan 2007 21:08:31 +0100 (CET)
	(envelope-from jhs@flat.berklix.net)
Received: from fire.jhs.private (localhost.jhs.private [127.0.0.1])
	by fire.jhs.private (8.13.6/8.13.6) with ESMTP id l0EK8UDq048975;
	Sun, 14 Jan 2007 21:08:30 +0100 (CET)
	(envelope-from jhs@fire.jhs.private)
Received: (from jhs@localhost)
	by fire.jhs.private (8.13.6/8.13.6/Submit) id l0EK8U7c048974;
	Sun, 14 Jan 2007 21:08:30 +0100 (CET)
	(envelope-from jhs)
Message-Id: <200701142008.l0EK8U7c048974@fire.jhs.private>
Date: Sun, 14 Jan 2007 21:08:30 +0100 (CET)
From: Julian Stacey <jhs@berklix.org>
Reply-To: Julian Stacey <jhs@berklix.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc: Atom Smasher <atom@smasher.org>, Julian Stacey <jhs@berklix.com>,
        Bernd Walter <ticso@cicely12.cicely.de>
Subject: usbd does not call detach
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         107924
>Category:       docs
>Synopsis:       [usb67] usbd(8) does not call detach
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-doc
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jan 14 20:10:15 GMT 2007
>Closed-Date:    Sat Jul 10 10:41:26 UTC 2010
>Last-Modified:  Sat Jul 10 10:41:26 UTC 2010
>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:
Responsible-Changed-From-To: freebsd-usb->freebsd-docs 
Responsible-Changed-By: gavin 
Responsible-Changed-When: Sun Nov 8 16:11:48 UTC 2009 
Responsible-Changed-Why:  
This PR is actually only relevent for 6.x, as usbd was replaced in 7.x. 
Because of that, I can't see this problem being fixed in 6.x alone - 
so pass over to doc team to document as a bug instead. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=107924 
Responsible-Changed-From-To: freebsd-docs->freebsd-doc 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Sat Jan 30 22:27:05 UTC 2010 
Responsible-Changed-Why:  
Canonicalize assignment. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=107924 
State-Changed-From-To: open->closed 
State-Changed-By: bcr 
State-Changed-When: Sat Jul 10 10:39:38 UTC 2010 
State-Changed-Why:  
The USB code has been completely rewritten, making this PR not an issue 
anymore. Closed!  

http://www.freebsd.org/cgi/query-pr.cgi?pr=107924 
>Unformatted:
