diff options
author | Abhishek Pandit-Subedi <abhishekpandit@chromium.org> | 2019-12-02 17:03:58 -0800 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2019-12-03 18:36:35 +0200 |
commit | eae22f390ea0e3c6744881a79fe063d2d1bf716e (patch) | |
tree | b4688eae72d0fc7585f5bd4741027a9d55e5f498 /profiles/input | |
parent | cf48a5870a7044c66821238fd83df707096114b0 (diff) | |
download | bluez-eae22f390ea0e3c6744881a79fe063d2d1bf716e.tar.gz |
input: Update virtual input devices with correct info
Update uhid and uinput devices with lowercase addresses (to match how
kernel prints it via %pMR). Also update uinput to include the phys
attribute and correctly set the vendor/product/version during init.
Diffstat (limited to 'profiles/input')
-rw-r--r-- | profiles/input/device.c | 4 | ||||
-rw-r--r-- | profiles/input/hog-lib.c | 10 |
2 files changed, 12 insertions, 2 deletions
diff --git a/profiles/input/device.c b/profiles/input/device.c index a711ef527..2cb3811c8 100644 --- a/profiles/input/device.c +++ b/profiles/input/device.c @@ -855,8 +855,8 @@ static int uhid_connadd(struct input_device *idev, struct hidp_connadd_req *req) memset(&ev, 0, sizeof(ev)); ev.type = UHID_CREATE; strncpy((char *) ev.u.create.name, req->name, sizeof(ev.u.create.name)); - ba2str(&idev->src, (char *) ev.u.create.phys); - ba2str(&idev->dst, (char *) ev.u.create.uniq); + ba2strlc(&idev->src, (char *) ev.u.create.phys); + ba2strlc(&idev->dst, (char *) ev.u.create.uniq); ev.u.create.vendor = req->vendor; ev.u.create.product = req->product; ev.u.create.version = req->version; diff --git a/profiles/input/hog-lib.c b/profiles/input/hog-lib.c index d9ed80689..9c5c814a7 100644 --- a/profiles/input/hog-lib.c +++ b/profiles/input/hog-lib.c @@ -32,6 +32,7 @@ #include <stdbool.h> #include <errno.h> #include <unistd.h> +#include <ctype.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> @@ -992,6 +993,15 @@ static void report_map_read_cb(guint8 status, const guint8 *pdu, guint16 plen, BT_IO_OPT_SOURCE, ev.u.create.phys, BT_IO_OPT_DEST, ev.u.create.uniq, BT_IO_OPT_INVALID); + + /* Phys + uniq are the same size (hw address type) */ + for (i = 0; + i < (int)sizeof(ev.u.create.phys) && ev.u.create.phys[i] != 0; + ++i) { + ev.u.create.phys[i] = tolower(ev.u.create.phys[i]); + ev.u.create.uniq[i] = tolower(ev.u.create.uniq[i]); + } + if (gerr) { error("Failed to connection details: %s", gerr->message); g_error_free(gerr); |