Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 364370
b: refs/heads/master
c: 3edce1c
h: refs/heads/master
v: v3
  • Loading branch information
Bjørn Mork authored and Greg Kroah-Hartman committed Mar 25, 2013
1 parent 7da7835 commit 0fc7bf8
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 769d7368b1727b1b5369d88badf0cbdf0163e079
refs/heads/master: 3edce1cf813aa6a087df7730cec0e67d57288300
1 change: 1 addition & 0 deletions trunk/Documentation/ioctl/ioctl-number.txt
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ Code Seq#(hex) Include File Comments
'H' 40-4F sound/hdspm.h conflict!
'H' 40-4F sound/hdsp.h conflict!
'H' 90 sound/usb/usx2y/usb_stream.h
'H' A0 uapi/linux/usb/cdc-wdm.h
'H' C0-F0 net/bluetooth/hci.h conflict!
'H' C0-DF net/bluetooth/hidp/hidp.h conflict!
'H' C0-DF net/bluetooth/cmtp/cmtp.h conflict!
Expand Down
19 changes: 19 additions & 0 deletions trunk/drivers/usb/class/cdc-wdm.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*/
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/ioctl.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/mutex.h>
Expand Down Expand Up @@ -644,6 +645,22 @@ static int wdm_release(struct inode *inode, struct file *file)
return 0;
}

static long wdm_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
struct wdm_device *desc = file->private_data;
int rv = 0;

switch (cmd) {
case IOCTL_WDM_MAX_COMMAND:
if (copy_to_user((void __user *)arg, &desc->wMaxCommand, sizeof(desc->wMaxCommand)))
rv = -EFAULT;
break;
default:
rv = -ENOTTY;
}
return rv;
}

static const struct file_operations wdm_fops = {
.owner = THIS_MODULE,
.read = wdm_read,
Expand All @@ -652,6 +669,8 @@ static const struct file_operations wdm_fops = {
.flush = wdm_flush,
.release = wdm_release,
.poll = wdm_poll,
.unlocked_ioctl = wdm_ioctl,
.compat_ioctl = wdm_ioctl,
.llseek = noop_llseek,
};

Expand Down
2 changes: 2 additions & 0 deletions trunk/include/linux/usb/cdc-wdm.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#ifndef __LINUX_USB_CDC_WDM_H
#define __LINUX_USB_CDC_WDM_H

#include <uapi/linux/usb/cdc-wdm.h>

extern struct usb_driver *usb_cdc_wdm_register(struct usb_interface *intf,
struct usb_endpoint_descriptor *ep,
int bufsize,
Expand Down
21 changes: 21 additions & 0 deletions trunk/include/uapi/linux/usb/cdc-wdm.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* USB CDC Device Management userspace API definitions
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* version 2 as published by the Free Software Foundation.
*/

#ifndef _UAPI__LINUX_USB_CDC_WDM_H
#define _UAPI__LINUX_USB_CDC_WDM_H

/*
* This IOCTL is used to retrieve the wMaxCommand for the device,
* defining the message limit for both reading and writing.
*
* For CDC WDM functions this will be the wMaxCommand field of the
* Device Management Functional Descriptor.
*/
#define IOCTL_WDM_MAX_COMMAND _IOR('H', 0xA0, __u16)

#endif /* _UAPI__LINUX_USB_CDC_WDM_H */

0 comments on commit 0fc7bf8

Please sign in to comment.