aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/usb
diff options
context:
space:
mode:
authorAndrew Thompson <thompsa@FreeBSD.org>2009-02-24 03:43:05 +0000
committerAndrew Thompson <thompsa@FreeBSD.org>2009-02-24 03:43:05 +0000
commitf78fa6b67e0250ab3f642d568b8eeafddd7cb188 (patch)
treef4792f6be15577c3da25ef086c5ab15d262ccb99 /sys/dev/usb
parente280503373883f7625ce6eb06e511c9174c1d7e0 (diff)
downloadsrc-f78fa6b67e0250ab3f642d568b8eeafddd7cb188.tar.gz
src-f78fa6b67e0250ab3f642d568b8eeafddd7cb188.zip
MFp4 //depot/projects/usb@157974
Add support for setting and getting the USB template value through libusb20 and usbconfig. Submitted by: Hans Petter Selasky
Notes
Notes: svn path=/head/; revision=188987
Diffstat (limited to 'sys/dev/usb')
-rw-r--r--sys/dev/usb/usb_dev.c9
-rw-r--r--sys/dev/usb/usb_device.h4
-rw-r--r--sys/dev/usb/usb_ioctl.h2
3 files changed, 15 insertions, 0 deletions
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)