Date: Mon, 13 Jun 2005 10:32:12 +0200 From: "Norbert Koch" <NKoch@demig.de> To: <freebsd-hackers@freebsd.org> Subject: RE: usbd.conf: detach ukbd Message-ID: <000001c56ff2$65b5a8e0$4801a8c0@ws-ew-3.W2KDEMIG> In-Reply-To: <001701c56d83$aada3e20$4801a8c0@ws-ew-3.W2KDEMIG>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --]
> > 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.
Ok, that seems to work with a minor change [no strlcpy]
and two additional patches in usb.h & usb.c.
Usbd gets a detach event "ukbd0" and another event from its fallthrough
device.
Thank you once again.
If someone is interested in the patch files against 4.11 see the attachment.
Norbert
[-- Attachment #2 --]
--- /usr/local/jail/usr/src/sys/dev/usb/ukbd.c Mon Mar 1 21:56:02 2004
+++ ukbd.c Fri Jun 10 14:34:05 2005
@@ -195,6 +195,22 @@
USB_ATTACH_SUCCESS_RETURN;
}
+
+static void
+usbd_add_device_detach_event(device_t self)
+{
+ struct usb_event ue;
+
+ bzero(&ue, sizeof(ue));
+
+ strncpy(ue.u.ue_device.udi_devnames[0],
+ device_get_nameunit(self), USB_MAX_DEVNAMELEN);
+ ue.u.ue_device.udi_devnames[0][USB_MAX_DEVNAMELEN - 1] = '\0';
+
+ usb_add_event(USB_EVENT_DEVICE_DETACH, &ue);
+}
+
+
int
ukbd_detach(device_t self)
{
@@ -219,6 +235,8 @@
return error;
DPRINTF(("%s: disconnected\n", USBDEVNAME(self)));
+
+ usbd_add_device_detach_event(self);
return (0);
}
[-- Attachment #3 --]
--- /usr/local/jail/usr/src/sys/dev/usb/usb.c Mon May 16 11:39:25 2005
+++ usb.c Fri Jun 10 14:53:21 2005
@@ -193,8 +193,6 @@
Static struct selinfo usb_selevent;
Static struct proc *usb_async_proc; /* process that wants USB SIGIO */
Static int usb_dev_open = 0;
-Static void usb_add_event(int, struct usb_event *);
-
Static int usb_get_next_event(struct usb_event *);
Static const char *usbrev_str[] = USBREV_STR;
[-- Attachment #4 --]
--- /usr/local/jail/usr/src/sys/dev/usb/usb.h Mon Mar 1 01:07:22 2004
+++ usb.h Fri Jun 10 14:54:41 2005
@@ -655,6 +655,10 @@
} u;
};
+#if defined(_KERNEL)
+void usb_add_event(int, struct usb_event *);
+#endif /* _KERNEL */
+
/* USB controller */
#define USB_REQUEST _IOWR('U', 1, struct usb_ctl_request)
#define USB_SETDEBUG _IOW ('U', 2, int)
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?000001c56ff2$65b5a8e0$4801a8c0>
