From: Petri Gynther <pgynther@google.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCHv5] hog: Use HoG device name as uHID input device name
Date: Tue, 18 Feb 2014 23:40:18 -0800 (PST) [thread overview]
Message-ID: <20140219074018.B736F1005F0@puck.mtv.corp.google.com> (raw)
---
profiles/input/hog.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/profiles/input/hog.c b/profiles/input/hog.c
index ded6303..b9a14b9 100644
--- a/profiles/input/hog.c
+++ b/profiles/input/hog.c
@@ -91,6 +91,7 @@ struct hog_device {
uint16_t proto_mode_handle;
uint16_t ctrlpt_handle;
uint8_t flags;
+ char *name;
};
struct report {
@@ -392,7 +393,9 @@ static void report_map_read_cb(guint8 status, const guint8 *pdu, guint16 plen,
/* create uHID device */
memset(&ev, 0, sizeof(ev));
ev.type = UHID_CREATE;
- strcpy((char *) ev.u.create.name, "bluez-hog-device");
+ strncpy((char *) ev.u.create.name, hogdev->name ?
+ hogdev->name : "bluez-hog-device",
+ sizeof(ev.u.create.name) - 1);
ev.u.create.vendor = vendor;
ev.u.create.product = product;
ev.u.create.version = version;
@@ -722,6 +725,7 @@ static struct hog_device *hog_new_device(struct btd_device *device,
uint16_t id)
{
struct hog_device *hogdev;
+ char name[HCI_MAX_NAME_LENGTH + 1];
hogdev = g_try_new0(struct hog_device, 1);
if (!hogdev)
@@ -729,6 +733,9 @@ static struct hog_device *hog_new_device(struct btd_device *device,
hogdev->id = id;
hogdev->device = btd_device_ref(device);
+ device_get_name(device, name, sizeof(name));
+ if (strlen(name) > 0)
+ hogdev->name = g_strdup(name);
return hogdev;
}
@@ -751,6 +758,7 @@ static void hog_free_device(struct hog_device *hogdev)
g_slist_free_full(hogdev->reports, report_free);
g_attrib_unref(hogdev->attrib);
g_free(hogdev->hog_primary);
+ g_free(hogdev->name);
g_free(hogdev);
}
--
1.9.0.rc1.175.g0b1dcb5
next reply other threads:[~2014-02-19 7:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-19 7:40 Petri Gynther [this message]
2014-02-19 15:25 ` [PATCHv5] hog: Use HoG device name as uHID input device name Johan Hedberg
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=20140219074018.B736F1005F0@puck.mtv.corp.google.com \
--to=pgynther@google.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