From 0894f29828e47c615b671bfeff73785560c95e71 Mon Sep 17 00:00:00 2001 From: Antonio Ospite Date: Wed, 11 Dec 2013 12:37:19 +0100 Subject: [PATCH 1/1] debian/patches: add a patch to make kinect_upload_fw work with more devices --- ...ad_fw-fix-setting-configuration-for-some-.patch | 60 ++++++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 61 insertions(+) create mode 100644 debian/patches/0001-kinect_upload_fw-fix-setting-configuration-for-some-.patch create mode 100644 debian/patches/series diff --git a/debian/patches/0001-kinect_upload_fw-fix-setting-configuration-for-some-.patch b/debian/patches/0001-kinect_upload_fw-fix-setting-configuration-for-some-.patch new file mode 100644 index 0000000..aa2a8c8 --- /dev/null +++ b/debian/patches/0001-kinect_upload_fw-fix-setting-configuration-for-some-.patch @@ -0,0 +1,60 @@ +From 6e31aa17271f90a443591719089688bbf2040765 Mon Sep 17 00:00:00 2001 +From: Kristof Robot +Date: Sun, 8 Dec 2013 15:46:50 +0100 +Subject: [PATCH] kinect_upload_fw: fix setting configuration for some devices +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit +X-Face: z*RaLf`X<@C75u6Ig9}{oW$H;1_\2t5)({*|jhM/Vb;]yA5\I~93>J<_`<4)A{':UrE + +On some Kinect devices where the desired configuration is already the +currently active one libusb_set_configuration() fails in some way +causing the subsequent bulk transfer to fail, and the program to exit, +with this message: + + libusbx: error [op_set_configuration] failed, error -1 errno 110 + About to send: 09 20 02 06 01 00 00 00 60 00 00 00 00 00 00 00 15 00 00 00 00 00 00 00 + libusbx: error [submit_bulk_transfer] submiturb failed error -1 errno=2 + Error: res: -1    transferred: 0 (expected 24) + +Only set the desired configuration if it hasn't been set already. +This prevents the problems from above. + +Do the configuration check as illustrated in +http://libusbx.sourceforge.net/api-1.0/caveats.html that is by checking +that the current configuration is still the desired one after claiming +the device. +--- + kinect_upload_fw/kinect_upload_fw.c | 12 +++++++++++- + 1 file changed, 11 insertions(+), 1 deletion(-) + +diff --git a/kinect_upload_fw/kinect_upload_fw.c b/kinect_upload_fw/kinect_upload_fw.c +index b2188d6..e3b72db 100644 +--- a/kinect_upload_fw/kinect_upload_fw.c ++++ b/kinect_upload_fw/kinect_upload_fw.c +@@ -155,9 +155,19 @@ int main(int argc, char** argv) { + goto fail_libusb_open; + } + +- libusb_set_configuration(dev, 1); ++ int current_configuration = 0; ++ libusb_get_configuration(dev, ¤t_configuration); ++ if (current_configuration != 1) ++ libusb_set_configuration(dev, 1); ++ + libusb_claim_interface(dev, 0); + ++ libusb_get_configuration(dev, ¤t_configuration); ++ if (current_configuration != 1) { ++ res = -ENODEV; ++ goto cleanup; ++ } ++ + seq = 1; + + bootloader_command cmd; +-- +1.8.5.1 + diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 0000000..2cf5206 --- /dev/null +++ b/debian/patches/series @@ -0,0 +1 @@ +0001-kinect_upload_fw-fix-setting-configuration-for-some-.patch -- 2.1.4