linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Zaidman <michael.zaidman@gmail.com>
To: Enrik Berkhan <Enrik.Berkhan@inka.de>
Cc: jikos@kernel.org, linux-kernel@vger.kernel.org,
	linux-input@vger.kernel.org,
	Guillaume Champagne <champagne.guillaume.c@gmail.com>,
	Michael Zaidman <michael.zaidman@gmail.com>
Subject: Re: [PATCH v2 4/7] HID: ft260: support i2c reads greater than HID report size
Date: Wed, 5 Oct 2022 17:50:18 +0300	[thread overview]
Message-ID: <Yz2ZqiDvkO1ePB4k@michael-VirtualBox> (raw)
In-Reply-To: <28932c5e2250c68e07ef5fafe3bee42653fd62f5.camel@inka.de>

On Tue, Oct 04, 2022 at 08:11:37PM +0200, Enrik Berkhan wrote:
> Hi Michael,
> 
> On Wed, 2022-09-28 at 17:48 +0300, Michael Zaidman wrote:
> > diff --git a/drivers/hid/hid-ft260.c b/drivers/hid/hid-ft260.c
> > index bfda5b191a3a..cb8f1782d1f0 100644
> > --- a/drivers/hid/hid-ft260.c
> > +++ b/drivers/hid/hid-ft260.c
> > @@ -460,49 +460,68 @@ static int ft260_smbus_write(struct ft260_device *dev, u8 addr, u8 cmd,
> >  static int ft260_i2c_read(struct ft260_device *dev, u8 addr, u8 *data,
> >  			  u16 len, u8 flag)
> >  {
> > +	u16 rd_len;
> > +	int timeout, ret;
> >  	struct ft260_i2c_read_request_report rep;
> >  	struct hid_device *hdev = dev->hdev;
> > -	int timeout;
> > -	int ret;
> > +	bool first = true;
> >  
> > -	if (len > FT260_RD_DATA_MAX) {
> > -		hid_err(hdev, "%s: unsupported rd len: %d\n", __func__, len);
> > -		return -EINVAL;
> > -	}
> > +	do {
> > +		if (first) {
> > +			if (flag & FT260_FLAG_START_REPEATED)
> 
> I think the test should be
> 
>     if ((flag & FT260_FLAG_START_REPEATED) == FT260_FLAG_START_REPEATED)
> 
> Otherwise, flag will never be FT260_FLAG_START ( = 2), as
> FT260_FLAG_START_REPEATED (= 3) has tow bits set. It looks as if bit 0
> actually means "repeated", bit 1 is "start" and bit 2 is "stop".
> 
> Cheers,
> Enrik
>

Thanks for reviewing the code!

Though the FT260 works fine with the FT260_FLAG_START_REPEATED flag at the
beginning of the I2C IO, I will fix it as you suggested.

Thanks,
Michael


  reply	other threads:[~2022-10-05 14:50 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-28 14:48 [PATCH v2 0/7] HID: ft260: fixes and performance improvements Michael Zaidman
2022-09-28 14:48 ` [PATCH v2 1/7] HID: ft260: ft260_xfer_status routine cleanup Michael Zaidman
2022-09-28 14:48 ` [PATCH v2 2/7] HID: ft260: improve i2c write performance Michael Zaidman
2022-09-28 15:50   ` David Laight
2022-09-28 20:27     ` Michael Zaidman
2022-09-28 14:48 ` [PATCH v2 3/7] HID: ft260: support i2c writes larger than HID report size Michael Zaidman
2022-09-28 14:48 ` [PATCH v2 4/7] HID: ft260: support i2c reads greater " Michael Zaidman
2022-10-04 18:11   ` Enrik Berkhan
2022-10-05 14:50     ` Michael Zaidman [this message]
2022-09-28 14:48 ` [PATCH v2 5/7] HID: ft260: improve i2c large reads performance Michael Zaidman
2022-10-04 18:15   ` Enrik Berkhan
2022-10-05 14:34     ` Michael Zaidman
2022-10-05 18:19       ` Enrik Berkhan
2022-09-28 14:48 ` [PATCH v2 6/7] HID: ft260: do not populate /dev/hidraw device Michael Zaidman
2022-09-28 14:48 ` [PATCH v2 7/7] HID: ft260: skip unexpected HID input reports Michael Zaidman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Yz2ZqiDvkO1ePB4k@michael-VirtualBox \
    --to=michael.zaidman@gmail.com \
    --cc=Enrik.Berkhan@inka.de \
    --cc=champagne.guillaume.c@gmail.com \
    --cc=jikos@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).