Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 10 Jun 2005 08:14:32 +0200
From:      "Norbert Koch" <NKoch@demig.de>
To:        <hselasky@c2i.net>, <freebsd-hackers@freebsd.org>
Subject:   RE: usbd.conf: detach ukbd
Message-ID:  <001701c56d83$aada3e20$4801a8c0@ws-ew-3.W2KDEMIG>
In-Reply-To: <200506092224.50203.hselasky@c2i.net>

next in thread | previous in thread | raw e-mail | index | archive | help
> 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"
> 

But from what I see, when running usbd, the class and
subclass keys of the cherry keyboard, I am testing with,
are both zero at attach and detach. So, one idea would be
to rewrite usbd.conf in the attach script. Usbd
- as it is now - does only setenv ("DEVNAME"), but it
would be trivial to add e.g. setenv ("VENDOR") and
setenv ("PRODUCTID").


> 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
> 

Hmm, may be I'll try this.
Thank you very much.

Norbert



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?001701c56d83$aada3e20$4801a8c0>