Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 185337
b: refs/heads/master
c: cc175ce
h: refs/heads/master
i:
  185335: f61b66f
v: v3
  • Loading branch information
Gernot Hillier authored and Greg Kroah-Hartman committed Mar 2, 2010
1 parent daa5584 commit 5d349a1
Show file tree
Hide file tree
Showing 2 changed files with 41 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: 79da01d79e0f2c8d2d6f1b823fce429877c423a7
refs/heads/master: cc175ce2c01fc78dbf98a2b00f23d8863de20764
40 changes: 40 additions & 0 deletions trunk/drivers/usb/serial/option.c
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,19 @@ static int option_resume(struct usb_serial *serial);
#define HAIER_VENDOR_ID 0x201e
#define HAIER_PRODUCT_CE100 0x2009

/* some devices interfaces need special handling due to a number of reasons */
enum option_blacklist_reason {
OPTION_BLACKLIST_NONE = 0,
OPTION_BLACKLIST_SENDSETUP = 1,
OPTION_BLACKLIST_RESERVED_IF = 2
};

struct option_blacklist_info {
const u32 infolen; /* number of interface numbers on blacklist */
const u8 *ifaceinfo; /* pointer to the array holding the numbers */
enum option_blacklist_reason reason;
};

static const struct usb_device_id option_ids[] = {
{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },
{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) },
Expand Down Expand Up @@ -711,6 +724,7 @@ struct option_intf_private {
spinlock_t susp_lock;
unsigned int suspended:1;
int in_flight;
struct option_blacklist_info *blacklist_info;
};

struct option_port_private {
Expand Down Expand Up @@ -780,9 +794,27 @@ static int option_probe(struct usb_serial *serial,
if (!data)
return -ENOMEM;
spin_lock_init(&data->susp_lock);
data->blacklist_info = (struct option_blacklist_info*) id->driver_info;
return 0;
}

static enum option_blacklist_reason is_blacklisted(const u8 ifnum,
const struct option_blacklist_info *blacklist)
{
const u8 *info;
int i;

if (blacklist) {
info = blacklist->ifaceinfo;

for (i = 0; i < blacklist->infolen; i++) {
if (info[i] == ifnum)
return blacklist->reason;
}
}
return OPTION_BLACKLIST_NONE;
}

static void option_set_termios(struct tty_struct *tty,
struct usb_serial_port *port, struct ktermios *old_termios)
{
Expand Down Expand Up @@ -1213,11 +1245,19 @@ static void option_setup_urbs(struct usb_serial *serial)
static int option_send_setup(struct usb_serial_port *port)
{
struct usb_serial *serial = port->serial;
struct option_intf_private *intfdata =
(struct option_intf_private *) serial->private;
struct option_port_private *portdata;
int ifNum = serial->interface->cur_altsetting->desc.bInterfaceNumber;
int val = 0;
dbg("%s", __func__);

if (is_blacklisted(ifNum, intfdata->blacklist_info) ==
OPTION_BLACKLIST_SENDSETUP) {
dbg("No send_setup on blacklisted interface #%d\n", ifNum);
return -EIO;
}

portdata = usb_get_serial_port_data(port);

if (portdata->dtr_state)
Expand Down

0 comments on commit 5d349a1

Please sign in to comment.