Hi, I am implementing reset_resume() in the sierra driver. It seems to me that the best way to do that would be to simulate a sudden loss of connection. To do so I need to know what a sierra device does if the connection simply vanishes. I want to feed emulated error messages to the tty layer to make NetworkManager deal nicely with this situation. Regards Oliver
From 11ca5b178d7cad93b4d6e0914e21a422fd64ef92 Mon Sep 17 00:00:00 2001 From: Oliver Neukum <oliver@xxxxxxxxxx> Date: Tue, 2 Feb 2010 14:33:06 +0100 Subject: [PATCH] usb:sierra:implement reset_resume() This implements a primitive form of reset_resume() that just pretends nothing has happened. Signed-off-by: Oliver Neukum <oliver@xxxxxxxxxx> --- drivers/usb/serial/sierra.c | 29 ++++++++++++++++++++++------- 1 files changed, 22 insertions(+), 7 deletions(-) diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c index ac1b644..f15dc66 100644 --- a/drivers/usb/serial/sierra.c +++ b/drivers/usb/serial/sierra.c @@ -303,14 +303,17 @@ static struct usb_device_id id_table [] = { }; MODULE_DEVICE_TABLE(usb, id_table); +static int sierra_reset_resume(struct usb_interface *intf); + static struct usb_driver sierra_driver = { - .name = "sierra", - .probe = usb_serial_probe, - .disconnect = usb_serial_disconnect, - .suspend = usb_serial_suspend, - .resume = usb_serial_resume, - .id_table = id_table, - .no_dynamic_id = 1, + .name = "sierra", + .probe = usb_serial_probe, + .disconnect = usb_serial_disconnect, + .suspend = usb_serial_suspend, + .resume = usb_serial_resume, + .reset_resume = sierra_reset_resume, + .id_table = id_table, + .no_dynamic_id = 1, .supports_autosuspend = 1, }; @@ -1060,9 +1063,21 @@ static int sierra_resume(struct usb_serial *serial) return ec ? -EIO : 0; } + +static int sierra_reset_resume(struct usb_interface *intf) +{ + struct usb_serial *serial = usb_get_intfdata(intf); + int rv; + + serial->suspending = 0; + rv = sierra_resume(serial); + return rv; +} + #else #define sierra_suspend NULL #define sierra_resume NULL +#define sierra_reset_resume NULL #endif static struct usb_serial_driver sierra_device = { -- 1.6.4.2