linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: David Herrmann <dh.herrmann@gmail.com>
Cc: Frank Praznik <frank.praznik@gmail.com>,
	Jiri Kosina <jkosina@suse.cz>,
	"open list:HID CORE LAYER" <linux-input@vger.kernel.org>,
	Benjamin Tissoires <benjamin.tissoires@gmail.com>
Subject: Re: [PATCH 0/6] HID: Add a stable method for retrieving the client MAC address of a HID device
Date: Mon, 3 Feb 2014 09:57:04 -0800	[thread overview]
Message-ID: <20140203175704.GA2229@core.coreip.homeip.net> (raw)
In-Reply-To: <CANq1E4Q+oaovc-G9D07hSKQxE4SO_ziKLbKnRH8cH9NwV3YXnQ@mail.gmail.com>

On Mon, Feb 03, 2014 at 06:45:52PM +0100, David Herrmann wrote:
> Hi
> 
> Adding Dmitry+Jiri, maybe they can clarify this.
> 
> [snip]
> >>>
> >>> Yes
> >>>
> >>>> hidp sets it to point to the hci_conn struct from which src address for the
> >>>> Bluetooth connection can be obtained, but making assumptions about an opaque
> >>>> pointer like that seems dangerous.  Is the parent pointer guaranteed to
> >>>> point to the hci_conn struct as long as the bus type is Bluetooth?
> >>>
> >>> And nope. If you use uhid, then the parent will not be a hci_conn.
> >>>
> >>> With enough guards, you should be able to use it, but it's not ideal I agree.
> >>> I really want to have David's opinion regarding the UNIQ field. IMO,
> >>> this seems to be the most transport-agnostic way of doing it.
> >>
> >> UNIQ is definitely wrong. It is used to assign a run-time *unique*
> >> value to the connection. So ideally it should be different if a device
> >> is reconnected. The PHYS field is actually used to identify a physical
> >> device. So please, if we're doing this, then we should do it via PHYS.
> >>
> >> I'm fine with hard-coding PHYS as bt-address for BT-HID, but please
> >> add a comment to hidp_setup_hid() in net/bluetooth/hidp/core.c before
> >> doing the snprintf() there.
> >>
> >> The reason why I disliked hard-coding this behavior is that if a
> >> single BT-device is connected twice to us, we usually want two
> >> different PHYS entries for both depending on which service this
> >> connection provides. However, this seems like an unlikely and
> >> overengineered problem so lets not do that. Furthermore, while BT-HID
> >> would allow such setups with some hacks, it isn't supported in a clean
> >> way. So yeah, I'm actually fine with using PHYS for that.
> >>
> >> Thanks
> >> David
> >
> > PHYS should definitely be changed if this is the case because right
> > now it is set to the MAC of the host adapter which means that it's the
> > same for every Bluetooth device and connection.  I believe that the
> > hidraw documentation also specifies that for Bluetooth devices the
> > HIDIOCGRAWPHYS ioctl should return a string with the MAC address of
> > the associated device rather than that of the host adapter as the
> > current behavior does.
> 
> Oh, yes, nice catch!
> Ok, maybe we need to clear up what PHYS and UNIQ do before relying on
> them. I thought, they were defined as:
> 
> PHYS: A string describing the physical device. It should be the same
> if a device reconnects. It can be used by user-space to track devices
> across disconnects
> 
> UNIQ: A string describing the current connection to a device. If the
> device reconnects, the UNIQ string should change. It can be used by
> user-space to track a single device-session.
> 
> afaik both strings have no common format and drivers are free to
> provide any kind of information, as long as it follows the given
> rules. That's why I disliked the idea of relying on them and parsing
> them. But maybe I just have no idea what the original intention was
> behind them?

PHYS: describes physical connection of the device in a given box,
supposed to be unique within a box.

UNIQ: unique identifier (if exists) assigned to the device, should
ideally be unique globally and should not change when device is moved
within a box out between boxes. Think serial number in USB descriptors.

Thanks.

-- 
Dmitry

  reply	other threads:[~2014-02-03 17:57 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-31 17:32 [PATCH 0/6] HID: Add a stable method for retrieving the client MAC address of a HID device Frank Praznik
2014-01-31 17:32 ` [PATCH 1/6] HID: Add the client_addr member to the hid_device struct Frank Praznik
2014-01-31 19:12   ` Benjamin Tissoires
2014-01-31 17:32 ` [PATCH 2/6] HID: hidp: Store the device MAC in client_addr Frank Praznik
2014-01-31 17:32 ` [PATCH 3/6] HID: Add support for setting client_addr in uhid Frank Praznik
2014-01-31 19:16   ` Benjamin Tissoires
2014-01-31 17:32 ` [PATCH 4/6] HID: Add the HIDIOCGRAWCLIENTADDR ioctl to hidraw Frank Praznik
2014-01-31 19:19   ` Benjamin Tissoires
2014-01-31 17:32 ` [PATCH 5/6] HID: Add the HIDIOCGRAWCLIENTADDR ioctl to the hidraw documentation Frank Praznik
2014-01-31 19:17   ` Benjamin Tissoires
2014-01-31 17:32 ` [PATCH 6/6] HID: Update the hidraw sample with the usage of HIDIOCGRAWCLIENTADDR Frank Praznik
2014-01-31 19:18   ` Benjamin Tissoires
2014-01-31 19:10 ` [PATCH 0/6] HID: Add a stable method for retrieving the client MAC address of a HID device Benjamin Tissoires
2014-01-31 20:04   ` Frank Praznik
2014-01-31 20:45     ` Benjamin Tissoires
2014-02-01 16:06       ` Frank Praznik
2014-02-01 16:28         ` Benjamin Tissoires
2014-02-03 16:24           ` David Herrmann
2014-02-03 17:31             ` Frank Praznik
2014-02-03 17:45               ` David Herrmann
2014-02-03 17:57                 ` Dmitry Torokhov [this message]
2014-02-03 18:06                   ` David Herrmann
2014-02-03 18:33                     ` Frank Praznik

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=20140203175704.GA2229@core.coreip.homeip.net \
    --to=dmitry.torokhov@gmail.com \
    --cc=benjamin.tissoires@gmail.com \
    --cc=dh.herrmann@gmail.com \
    --cc=frank.praznik@gmail.com \
    --cc=jkosina@suse.cz \
    --cc=linux-input@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).