From owner-freebsd-hackers@FreeBSD.ORG Thu Jun 9 20:24:01 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4313F16A41C for ; Thu, 9 Jun 2005 20:24:01 +0000 (GMT) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe07.swip.net [212.247.154.193]) by mx1.FreeBSD.org (Postfix) with ESMTP id C862543D1D for ; Thu, 9 Jun 2005 20:24:00 +0000 (GMT) (envelope-from hselasky@c2i.net) X-T2-Posting-ID: Y1QAsIk9O44SO+J/q9KNyQ== Received: from mp-217-206-17.daxnet.no ([193.217.206.17] verified) by mailfe07.swip.net (CommuniGate Pro SMTP 4.3.2) with ESMTP id 193820501; Thu, 09 Jun 2005 22:23:58 +0200 From: Hans Petter Selasky To: freebsd-hackers@freebsd.org Date: Thu, 9 Jun 2005 22:24:46 +0200 User-Agent: KMail/1.7 References: <000001c56cf8$fffeb920$4801a8c0@ws-ew-3.W2KDEMIG> <42A86529.5020103@savvis.net> In-Reply-To: <42A86529.5020103@savvis.net> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200506092224.50203.hselasky@c2i.net> Cc: Norbert Koch Subject: Re: usbd.conf: detach ukbd X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: hselasky@c2i.net List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Jun 2005 20:24:01 -0000 On Thursday 09 June 2005 17:50, Maksim Yevmenkin wrote: > Norbert, > > > when running usbd (under FreeBSD 4.11) with > > -dv switches I can see that a usb keyboard > > correctly attaches as ukbd0, > > but detaches as fall-through "USB device". > > does something like > > device "USB keyboard" > devname "ukbd[0-9]+" > attach "foo" > detach "bar" > I'm not sure if detach is supported like that, because the "ukbd" device name will not be passed to "usbd" during detach. Then one needs to match against the class/subclass of the USB-keyboard: device "USB keyboard" class 3 subclass 1 detach "xxxx ukbd0" Else if devd is not available on 4.11 you will have to change some code and compile a new kernel, from what I can see. To the file /sys/dev/usb/ukbd.c add this: static void usbd_add_device_detach_event(device_t self) { struct usb_event ue; bzero(&ue, sizeof(ue)); strlcpy(ue.u.ue_device.udi_devnames[0], device_get_nameunit(self), USB_MAX_DEVNAMELEN) ; usb_add_event(USB_EVENT_DEVICE_DETACH, &ue); return; } ukbd_detach() { ... usbd_add_device_detach_event(self); return (0); } This will make the suggestion from Maksim work. A generic solution would be to call "usbd_add_device_detach_event()" from the "bus_child_detached" method of uhub, which must be added. Also one can change "usb_disconnect_port()" to generate the event before the sub-devices are detached, but that might not work in all cases. --HPS