Le 24/10/2010 15:21, Benjamin Tissoires a écrit :

3) the file named hid-mosart.c.patch again (part 2 -> between the #ifdef
CONFIG_PM):
In case of a suspend/resume, the device switch back to the first mode
described above (with left and right buttons).
The patch adds a hook in .reset_resume for the device to be switched to
the correct mode (I just copy the code in mosart_probe).


Following this point, I saw that ntrig ("more recent firmware versions") and egalax drivers had a similar way of initialization (sending usbhid_submit_report).

So I was wondering if there were people on the list that want to try the suspend/resume hook I send above for their device (unless there is no problem for these devices, but I doubt).

Basically, the idea is to copy the usbhid_submit_report from the `device`_probe function to a new one `device`_reset_resume, and update the struct `device`_driver to hang the hook:

/********************************************************************/
/*************************** for egalax: ****************************/
/********************************************************************/

#ifdef CONFIG_PM
static int egalax_reset_resume(struct hid_device *hdev)
{
struct hid_report *report = hdev->report_enum[HID_FEATURE_REPORT].report_id_hash[5];

        if (report) {
                report->field[0]->value[0] = 2;
                usbhid_submit_report(hdev, report, USB_DIR_OUT);
        }
        return 0;
}
#endif

/**************************** and change ****************************/
static struct hid_driver egalax_driver = {
        .name = "egalax-touch",
        .id_table = egalax_devices,
        .probe = egalax_probe,
        .remove = egalax_remove,
        .input_mapping = egalax_input_mapping,
        .input_mapped = egalax_input_mapped,
        .usage_table = egalax_grabbed_usages,
        .event = egalax_event,
#ifdef CONFIG_PM
        .reset_resume =  egalax_reset_resume,
#endif
};



/********************************************************************/
/**************************** for ntrig: ****************************/
/********************************************************************/

#ifdef CONFIG_PM
static int ntrig_reset_resume(struct hid_device *hdev)
{
struct hid_report *report = hdev->report_enum[HID_FEATURE_REPORT].report_id_hash[0x0a];

        if (report) {
                usbhid_submit_report(hdev, report, USB_DIR_OUT);
        }
        return 0;
}
#endif

/**************************** and change ****************************/
static struct hid_driver ntrig_driver = {
        .name = "ntrig",
        .id_table = ntrig_devices,
        .probe = ntrig_probe,
        .remove = ntrig_remove,
        .input_mapping = ntrig_input_mapping,
        .input_mapped = ntrig_input_mapped,
        .usage_table = ntrig_grabbed_usages,
        .event = ntrig_event,
#ifdef CONFIG_PM
        .reset_resume =  ntrig_reset_resume,
#endif
};



/********************************************************************/

Again, these tests will also help Stephane to build a better generic driver and that's why I do not want to make too much noise on linux-input ml (sending patches again drivers that are doomed to disappear).

Cheers,
Benjamin

_______________________________________________
Mailing list: https://launchpad.net/~multi-touch-dev
Post to     : multi-touch-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~multi-touch-dev
More help   : https://help.launchpad.net/ListHelp

Reply via email to