From f78fa6b67e0250ab3f642d568b8eeafddd7cb188 Mon Sep 17 00:00:00 2001 From: Andrew Thompson Date: Tue, 24 Feb 2009 03:43:05 +0000 Subject: MFp4 //depot/projects/usb@157974 Add support for setting and getting the USB template value through libusb20 and usbconfig. Submitted by: Hans Petter Selasky --- sys/dev/usb/usb_dev.c | 9 +++++++++ sys/dev/usb/usb_device.h | 4 ++++ sys/dev/usb/usb_ioctl.h | 2 ++ 3 files changed, 15 insertions(+) (limited to 'sys/dev') diff --git a/sys/dev/usb/usb_dev.c b/sys/dev/usb/usb_dev.c index f8e2c96fa349..8df78d236a73 100644 --- a/sys/dev/usb/usb_dev.c +++ b/sys/dev/usb/usb_dev.c @@ -1377,6 +1377,15 @@ usb2_ioctl(struct cdev *dev, u_long cmd, caddr_t data, case USB_DEV_QUIRK_REMOVE: err = usb2_quirk_ioctl_p(cmd, data, fflag, td); break; + case USB_GET_TEMPLATE: + *(int *)data = usb2_template; + break; + case USB_SET_TEMPLATE: + err = priv_check(curthread, PRIV_ROOT); + if (err) + break; + usb2_template = *(int *)data; + break; default: err = ENOTTY; break; diff --git a/sys/dev/usb/usb_device.h b/sys/dev/usb/usb_device.h index e20479d99cfa..4c296d456725 100644 --- a/sys/dev/usb/usb_device.h +++ b/sys/dev/usb/usb_device.h @@ -155,6 +155,10 @@ struct usb2_device { char product[64]; /* product string */ }; +/* globals */ + +extern int usb2_template; + /* function prototypes */ struct usb2_device *usb2_alloc_device(device_t parent_dev, struct usb2_bus *bus, diff --git a/sys/dev/usb/usb_ioctl.h b/sys/dev/usb/usb_ioctl.h index 27e4beaac031..73f77964e110 100644 --- a/sys/dev/usb/usb_ioctl.h +++ b/sys/dev/usb/usb_ioctl.h @@ -267,6 +267,8 @@ struct usb2_gen_quirk { #define USB_SET_PORT_DISABLE _IOW ('U', 144, int) #define USB_SET_POWER_MODE _IOW ('U', 145, int) #define USB_GET_POWER_MODE _IOR ('U', 146, int) +#define USB_SET_TEMPLATE _IOW ('U', 147, int) +#define USB_GET_TEMPLATE _IOR ('U', 148, int) /* Modem device */ #define USB_GET_CM_OVER_DATA _IOR ('U', 180, int) -- cgit v1.2.3