From: Kristof Robot <krirobo@gmail.com>
Date: Sun, 8 Dec 2013 14:46:50 +0000 (+0100)
Subject: kinect_upload_fw: fix setting configuration for some devices
X-Git-Tag: v0.4~13
X-Git-Url: https://git.ao2.it/kinect-audio-setup.git/commitdiff_plain/6e31aa17271f90a443591719089688bbf2040765?hp=6e31aa17271f90a443591719089688bbf2040765

kinect_upload_fw: fix setting configuration for some devices

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.
---