@@ -56,6 +56,7 @@ struct usb_acecad {
unsigned char *data;
dma_addr_t data_dma;
+ bool submitted;
};
static void usb_acecad_irq(struct urb *urb)
@@ -116,6 +117,7 @@ static int usb_acecad_open(struct input_dev *dev)
acecad->irq->dev = acecad->usbdev;
if (usb_submit_urb(acecad->irq, GFP_KERNEL))
return -EIO;
+ acecad->submitted = true;
return 0;
}
@@ -124,6 +126,7 @@ static void usb_acecad_close(struct input_dev *dev)
{
struct usb_acecad *acecad = input_get_drvdata(dev);
+ acecad->submitted = false;
usb_kill_urb(acecad->irq);
}
@@ -261,6 +264,25 @@ static void usb_acecad_disconnect(struct usb_interface *intf)
}
}
+static int usb_acecad_suspend(struct usb_interface *intf, pm_message_t message)
+{
+ struct usb_acecad *acecad = usb_get_intfdata(intf);
+
+ usb_kill_urb(acecad->irq);
+ return 0;
+}
+
+static int usb_acecad_resume(struct usb_interface *intf)
+{
+ struct usb_acecad *acecad = usb_get_intfdata(intf);
+ int rv = 0;
+
+ if (acecad->submitted)
+ rv = usb_submit_urb(acecad->irq, GFP_NOIO);
+
+ return rv;
+}
+
static struct usb_device_id usb_acecad_id_table [] = {
{ USB_DEVICE(USB_VENDOR_ID_ACECAD, USB_DEVICE_ID_FLAIR), .driver_info = 0 },
{ USB_DEVICE(USB_VENDOR_ID_ACECAD, USB_DEVICE_ID_302), .driver_info = 1 },
@@ -273,6 +295,8 @@ static struct usb_driver usb_acecad_driver = {
.name = "usb_acecad",
.probe = usb_acecad_probe,
.disconnect = usb_acecad_disconnect,
+ .suspend = usb_acecad_suspend,
+ .resume = usb_acecad_resume,
.id_table = usb_acecad_id_table,
};