Hi,
2011/6/7 Cristian Ionescu-Idbohrn <[email protected]>:
> On Mon, 6 Jun 2011, Cristian Ionescu-Idbohrn wrote:
>>
>> I hope this message will reach Marcel too, as it identifies bugs in the
>> upstream code.
>>
>> On Mon, 6 Jun 2011, Cristian Ionescu-Idbohrn wrote:
>> >
>> > I'd like to get this problem out of the way. What can I do to help?
>
> [snip]
>
> Alright. I took the magic wand, Peter Hurley handed over here:
>
> http://comments.gmane.org/gmane.linux.bluez.kernel/13457
>
> (patch for the upstream scripts/bluetooth-hid2hci.rules) which solves the
> two major problems (runs the /lib/udev/rules.d/62-bluez-hid2hci.rules,
> including hid2hci and making the hci0 device available).
This patch mean , if device is hidraw, change of device is failed.
But if device is hiddev, change of deice already is success.
OK?
Marcel, why do you apply this patch ?
>
> This:
>
>> Still, hid2hci returns status code failure:
>>
>> exit_group(1) = ?
>>
>> This is another bug :(
>>
>> int rc = 1;
I attached patch that revised this.
I will send to upsream.
Nobuhiro
--
Nobuhiro Iwamatsu
iwamatsu at {nigauri.org / debian.org}
GPG ID: 40AD1FA6
diff --git a/tools/hid2hci.c b/tools/hid2hci.c
index 45a3a3d..ba4aea4 100644
--- a/tools/hid2hci.c
+++ b/tools/hid2hci.c
@@ -240,7 +240,7 @@ int main(int argc, char *argv[])
enum mode mode = HCI;
const char *devpath = NULL;
int err = -1;
- int rc = 1;
+ int rc = 0;
for (;;) {
int option;
@@ -288,13 +288,16 @@ int main(int argc, char *argv[])
}
udev = udev_new();
- if (udev == NULL)
+ if (udev == NULL) {
+ rc = ENOMEM;
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 = ENODEV;
goto exit;
}
@@ -312,6 +315,7 @@ int main(int argc, char *argv[])
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 = ENODEV;
goto exit;
}
}
@@ -320,6 +324,7 @@ int main(int argc, char *argv[])
if (handle == NULL) {
fprintf(stderr, "error: unable to handle '%s'\n",
udev_device_get_syspath(dev));
+ rc = EBADF;
goto exit;
}
err = usb_switch(handle, mode);
@@ -331,6 +336,7 @@ int main(int argc, char *argv[])
device = udev_device_get_devnode(udev_dev);
if (device == NULL) {
fprintf(stderr, "error: could not find hiddev device node\n");
+ rc = ENODEV;
goto exit;
}
err = hid_switch_logitech(device);