Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 41237
b: refs/heads/master
c: 6d8fc4d
h: refs/heads/master
i:
  41235: 1a90b98
v: v3
  • Loading branch information
Alan Stern authored and Greg Kroah-Hartman committed Dec 1, 2006
1 parent 19b3ecb commit 0e2073e
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 88fafff9d73c0a506c0b08e7cd637c89d8b604e1
refs/heads/master: 6d8fc4d28deaf828606c19fb743fbe94aeab4caf
39 changes: 26 additions & 13 deletions trunk/drivers/usb/input/hid-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -968,20 +968,29 @@ static void hid_retry_timeout(unsigned long _hid)
hid_io_error(hid);
}

/* Workqueue routine to reset the device */
/* Workqueue routine to reset the device or clear a halt */
static void hid_reset(void *_hid)
{
struct hid_device *hid = (struct hid_device *) _hid;
int rc_lock, rc;

dev_dbg(&hid->intf->dev, "resetting device\n");
rc = rc_lock = usb_lock_device_for_reset(hid->dev, hid->intf);
if (rc_lock >= 0) {
rc = usb_reset_composite_device(hid->dev, hid->intf);
if (rc_lock)
usb_unlock_device(hid->dev);
int rc_lock, rc = 0;

if (test_bit(HID_CLEAR_HALT, &hid->iofl)) {
dev_dbg(&hid->intf->dev, "clear halt\n");
rc = usb_clear_halt(hid->dev, hid->urbin->pipe);
clear_bit(HID_CLEAR_HALT, &hid->iofl);
hid_start_in(hid);
}

else if (test_bit(HID_RESET_PENDING, &hid->iofl)) {
dev_dbg(&hid->intf->dev, "resetting device\n");
rc = rc_lock = usb_lock_device_for_reset(hid->dev, hid->intf);
if (rc_lock >= 0) {
rc = usb_reset_composite_device(hid->dev, hid->intf);
if (rc_lock)
usb_unlock_device(hid->dev);
}
clear_bit(HID_RESET_PENDING, &hid->iofl);
}
clear_bit(HID_RESET_PENDING, &hid->iofl);

switch (rc) {
case 0:
Expand Down Expand Up @@ -1023,9 +1032,8 @@ static void hid_io_error(struct hid_device *hid)

/* Retries failed, so do a port reset */
if (!test_and_set_bit(HID_RESET_PENDING, &hid->iofl)) {
if (schedule_work(&hid->reset_work))
goto done;
clear_bit(HID_RESET_PENDING, &hid->iofl);
schedule_work(&hid->reset_work);
goto done;
}
}

Expand All @@ -1049,6 +1057,11 @@ static void hid_irq_in(struct urb *urb)
hid->retry_delay = 0;
hid_input_report(HID_INPUT_REPORT, urb, 1);
break;
case -EPIPE: /* stall */
clear_bit(HID_IN_RUNNING, &hid->iofl);
set_bit(HID_CLEAR_HALT, &hid->iofl);
schedule_work(&hid->reset_work);
return;
case -ECONNRESET: /* unlink */
case -ENOENT:
case -ESHUTDOWN: /* unplug */
Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/usb/input/hid.h
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,7 @@ struct hid_control_fifo {
#define HID_IN_RUNNING 3
#define HID_RESET_PENDING 4
#define HID_SUSPENDED 5
#define HID_CLEAR_HALT 6

struct hid_input {
struct list_head list;
Expand Down

0 comments on commit 0e2073e

Please sign in to comment.