linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: ravikumar.veeramally@linux.intel.com
To: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH_v3 01/04] android/hid: Implement hid get protocol in daemon
Date: Tue, 5 Nov 2013 19:28:38 +0200 (EET)	[thread overview]
Message-ID: <62354.10.252.42.55.1383672518.squirrel@linux.intel.com> (raw)
In-Reply-To: <20131105155821.GA19994@x220.p-661hnu-f1>

Hi Johan,

> Hi Ravi,
>
> On Tue, Nov 05, 2013, Ravi Kumar Veeramally wrote:
>> >On Tue, Nov 05, 2013, Ravi kumar Veeramally wrote:
>> >>+static gboolean ctrl_io_watch_cb(GIOChannel *chan, gpointer data)
>> >>+{
>> >>+	struct hid_device *dev = data;
>> >>+	int fd, bread;
>> >>+	uint8_t buf[UHID_DATA_MAX];
>> >>+
>> >>+	DBG("");
>> >>+
>> >>+	fd = g_io_channel_unix_get_fd(chan);
>> >>+	bread = read(fd, buf, sizeof(buf));
>> >>+	if (bread < 0) {
>> >>+		error("read: %s(%d)", strerror(errno), -errno);
>> >>+		return TRUE;
>> >>+	}
>> >>+
>> >>+	switch (dev->last_hid_msg) {
>> >>+	case HID_MSG_GET_PROTOCOL:
>> >>+		bt_hid_notify_proto_mode(dev, buf, bread);
>> >>+		break;
>> >>+	default:
>> >>+		DBG("unhandled hid msg type 0x%02x", dev->last_hid_msg);
>> >>+	}
>> >This doesn't really make sense to me. If you only set last_hid_msg when
>> >you send a code that you do support, then why would the value of
>> >last_hid_msg ever contain a type that you do not support? (assuming you
>> >always add an entry to this switch statement in the same patch that you
>> >add a corresponding write for the type).
>> >
>> >Also, since you don't seem to be using last_hid_msg for anything else
>> >than printing this debug message, I'm wondering is there really any
>> >value for it? Previously (based on our IRC) discussion I understood
>> that
>> >it had some actual functional value that helped determine what to send
>> >to the HAL, but now I'm not seeing it anywhere in the patch. I might
>> >have missed it though (in which case please enlighten me :)
>>  I don't know if I understand you correctly, but at the end of all
>> patches
>>  it looks like this.
>>          switch (dev->last_hid_msg) {
>>         case HID_MSG_GET_PROTOCOL:
>>         case HID_MSG_SET_PROTOCOL:
>>                 bt_hid_notify_proto_mode(dev, buf, bread);
>>                 break;
>>         case HID_MSG_GET_REPORT:
>>                 bt_hid_notify_get_report(dev, buf, bread);
>>                 break;
>>         default:
>>                 DBG("unhandled hid msg type 0x%02x", dev->last_hid_msg);
>>         }
>>
>> based on last_hid_msg switch case, it will call respective function,
>> default statement is for debug purpose if we miss something from hid
>> device.
>
> I only saw the first two case statements and didn't look deeper into the
> patch set, sorry. In this case I do see the point of the variable and
> you may keep it as is.
Ok, np.

>
> My earlier comment about the debug statement still holds though, i.e. if
> the default entry gets triggered last_hid_msg will not contain the
> unknown msg type. In this case this will simply be an unexpected message
> whose type we do not know (and if there's a debug log that's what it
> should say).

I will remove the debug statement which doesn't help much.

Thanks,
Ravi.

      reply	other threads:[~2013-11-05 17:28 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-05 12:22 [PATCH_v3 01/04] android/hid: Implement hid get protocol in daemon Ravi kumar Veeramally
2013-11-05 12:22 ` [PATCH_v3 02/04] android/hid: Implement hid set " Ravi kumar Veeramally
2013-11-05 13:12   ` Johan Hedberg
2013-11-05 13:52     ` Ravi Kumar Veeramally
2013-11-05 12:22 ` [PATCH_v3 03/04] android/hid: Implement hid get report " Ravi kumar Veeramally
2013-11-05 13:16   ` Johan Hedberg
2013-11-05 13:55     ` Ravi Kumar Veeramally
2013-11-05 12:22 ` [PATCH_v3 04/04] android/hid: Implement hid set " Ravi kumar Veeramally
2013-11-05 13:10 ` [PATCH_v3 01/04] android/hid: Implement hid get protocol " Johan Hedberg
2013-11-05 13:27   ` Ravi Kumar Veeramally
2013-11-05 15:58     ` Johan Hedberg
2013-11-05 17:28       ` ravikumar.veeramally [this message]

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=62354.10.252.42.55.1383672518.squirrel@linux.intel.com \
    --to=ravikumar.veeramally@linux.intel.com \
    --cc=linux-bluetooth@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).