bluez/03-Fix-return-code-of-hid2hci.patch

56 lines
1.4 KiB
Diff
Raw Permalink Normal View History

2012-08-06 16:25:12 +04:00
diff -Nur bluez-4.93.orig/tools/hid2hci.c bluez-4.93/tools/hid2hci.c
--- bluez-4.93.orig/tools/hid2hci.c 2011-05-03 12:20:36.000000000 +0400
+++ bluez-4.93/tools/hid2hci.c 2012-08-06 16:23:21.211963738 +0400
@@ -240,7 +240,7 @@
enum mode mode = HCI;
const char *devpath = NULL;
int err = -1;
- int rc = 1;
+ int rc = 0;
for (;;) {
int option;
@@ -288,13 +288,16 @@
}
udev = udev_new();
- if (udev == NULL)
- goto exit;
+ if (udev == NULL) {
+ rc = errno;
+ goto exit;
+ }
snprintf(syspath, sizeof(syspath), "%s/%s", udev_get_sys_path(udev), devpath);
udev_dev = udev_device_new_from_syspath(udev, syspath);
if (udev_dev == NULL) {
fprintf(stderr, "error: could not find '%s'\n", devpath);
+ rc = errno;
goto exit;
}
@@ -312,6 +315,7 @@
dev = udev_device_get_parent_with_subsystem_devtype(dev, "usb", "usb_device");
if (dev == NULL) {
fprintf(stderr, "error: could not find usb_device for '%s'\n", devpath);
+ rc = errno;
goto exit;
}
}
@@ -320,6 +324,7 @@
if (handle == NULL) {
fprintf(stderr, "error: unable to handle '%s'\n",
udev_device_get_syspath(dev));
+ rc = errno;
goto exit;
}
err = usb_switch(handle, mode);
@@ -331,6 +336,7 @@
device = udev_device_get_devnode(udev_dev);
if (device == NULL) {
fprintf(stderr, "error: could not find hiddev device node\n");
+ rc = errno;
goto exit;
}
err = hid_switch_logitech(device);