Am Montag 30 Juni 2008 23:47:08 schrieb Thomas Reitmayr:
* Suspend to RAM:
The device suspends properly, I hear the audio subsystem turning off
while the display keeps its current state.
Apparently the USB root hub gets reset during suspend/resume according
to the kernel log. Then after resume the input events are generated
This patch may help.
Regards
Oliver
---
--- linux-2.6.26-sierra/drivers/input/misc/yealink.alt3.c 2008-07-02 15:42:35.000000000 +0200
+++ linux-2.6.26-sierra/drivers/input/misc/yealink.c 2008-07-02 16:14:57.000000000 +0200
@@ -122,6 +122,9 @@ struct yealink_dev {
int shutdown:1;
int open:1;
+ u8 *old_ringtone;
+ int tonecount;
+
int stat_ix;
union {
struct yld_status s;@@ -564,6 +567,8 @@ static void input_close(struct input_dev
down_write(&sysfs_rwsema);
yld->open = 0;
+ kfree(yld->old_ringtone),
+ yld->old_ringtone = NULL;
up_write(&sysfs_rwsema);
stop_traffic(yld);
}
@@ -767,6 +772,9 @@ static ssize_t store_ringtone(struct dev
{
struct yealink_dev *yld;
+ if (!count)
+ return 0;
+
down_write(&sysfs_rwsema);
yld = dev_get_drvdata(dev);
if (yld == NULL) {@@ -776,6 +784,14 @@ static ssize_t store_ringtone(struct dev
/* TODO locking with async usb control interface??? */
yealink_set_ringtone(yld, (char *)buf, count);
+ kfree(yld->old_ringtone);
+ yld->old_ringtone = kmalloc(count, GFP_KERNEL);
+ if (!yld->old_ringtone)
+ goto error_bail;
+ memcpy(yld->old_ringtone, buf, count);
+ yld->tonecount = count;
+
+error_bail:
up_write(&sysfs_rwsema);
return count;
}
@@ -882,6 +898,30 @@ static int usb_resume(struct usb_interfa
up_read(&sysfs_rwsema);
return rv;
}
+
+static int usb_reset_resume(struct usb_interface *intf)
+{
+ struct yealink_dev *yld = usb_get_intfdata(intf);
+ int rv = 0;
+
+ down_read(&sysfs_rwsema);
+ if (!yld->open)
+ goto skip_io;
+ if (yld->old_ringtone)
+ rv = yealink_set_ringtone(yld,
+ yld->old_ringtone,
+ yld->tonecount);
+ else
+ rv = yealink_set_ringtone(yld,
+ default_ringtone,
+ sizeof(default_ringtone));
+
+skip_io:
+ up_read(&sysfs_rwsema);
+
+ return rv;
+}
+
static void usb_disconnect(struct usb_interface *intf)
{
struct yealink_dev *yld;@@ -1030,6 +1070,7 @@ static struct usb_driver yealink_driver
.disconnect = usb_disconnect,
.suspend = usb_suspend,
.resume = usb_resume,
+ .reset_resume = usb_reset_resume,
.id_table = usb_table,
};
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html