xref: /haiku/src/libs/compat/freebsd_network/usb_util.c (revision 52f7c9389475e19fc21487b38064b4390eeb6fea)
1 /*
2  * Copyright 2022, Haiku, Inc. All rights reserved.
3  * Distributed under the terms of the MIT license.
4  */
5 
6 #include <sys/cdefs.h>
7 #include <sys/callout.h>
8 #include <sys/bus.h>
9 
10 #include <dev/usb/usb.h>
11 #include <dev/usb/usbdi.h>
12 
13 
14 /** device_set_usb_desc
15  * This function can be called at probe or attach to set the USB
16  * device supplied textual description for the given device. */
17 void
18 device_set_usb_desc(device_t dev)
19 {
20 	struct usb_attach_arg *uaa;
21 	struct usb_device *udev;
22 	struct usb_interface *iface;
23 	usb_error_t err;
24 
25 	if (dev == NULL) {
26 		/* should not happen */
27 		return;
28 	}
29 	uaa = device_get_ivars(dev);
30 	if (uaa == NULL) {
31 		/* can happen if called at the wrong time */
32 		return;
33 	}
34 	udev = uaa->device;
35 	iface = uaa->iface;
36 
37 	if ((iface == NULL)) {
38 		err = USB_ERR_INVAL;
39 	} else {
40 		err = 0;
41 	}
42 
43 	/* TODO */
44 }
45