* [PATCH 1/2] Input - Wacom: Fix transfer header problem @ 2014-07-26 11:59 Przemo Firszt 2014-07-26 11:59 ` [PATCH 2/2] Input - wacom: Remove passing id for wacom_set_report Przemo Firszt 2014-07-29 18:14 ` [PATCH 1/2] Input - Wacom: Fix transfer header problem Benjamin Tissoires 0 siblings, 2 replies; 4+ messages in thread From: Przemo Firszt @ 2014-07-26 11:59 UTC (permalink / raw) To: benjamin.tissoires Cc: dmitry.torokhov, jkosina, pinglinux, killertofu, linux-kernel, linux-input, Przemo Firszt Header of transfer of image is different depending on connection type. That patch should be probably merged with 462c52a8cbcc62c Input - wacom: Check for bluetooth protocol while setting OLEDs Signed-off-by: Przemo Firszt <przemo@firszt.eu> --- drivers/hid/wacom_sys.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c index 42f139f..51437e2 100644 --- a/drivers/hid/wacom_sys.c +++ b/drivers/hid/wacom_sys.c @@ -19,6 +19,7 @@ #define WAC_CMD_LED_CONTROL 0x20 #define WAC_CMD_ICON_START 0x21 +#define WAC_CMD_ICON_BT_XFER 0x26 #define WAC_CMD_ICON_XFER 0x23 #define WAC_CMD_RETRIES 10 @@ -550,7 +551,7 @@ static int wacom_led_putimage(struct wacom *wacom, int button_id, if (retval < 0) goto out; - buf[0] = WAC_CMD_ICON_XFER; + buf[0] = len == 256 ? WAC_CMD_ICON_BT_XFER : WAC_CMD_ICON_XFER; buf[1] = button_id & 0x07; for (i = 0; i < 4; i++) { buf[2] = i; -- 1.9.3 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] Input - wacom: Remove passing id for wacom_set_report 2014-07-26 11:59 [PATCH 1/2] Input - Wacom: Fix transfer header problem Przemo Firszt @ 2014-07-26 11:59 ` Przemo Firszt 2014-07-29 18:12 ` Benjamin Tissoires 2014-07-29 18:14 ` [PATCH 1/2] Input - Wacom: Fix transfer header problem Benjamin Tissoires 1 sibling, 1 reply; 4+ messages in thread From: Przemo Firszt @ 2014-07-26 11:59 UTC (permalink / raw) To: benjamin.tissoires Cc: dmitry.torokhov, jkosina, pinglinux, killertofu, linux-kernel, linux-input, Przemo Firszt Every call of wacom_set_report was passing "id" as a separate parameter and buffer also passed the same information. We can use first u8 of the buffer instead of "id" Signed-off-by: Przemo Firszt <przemo@firszt.eu> --- drivers/hid/wacom_sys.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c index 51437e2..db17198 100644 --- a/drivers/hid/wacom_sys.c +++ b/drivers/hid/wacom_sys.c @@ -36,13 +36,13 @@ static int wacom_get_report(struct hid_device *hdev, u8 type, u8 id, return retval; } -static int wacom_set_report(struct hid_device *hdev, u8 type, u8 id, - void *buf, size_t size, unsigned int retries) +static int wacom_set_report(struct hid_device *hdev, u8 type, u8 *buf, + size_t size, unsigned int retries) { int retval; do { - retval = hid_hw_raw_request(hdev, id, buf, size, type, + retval = hid_hw_raw_request(hdev, buf[0], buf, size, type, HID_REQ_SET_REPORT); } while ((retval == -ETIMEDOUT || retval == -EPIPE) && --retries); @@ -251,8 +251,8 @@ static int wacom_set_device_mode(struct hid_device *hdev, int report_id, rep_data[0] = report_id; rep_data[1] = mode; - error = wacom_set_report(hdev, HID_FEATURE_REPORT, - report_id, rep_data, length, 1); + error = wacom_set_report(hdev, HID_FEATURE_REPORT, rep_data, + length, 1); if (error >= 0) error = wacom_get_report(hdev, HID_FEATURE_REPORT, report_id, rep_data, length, 1); @@ -525,8 +525,8 @@ static int wacom_led_control(struct wacom *wacom) buf[4] = wacom->led.img_lum; } - retval = wacom_set_report(wacom->hdev, HID_FEATURE_REPORT, - WAC_CMD_LED_CONTROL, buf, 9, WAC_CMD_RETRIES); + retval = wacom_set_report(wacom->hdev, HID_FEATURE_REPORT, buf, 9, + WAC_CMD_RETRIES); kfree(buf); return retval; @@ -546,8 +546,8 @@ static int wacom_led_putimage(struct wacom *wacom, int button_id, /* Send 'start' command */ buf[0] = WAC_CMD_ICON_START; buf[1] = 1; - retval = wacom_set_report(wacom->hdev, HID_FEATURE_REPORT, - WAC_CMD_ICON_START, buf, 2, WAC_CMD_RETRIES); + retval = wacom_set_report(wacom->hdev, HID_FEATURE_REPORT, buf, 2, + WAC_CMD_RETRIES); if (retval < 0) goto out; @@ -557,9 +557,8 @@ static int wacom_led_putimage(struct wacom *wacom, int button_id, buf[2] = i; memcpy(buf + 3, img + i * chunk_len, chunk_len); - retval = wacom_set_report(wacom->hdev, HID_FEATURE_REPORT, - WAC_CMD_ICON_XFER, - buf, chunk_len + 3, WAC_CMD_RETRIES); + retval = wacom_set_report(wacom->hdev, HID_FEATURE_REPORT, buf, + chunk_len + 3, WAC_CMD_RETRIES); if (retval < 0) break; } @@ -567,8 +566,8 @@ static int wacom_led_putimage(struct wacom *wacom, int button_id, /* Send 'stop' */ buf[0] = WAC_CMD_ICON_START; buf[1] = 0; - wacom_set_report(wacom->hdev, HID_FEATURE_REPORT, WAC_CMD_ICON_START, - buf, 2, WAC_CMD_RETRIES); + wacom_set_report(wacom->hdev, HID_FEATURE_REPORT, buf, 2, + WAC_CMD_RETRIES); out: kfree(buf); -- 1.9.3 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] Input - wacom: Remove passing id for wacom_set_report 2014-07-26 11:59 ` [PATCH 2/2] Input - wacom: Remove passing id for wacom_set_report Przemo Firszt @ 2014-07-29 18:12 ` Benjamin Tissoires 0 siblings, 0 replies; 4+ messages in thread From: Benjamin Tissoires @ 2014-07-29 18:12 UTC (permalink / raw) To: Przemo Firszt Cc: Benjamin Tissoires, Dmitry Torokhov, Jiri Kosina, Ping Cheng, Jason Gerecke, linux-kernel@vger.kernel.org, linux-input On Sat, Jul 26, 2014 at 7:59 AM, Przemo Firszt <przemo@firszt.eu> wrote: > Every call of wacom_set_report was passing "id" as a separate parameter > and buffer also passed the same information. We can use first u8 of the > buffer instead of "id" > > Signed-off-by: Przemo Firszt <przemo@firszt.eu> > --- At first, I was not going to take this one without any other approvers, because we had such a discussion in the hid subsystem about the same problem with respect to hid_hw_raw_request(). But after a second thought, we control much things here, and this patch would have saved me 30 min this morning while I was wondering why your 1/2 fix was not working. I'll take this through my patch submission to Dmitry. Cheers, Benjamin > drivers/hid/wacom_sys.c | 27 +++++++++++++-------------- > 1 file changed, 13 insertions(+), 14 deletions(-) > > diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c > index 51437e2..db17198 100644 > --- a/drivers/hid/wacom_sys.c > +++ b/drivers/hid/wacom_sys.c > @@ -36,13 +36,13 @@ static int wacom_get_report(struct hid_device *hdev, u8 type, u8 id, > return retval; > } > > -static int wacom_set_report(struct hid_device *hdev, u8 type, u8 id, > - void *buf, size_t size, unsigned int retries) > +static int wacom_set_report(struct hid_device *hdev, u8 type, u8 *buf, > + size_t size, unsigned int retries) > { > int retval; > > do { > - retval = hid_hw_raw_request(hdev, id, buf, size, type, > + retval = hid_hw_raw_request(hdev, buf[0], buf, size, type, > HID_REQ_SET_REPORT); > } while ((retval == -ETIMEDOUT || retval == -EPIPE) && --retries); > > @@ -251,8 +251,8 @@ static int wacom_set_device_mode(struct hid_device *hdev, int report_id, > rep_data[0] = report_id; > rep_data[1] = mode; > > - error = wacom_set_report(hdev, HID_FEATURE_REPORT, > - report_id, rep_data, length, 1); > + error = wacom_set_report(hdev, HID_FEATURE_REPORT, rep_data, > + length, 1); > if (error >= 0) > error = wacom_get_report(hdev, HID_FEATURE_REPORT, > report_id, rep_data, length, 1); > @@ -525,8 +525,8 @@ static int wacom_led_control(struct wacom *wacom) > buf[4] = wacom->led.img_lum; > } > > - retval = wacom_set_report(wacom->hdev, HID_FEATURE_REPORT, > - WAC_CMD_LED_CONTROL, buf, 9, WAC_CMD_RETRIES); > + retval = wacom_set_report(wacom->hdev, HID_FEATURE_REPORT, buf, 9, > + WAC_CMD_RETRIES); > kfree(buf); > > return retval; > @@ -546,8 +546,8 @@ static int wacom_led_putimage(struct wacom *wacom, int button_id, > /* Send 'start' command */ > buf[0] = WAC_CMD_ICON_START; > buf[1] = 1; > - retval = wacom_set_report(wacom->hdev, HID_FEATURE_REPORT, > - WAC_CMD_ICON_START, buf, 2, WAC_CMD_RETRIES); > + retval = wacom_set_report(wacom->hdev, HID_FEATURE_REPORT, buf, 2, > + WAC_CMD_RETRIES); > if (retval < 0) > goto out; > > @@ -557,9 +557,8 @@ static int wacom_led_putimage(struct wacom *wacom, int button_id, > buf[2] = i; > memcpy(buf + 3, img + i * chunk_len, chunk_len); > > - retval = wacom_set_report(wacom->hdev, HID_FEATURE_REPORT, > - WAC_CMD_ICON_XFER, > - buf, chunk_len + 3, WAC_CMD_RETRIES); > + retval = wacom_set_report(wacom->hdev, HID_FEATURE_REPORT, buf, > + chunk_len + 3, WAC_CMD_RETRIES); > if (retval < 0) > break; > } > @@ -567,8 +566,8 @@ static int wacom_led_putimage(struct wacom *wacom, int button_id, > /* Send 'stop' */ > buf[0] = WAC_CMD_ICON_START; > buf[1] = 0; > - wacom_set_report(wacom->hdev, HID_FEATURE_REPORT, WAC_CMD_ICON_START, > - buf, 2, WAC_CMD_RETRIES); > + wacom_set_report(wacom->hdev, HID_FEATURE_REPORT, buf, 2, > + WAC_CMD_RETRIES); > > out: > kfree(buf); > -- > 1.9.3 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-input" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] Input - Wacom: Fix transfer header problem 2014-07-26 11:59 [PATCH 1/2] Input - Wacom: Fix transfer header problem Przemo Firszt 2014-07-26 11:59 ` [PATCH 2/2] Input - wacom: Remove passing id for wacom_set_report Przemo Firszt @ 2014-07-29 18:14 ` Benjamin Tissoires 1 sibling, 0 replies; 4+ messages in thread From: Benjamin Tissoires @ 2014-07-29 18:14 UTC (permalink / raw) To: Przemo Firszt Cc: Benjamin Tissoires, Dmitry Torokhov, Jiri Kosina, Ping Cheng, Jason Gerecke, linux-kernel@vger.kernel.org, linux-input On Sat, Jul 26, 2014 at 7:59 AM, Przemo Firszt <przemo@firszt.eu> wrote: > Header of transfer of image is different depending on connection type. > That patch should be probably merged with 462c52a8cbcc62c > Input - wacom: Check for bluetooth protocol while setting OLEDs > > Signed-off-by: Przemo Firszt <przemo@firszt.eu> > --- Thanks Przemo. I'll merge this one in the v3 of the wacom/BT/USB merge. I'll let you add your s-o-b line once the patches will be on the list (soonish). Cheers, Benjamin > drivers/hid/wacom_sys.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c > index 42f139f..51437e2 100644 > --- a/drivers/hid/wacom_sys.c > +++ b/drivers/hid/wacom_sys.c > @@ -19,6 +19,7 @@ > > #define WAC_CMD_LED_CONTROL 0x20 > #define WAC_CMD_ICON_START 0x21 > +#define WAC_CMD_ICON_BT_XFER 0x26 > #define WAC_CMD_ICON_XFER 0x23 > #define WAC_CMD_RETRIES 10 > > @@ -550,7 +551,7 @@ static int wacom_led_putimage(struct wacom *wacom, int button_id, > if (retval < 0) > goto out; > > - buf[0] = WAC_CMD_ICON_XFER; > + buf[0] = len == 256 ? WAC_CMD_ICON_BT_XFER : WAC_CMD_ICON_XFER; > buf[1] = button_id & 0x07; > for (i = 0; i < 4; i++) { > buf[2] = i; > -- > 1.9.3 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-07-29 18:14 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-07-26 11:59 [PATCH 1/2] Input - Wacom: Fix transfer header problem Przemo Firszt 2014-07-26 11:59 ` [PATCH 2/2] Input - wacom: Remove passing id for wacom_set_report Przemo Firszt 2014-07-29 18:12 ` Benjamin Tissoires 2014-07-29 18:14 ` [PATCH 1/2] Input - Wacom: Fix transfer header problem Benjamin Tissoires
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox