From owner-freebsd-usb@FreeBSD.ORG Wed Jan 10 01:12:07 2007 Return-Path: X-Original-To: freebsd-usb@freebsd.org Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B99DC16A412 for ; Wed, 10 Jan 2007 01:12:07 +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 6238E13C44B for ; Wed, 10 Jan 2007 01:12:06 +0000 (UTC) (envelope-from jhs@flat.berklix.net) Received: from js.berklix.net (p549A52A1.dip.t-dialin.net [84.154.82.161]) (authenticated bits=128) by thin.berklix.org (8.12.11/8.12.11) with ESMTP id l0A1C3nA040742; Wed, 10 Jan 2007 02:12:04 +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 l0A1C2gB025880; Wed, 10 Jan 2007 02:12:02 +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 l0A1C2Qx046748; Wed, 10 Jan 2007 02:12:02 +0100 (CET) (envelope-from jhs@fire.jhs.private) Message-Id: <200701100112.l0A1C2Qx046748@fire.jhs.private> To: Atom Smasher From: "Julian Stacey" Organization: http://berklix.com BSD Unix C Net Consultancy, Munich/Muenchen User-agent: EXMH http://beedub.com/exmh/ on FreeBSD http://freebsd.org X-URL: http://berklix.com X-Fallback: jhs@mail.brierdr.com, jhs@freebsd.org, jhs@berklix.net In-reply-to: Your message of "Tue, 09 Jan 2007 18:04:47 EST." <20070109230449.56854.qmail@smasher.org> Date: Wed, 10 Jan 2007 02:12:02 +0100 Sender: jhs@flat.berklix.net Cc: freebsd-usb@freebsd.org Subject: Re: usb/107701: usbd ignores "detach" X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2007 01:12:07 -0000 Reposting here to restore cc: freebsd-usb@freebsd.org lost from To: "Julian H. Stacey" Cc: freebsd-gnats-submit@freebsd.org, bug-followup@freebsd.org Julian S. ------------------ Reference: > From: Atom Smasher > Date: Tue, 9 Jan 2007 18:04:47 -0500 (EST) > Message-id: <20070109230449.56854.qmail@smasher.org> Atom Smasher wrote: > On Tue, 9 Jan 2007, Julian H. Stacey wrote: > > > Did you try taking out devname from your entries, to quote a comment I > > added to my personal usbd.conf some time back: > > > > # - devname entries are mostly unused, as only reported on attach, > > # not detach, so detach fails to be called if devname is specified. > ================== > > i removed devname from one of the entries and restarted usbd. the detach > event is still silently ignored. > > here's the relevant section of my usbd.conf. note that it assumes that > "device speaker" is enabled in the kernel: > > <<<<<<<<<<<<<< > > device "CF card" > devname "umass[0-9]+" > attach "echo 'T90 L16 DA' > /dev/speaker" > detach "echo 'T90 L16 AD' > /dev/speaker" > > <<<<<<<<<<<<<< > > it should play two ascending tones when i insert a flash drive, and two > descending tones when i remove the flash drive. it only plays tones on > insertion. > > > -- > ...atom > > ________________________ > http://atom.smasher.org/ > 762A 3B98 A3C3 96C9 C6B7 582A B88D 52E4 D9F5 7808 > ------------------------------------------------- > > "TELEVISION IS DRUGS" > -- Bumper Sticker --------------- I can reproduce the error. Loads of people Should have stumbled on this. I've found the bug in the code. This diff just marks the bug. *** /host/fire/usr/src/usr.sbin/usbd/usbd.c Fri Jul 1 17:49:52 2005 --- 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); 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 send-pr to report this identified bug. -- Julian Stacey. BSD Unix C Net Consultancy, Munich/Muenchen http://berklix.com Mail Ascii, not HTML. Ihr Rauch = mein allergischer Kopfschmerz. http://berklix.org/free-software