* [PATCH v2] hid2hci: fix regression in /dev format after moving away from libusb
@ 2013-10-03 11:03 Giovanni Campagna
2013-11-04 16:37 ` Vinicius Costa Gomes
2013-11-04 18:11 ` Johan Hedberg
0 siblings, 2 replies; 3+ messages in thread
From: Giovanni Campagna @ 2013-10-03 11:03 UTC (permalink / raw)
To: linux-bluetooth
From: Giovanni Campagna <gcampagna@src.gnome.org>
The paths under /dev, in the default udev configuration, are formatted
with two leading zeros, but the number obtained from sysfs don't have
them, so we must convert them to integers and reformat them.
---
tools/hid2hci.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/tools/hid2hci.c b/tools/hid2hci.c
index bb8a521..95b4abf 100644
--- a/tools/hid2hci.c
+++ b/tools/hid2hci.c
@@ -221,18 +221,21 @@ static int usb_switch_dell(int fd, enum mode mode)
static int find_device(struct udev_device *udev_dev)
{
char path[PATH_MAX];
- const char *busnum, *devnum;
+ const char *busnum_str, *devnum_str;
+ int busnum, devnum;
int fd;
- busnum = udev_device_get_sysattr_value(udev_dev, "busnum");
- if (!busnum)
+ busnum_str = udev_device_get_sysattr_value(udev_dev, "busnum");
+ if (!busnum_str)
return -1;
+ busnum = strtol(busnum_str, NULL, 10);
- devnum = udev_device_get_sysattr_value(udev_dev, "devnum");
- if (!devnum)
+ devnum_str = udev_device_get_sysattr_value(udev_dev, "devnum");
+ if (!devnum_str)
return -1;
+ devnum = strtol(devnum_str, NULL, 10);
- snprintf(path, sizeof(path), "/dev/bus/usb/%s/%s", busnum, devnum);
+ snprintf(path, sizeof(path), "/dev/bus/usb/%03d/%03d", busnum, devnum);
fd = open(path, O_RDWR, O_CLOEXEC);
if (fd < 0) {
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] hid2hci: fix regression in /dev format after moving away from libusb
2013-10-03 11:03 [PATCH v2] hid2hci: fix regression in /dev format after moving away from libusb Giovanni Campagna
@ 2013-11-04 16:37 ` Vinicius Costa Gomes
2013-11-04 18:11 ` Johan Hedberg
1 sibling, 0 replies; 3+ messages in thread
From: Vinicius Costa Gomes @ 2013-11-04 16:37 UTC (permalink / raw)
To: Giovanni Campagna; +Cc: linux-bluetooth
Hi,
On 13:03 Thu 03 Oct, Giovanni Campagna wrote:
> From: Giovanni Campagna <gcampagna@src.gnome.org>
>
> The paths under /dev, in the default udev configuration, are formatted
> with two leading zeros, but the number obtained from sysfs don't have
> them, so we must convert them to integers and reformat them.
> ---
> tools/hid2hci.c | 15 +++++++++------
> 1 file changed, 9 insertions(+), 6 deletions(-)
Ack.
Cheers,
--
Vinicius
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] hid2hci: fix regression in /dev format after moving away from libusb
2013-10-03 11:03 [PATCH v2] hid2hci: fix regression in /dev format after moving away from libusb Giovanni Campagna
2013-11-04 16:37 ` Vinicius Costa Gomes
@ 2013-11-04 18:11 ` Johan Hedberg
1 sibling, 0 replies; 3+ messages in thread
From: Johan Hedberg @ 2013-11-04 18:11 UTC (permalink / raw)
To: Giovanni Campagna; +Cc: linux-bluetooth
Hi Giovanni,
On Thu, Oct 03, 2013, Giovanni Campagna wrote:
> The paths under /dev, in the default udev configuration, are formatted
> with two leading zeros, but the number obtained from sysfs don't have
> them, so we must convert them to integers and reformat them.
> ---
> tools/hid2hci.c | 15 +++++++++------
> 1 file changed, 9 insertions(+), 6 deletions(-)
Applied. Thanks.
Johan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-11-04 18:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-03 11:03 [PATCH v2] hid2hci: fix regression in /dev format after moving away from libusb Giovanni Campagna
2013-11-04 16:37 ` Vinicius Costa Gomes
2013-11-04 18:11 ` Johan Hedberg
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.