From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ v1 3/4] input: Use bt_uhid_create instead of UHID_CREATE
Date: Fri, 8 Mar 2024 17:10:06 -0500 [thread overview]
Message-ID: <20240308221007.250681-3-luiz.dentz@gmail.com> (raw)
In-Reply-To: <20240308221007.250681-1-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This makes use of bt_uhid_create instead of directly submitting
UHID_CREATE since it can track UHID_START by itself.
Fixes: https://github.com/bluez/bluez/issues/771
---
profiles/input/device.c | 21 ++++-----------------
1 file changed, 4 insertions(+), 17 deletions(-)
diff --git a/profiles/input/device.c b/profiles/input/device.c
index 0d32b705bd00..d5b7d6728c88 100644
--- a/profiles/input/device.c
+++ b/profiles/input/device.c
@@ -941,28 +941,15 @@ static int ioctl_disconnect(struct input_device *idev, uint32_t flags)
static int uhid_connadd(struct input_device *idev, struct hidp_connadd_req *req)
{
int err;
- struct uhid_event ev;
if (idev->uhid_created)
return 0;
- /* create uHID device */
- memset(&ev, 0, sizeof(ev));
- ev.type = UHID_CREATE;
- strncpy((char *) ev.u.create.name, req->name, sizeof(ev.u.create.name));
- 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;
- ev.u.create.country = req->country;
- ev.u.create.bus = BUS_BLUETOOTH;
- ev.u.create.rd_data = req->rd_data;
- ev.u.create.rd_size = req->rd_size;
-
- err = bt_uhid_send(idev->uhid, &ev);
+ err = bt_uhid_create(idev->uhid, req->name, &idev->src, &idev->dst,
+ req->vendor, req->product, req->version,
+ req->country, req->rd_data, req->rd_size);
if (err < 0) {
- error("bt_uhid_send: %s", strerror(-err));
+ error("bt_uhid_create: %s", strerror(-err));
return err;
}
--
2.43.0
next prev parent reply other threads:[~2024-03-08 22:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-08 22:10 [PATCH BlueZ v1 1/4] shared/uhid: Add bt_uhid_create Luiz Augusto von Dentz
2024-03-08 22:10 ` [PATCH BlueZ v1 2/4] hog-lib: Use bt_uhid_create instead of UHID_CREATE2 Luiz Augusto von Dentz
2024-03-08 22:10 ` Luiz Augusto von Dentz [this message]
2024-03-08 22:10 ` [PATCH BlueZ v1 4/4] test-uhid: Test bt_uhid_create and bt_uhid_destroy Luiz Augusto von Dentz
2024-03-09 0:53 ` [BlueZ,v1,1/4] shared/uhid: Add bt_uhid_create bluez.test.bot
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=20240308221007.250681-3-luiz.dentz@gmail.com \
--to=luiz.dentz@gmail.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).