[prev in list] [next in list] [prev in thread] [next in thread] 

List:       libusb-devel
Subject:    Re: [libusb] libusb_get_device_list() is stale and does not refresh
From:       Sam Jaeschke <sam.jaeschke () maptek ! com ! au>
Date:       2016-07-24 23:33:28
Message-ID: CAE5u+hFnDt06MYKQhrOtOwA3Xs9Kxp1kGQRxh0miTaKs18ZosQ () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Nevermind... reconfigured the library to disable udev support and rebuilt,
and it all works as expected!

// #define HAVE_LIBUDEV
// #define HAVE_LIBUDEV_H
// #define USE_UDEV

On 20 July 2016 at 11:35, Sam Jaeschke <sam.jaeschke@maptek.com.au> wrote:

> For extra info, here is my reduced program code:
>
>
> #include <libusb/libusb.h>
>
> #include <iostream>
>
> #include <unistd.h>
>
> void FindDevices(libusb_context* Context)
> {
>   libusb_device** deviceList;
>   const int32_t deviceCount = libusb_get_device_list(Context, &deviceList);
>   if (deviceCount < 0)
>   {
>     std::cout << "Error: Unable to get USB device list: "
>               << libusb_strerror(static_cast<libusb_error>(deviceCount))
>               << std::endl;
>     return;
>   }
>
>   for (uint32_t d = 0; d < static_cast<uint32_t>(deviceCount); ++d)
>   {
>     libusb_device* device = deviceList[d];
>     libusb_device_descriptor descriptor;
>     libusb_error result =
>       static_cast<libusb_error>(libusb_get_device_descriptor(device,
>                                                              &descriptor));
>     if (result != LIBUSB_SUCCESS)
>     {
>       std::cout << "Error: Unable to get USB device descriptor: "
>                 << libusb_strerror(result) << std::endl;
>       return;
>     }
>     std::cout << "  Vendor " << descriptor.idVendor << "  Product "
>               << descriptor.idProduct << std::endl;
>     std::cout << "  device id " <<
> int32_t(libusb_get_device_address(device))
>               << std::endl;
>   }
>   libusb_free_device_list(deviceList, 1);
> }
>
> int main()
> {
>   libusb_context* context = nullptr;
>   const libusb_error result =
>     static_cast<libusb_error>(libusb_init(nullptr));
>   if (result != LIBUSB_SUCCESS)
>   {
>     std::cout << "Error: Unable to initialise libusb: "
>               << libusb_strerror(result)
>               << std::endl;
>     return 0;
>   }
>   libusb_set_debug(context, LIBUSB_LOG_LEVEL_DEBUG);
>
>   FindDevices(context);
>
>   sleep(10);
>
>   FindDevices(context);
>
>   libusb_exit(context);
>   return 0;
> }
>
>
> > g++ -c -std=c++14 -isystem<LIBUSBPATH>/libusb1/include test_usb.cpp
> > g++ test_usb.o <LIBUSBPATH>/libusb1/lib/libusb1.a
> <LIBUSBPATH>/systemd/lib/libsystemd_libudev.a
> <LIBUSBPATH>/systemd/lib/libsystemd_shared.a -lpthread -o test_usb
>
> (This behaves the same whether I call libusb_init() with nullptr or
> &context.)
>
>
>
> *** USB disk not plugged in ***
>
> [timestamp] [threadID] facility level [function call] <message>
>
> --------------------------------------------------------------------------------
> [ 0.004025] [00000410] libusb: debug [libusb_get_device_list]
> [ 0.004168] [00000410] libusb: debug [libusb_get_device_descriptor]
>   Vendor AAAA  Product AAAA
>   device id 4
> [ 0.004425] [00000410] libusb: debug [libusb_get_device_descriptor]
>   Vendor BBBB  Product BBBB
>   device id 1
>
> *** Plug USB disk in ***
>
> [ 4573.553613] usb 1-1.4: new high-speed USB device number 7 using ci_hdrc
> [ 4573.665662] usb-storage 1-1.4:1.0: USB Mass Storage device detected
> [ 4573.682193] scsi host2: usb-storage 1-1.4:1.0
> [ 4574.684643] scsi 2:0:0:0: Direct-Access     SanDisk  Ultra Fit
>  1.00 PQ: 0 ANSI: 6
> [ 4574.694109] sd 2:0:0:0: Attached scsi generic sg0 type 0
> [ 4574.699445] sd 2:0:0:0: [sda] 121438208 512-byte logical blocks: (62.1
> GB/57.9 GiB)
> [ 4574.708366] sd 2:0:0:0: [sda] Write Protect is off
> [ 4574.713862] sd 2:0:0:0: [sda] Write cache: disabled, read cache:
> enabled, doesn't support DPO or FUA
> [ 4574.755483]  sda: sda1
> [ 4574.760713] sd 2:0:0:0: [sda] Attached SCSI removable disk
> ...
> [10.004588] [00000410] libusb: debug [libusb_get_device_list]
> [10.004680] [00000410] libusb: debug [libusb_get_device_descriptor]
>   Vendor AAAA  Product AAAA
>   device id 4
> [10.004756] [00000410] libusb: debug [libusb_get_device_descriptor]
>   Vendor BBBB  Product BBBB
>   device id 1
> [10.004813] [00000410] libusb: debug [libusb_exit]
> [10.004834] [00000410] libusb: debug [libusb_exit] destroying default
> context
>
>
> It was not noticed by libusb.
>
>
>
>
>
> *** Try again, keeping the USB disk in ***
>
> [timestamp] [threadID] facility level [function call] <message>
>
> --------------------------------------------------------------------------------
> [ 0.005216] [00000425] libusb: debug [libusb_get_device_list]
> [ 0.005366] [00000425] libusb: debug [libusb_get_device_descriptor]
>   Vendor CCCC  Product CCCC (USBDISK)
>   device id 7
> [ 0.005621] [00000425] libusb: debug [libusb_get_device_descriptor]
>   Vendor AAAA  Product AAAA
>   device id 4
> [ 0.005674] [00000425] libusb: debug [libusb_get_device_descriptor]
>   Vendor BBBB  Product BBBB
>   device id 1
>
> ** Unplug USB disk ***
>
> [ 4594.489214] usb 1-1.4: USB disconnect, device number 7
> ...
> [10.005832] [00000425] libusb: debug [libusb_get_device_list]
> [10.005926] [00000425] libusb: debug [libusb_get_device_descriptor]
>   Vendor CCCC  Product CCCC (USBDISK)
>   device id 7
> [10.006004] [00000425] libusb: debug [libusb_get_device_descriptor]
>   Vendor AAAA  Product AAAA
>   device id 4
> [10.006060] [00000425] libusb: debug [libusb_get_device_descriptor]
>   Vendor BBBB  Product BBBB
>   device id 1
> [10.006108] [00000425] libusb: debug [libusb_exit]
> [10.006129] [00000425] libusb: debug [libusb_exit] destroying default
> context
>
> libusb still thinks it is there.
>
>
>
> Am I using the library correctly?
> Did I build the library incorrectly or configure it incorrectly?
> Is this commonly encountered?
>
> Cheers, Sam
>
>
> On 18 July 2016 at 15:57, Sam Jaeschke <sam.jaeschke@maptek.com.au> wrote:
>
>> Hi,
>>
>> I'm using libusb_get_device_list() to discover attached USB devices,
>> which does work on the first call, but the second call never refreshes the
>> list of devices, and always returns the same list contents. This is
>> obviously a big problem! The only workaround is to use libusb_init() /
>> libusb_exit() around the cluster of libusb calls to refresh it, but that is
>> ugly and undesirable.
>>
>>
>> Output with LIBUSB_LOG_LEVEL_DEBUG:
>>
>>
>> *** First, don't attach USB disk. ***
>>
>> [timestamp] [threadID] facility level [function call] <message>
>>
>> --------------------------------------------------------------------------------
>> [ 0.011622] [00000479] libusb: debug [libusb_get_device_list]
>> [ 0.011851] [00000479] libusb: debug [libusb_get_device_descriptor]
>>   <DEVICE A>
>>   device id 2
>> [ 0.012045] [00000479] libusb: debug [libusb_get_device_descriptor]
>>   <DEVICE B>
>>   device id 1
>> USB disk present: 0
>>
>> *** Attach USB disk here ***
>>
>> [  578.446649] usb 1-1.4: new high-speed USB device number 7 using ci_hdrc
>> [  578.558873] usb-storage 1-1.4:1.0: USB Mass Storage device detected
>> [  578.575495] scsi host4: usb-storage 1-1.4:1.0
>> [  579.587555] scsi 4:0:0:0: Direct-Access     SanDisk  Ultra Fit
>>  1.00 PQ: 0 ANSI: 6
>> [  579.597158] sd 4:0:0:0: Attached scsi generic sg0 type 0
>> [  579.602668] sd 4:0:0:0: [sda] 121438208 512-byte logical blocks: (62.1
>> GB/57.9 GiB)
>> [  579.612141] sd 4:0:0:0: [sda] Write Protect is off
>> [  579.617631] sd 4:0:0:0: [sda] Write cache: disabled, read cache:
>> enabled, doesn't support DPO or FUA
>> [  579.659281]  sda: sda1
>> [  579.664504] sd 4:0:0:0: [sda] Attached SCSI removable disk
>> ....
>> [ 9.823734] [00000479] libusb: debug [libusb_get_device_list]
>> [ 9.823929] [00000479] libusb: debug [libusb_get_device_descriptor]
>>   <DEVICE A>
>>   device id 2
>> [ 9.824056] [00000479] libusb: debug [libusb_get_device_descriptor]
>>   <DEVICE B>
>>   device id 1
>> USB disk present: 0
>>
>>
>> It did not find the newly inserted USB disk device (device id 7).
>>
>>
>> Keep the USB disk in, and try again:
>>
>> [timestamp] [threadID] facility level [function call] <message>
>>
>> --------------------------------------------------------------------------------
>> [ 0.013379] [0000049b] libusb: debug [libusb_get_device_list]
>> [ 0.013609] [0000049b] libusb: debug [libusb_get_device_descriptor]
>>   <DEVICE C: USB DISK>
>>   device id 7
>> [ 0.013808] [0000049b] libusb: debug [libusb_get_config_descriptor] index
>> 0
>> USB disk present: 1
>>
>> *** Remove USB disk here ***
>>
>> [  596.446067] usb 1-1.4: USB disconnect, device number 7
>> ....
>> [ 5.416610] [0000049b] libusb: debug [libusb_get_device_list]
>> [ 5.416744] [0000049b] libusb: debug [libusb_get_device_descriptor]
>>   <DEVICE C: USB DISK>
>>   device id 7
>> [ 5.416848] [0000049b] libusb: debug [libusb_get_config_descriptor] index
>> 0
>> USB disk present: 1
>>
>>
>> It didn't notice that this USB disk device was removed (device id 7).
>>
>>
>>
>> Yes, I do call libusb_free_config_descriptor(*descriptor) at the end of
>> processing each descriptor.
>> And I do call libusb_free_device_list(**list, 1) at the end of processing
>> the list.
>>
>> Note that I do save my context from libusb_init, and pass that in
>> everywhere instead of NULL. This is for the future possibility of using
>> multiple contexts (which isn't yet done).
>> As you can see from the output, I'm not using libusb_open().
>>
>>
>> I'm using:
>> libusb 1.0.19
>> Linux kernel 4.4
>>
>> #define HAVE_LIBUDEV 1
>> #define HAVE_LIBUDEV_H 1
>> #define HAVE_LINUX_NETLINK_H 1
>> #define OS_LINUX 1
>> #define USE_UDEV 1
>>
>>
>> Surely I'm missing something that should make this work... can anyone
>> give some insight on this?
>>
>> Cheers, Sam
>>
>>
>> --
>> Sam Jaeschke
>> Maptek | Software Engineer
>>
>> 63 Conyngham Street, Glenside, SA 5065, Australia
>> Tel: +61-8 8338 9222 | Dir: +61-8 8338 9265 | Fax: +61-8 8338 9229
>> sam.jaeschke@maptek.com.au | www.maptek.com
>>
>> Keep up to date with Maptek in our Forge <http://www.maptek.com/forge>
>> newsletter
>>
>
>
>
> --
> Sam Jaeschke
> Maptek | Software Engineer
>
> 63 Conyngham Street, Glenside, SA 5065, Australia
> Tel: +61-8 8338 9222 | Dir: +61-8 8338 9265 | Fax: +61-8 8338 9229
> sam.jaeschke@maptek.com.au | www.maptek.com
>
> Keep up to date with Maptek in our Forge <http://www.maptek.com/forge>
> newsletter
>



-- 
Sam Jaeschke
Maptek | Software Engineer

63 Conyngham Street, Glenside, SA 5065, Australia
Tel: +61-8 8338 9222 | Dir: +61-8 8338 9265 | Fax: +61-8 8338 9229
sam.jaeschke@maptek.com.au | www.maptek.com

Keep up to date with Maptek in our Forge <http://www.maptek.com/forge>
newsletter

[Attachment #5 (text/html)]

<div dir="ltr">Nevermind... reconfigured the library to disable udev support and \
rebuilt, and it all works as expected!<div><br></div><div><div \
style="font-size:12.8px">// #define HAVE_LIBUDEV<br></div><div \
style="font-size:12.8px">// #define HAVE_LIBUDEV_H<br></div><div \
style="font-size:12.8px"><span style="font-size:12.8px">// #define \
USE_UDEV</span><br></div></div></div><div class="gmail_extra"><br><div \
class="gmail_quote">On 20 July 2016 at 11:35, Sam Jaeschke <span dir="ltr">&lt;<a \
href="mailto:sam.jaeschke@maptek.com.au" \
target="_blank">sam.jaeschke@maptek.com.au</a>&gt;</span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div dir="ltr">For extra info, here is my reduced program \
code:<div><br></div><div><div><br></div><div>#include \
&lt;libusb/libusb.h&gt;</div><div><br></div><div>#include \
&lt;iostream&gt;</div><div><br></div><div>#include \
&lt;unistd.h&gt;</div><div><br></div><div>void FindDevices(libusb_context* \
Context)</div><div>{</div><div>   libusb_device** deviceList;</div><div>   const \
int32_t deviceCount = libusb_get_device_list(Context, &amp;deviceList);</div><div>   \
if (deviceCount &lt; 0)</div><div>   {</div><div>      std::cout &lt;&lt; \
&quot;Error: Unable to get USB device list: &quot;</div><div>                     \
&lt;&lt; libusb_strerror(static_cast&lt;libusb_error&gt;(deviceCount))</div><div>     \
&lt;&lt; std::endl;</div><div>      return;</div><div>   }</div><div><br></div><div>  \
for (uint32_t d = 0; d &lt; static_cast&lt;uint32_t&gt;(deviceCount); \
++d)<br></div><div>   {</div><div>      libusb_device* device = \
deviceList[d];</div><div>      libusb_device_descriptor descriptor;</div><div>      \
libusb_error result =</div><div>         \
static_cast&lt;libusb_error&gt;(libusb_get_device_descriptor(device,</div><div>       \
&amp;descriptor));</div><div>      if (result != LIBUSB_SUCCESS)</div><div>      \
{</div><div>         std::cout &lt;&lt; &quot;Error: Unable to get USB device \
descriptor: &quot;</div><div>                        &lt;&lt; libusb_strerror(result) \
&lt;&lt; std::endl;</div><div>         return;</div><div>      }</div><div>      \
std::cout &lt;&lt; &quot;   Vendor &quot; &lt;&lt; descriptor.idVendor &lt;&lt; \
&quot;   Product &quot;</div><div>                     &lt;&lt; descriptor.idProduct \
&lt;&lt; std::endl;</div><div>      std::cout &lt;&lt; &quot;   device id &quot; \
&lt;&lt; int32_t(libusb_get_device_address(device))</div><div>                     \
&lt;&lt; std::endl;</div><div>   }</div><div>   libusb_free_device_list(deviceList, \
1);</div><div>}</div><div><br></div><div>int main()</div><div>{</div><div>   \
libusb_context* context = nullptr;</div><div>   const libusb_error result \
=</div><div>      static_cast&lt;libusb_error&gt;(libusb_init(nullptr));</div><div>   \
if (result != LIBUSB_SUCCESS)</div><div>   {</div><div>      std::cout &lt;&lt; \
&quot;Error: Unable to initialise libusb: &quot;</div><div>                     \
&lt;&lt; libusb_strerror(result)</div><div>                     &lt;&lt; \
std::endl;</div><div>      return 0;</div><div>   }</div><div>   \
libusb_set_debug(context, LIBUSB_LOG_LEVEL_DEBUG);</div><div><br></div><div>   \
FindDevices(context);</div><div><br></div><div>   \
sleep(10);</div><div><br></div><div>   \
FindDevices(context);</div><div><br></div><div>   libusb_exit(context);</div><div>   \
return 0;</div><div>}</div></div><div><br></div><div><br></div><div><div>&gt; g++ -c \
-std=c++14 -isystem&lt;LIBUSBPATH&gt;/libusb1/include test_usb.cpp</div><div>&gt; g++ \
test_usb.o &lt;LIBUSBPATH&gt;/libusb1/lib/libusb1.a \
&lt;LIBUSBPATH&gt;/systemd/lib/libsystemd_libudev.a \
&lt;LIBUSBPATH&gt;/systemd/lib/libsystemd_shared.a -lpthread -o \
test_usb</div></div><div><br></div><div>(This behaves the same whether I call \
libusb_init() with nullptr or \
&amp;context.)</div><div><br></div><div><br></div><div><br></div><div>*** USB disk \
not plugged in ***</div><div><br></div><div><span class=""><div>[timestamp] \
[threadID] facility level [function call] \
&lt;message&gt;</div><div>--------------------------------------------------------------------------------</div></span><div>[ \
0.004025] [00000410] libusb: debug [libusb_get_device_list]</div><div>[ 0.004168] \
[00000410] libusb: debug [libusb_get_device_descriptor]</div><div>   Vendor AAAA   \
Product AAAA</div><div>   device id 4</div><div>[ 0.004425] [00000410] libusb: debug \
[libusb_get_device_descriptor]</div><div>   Vendor BBBB   Product BBBB</div><div>   \
device id 1</div><div><br></div><div>*** Plug USB disk in \
***</div><div><br></div><div>[ 4573.553613] usb 1-1.4: new high-speed USB device \
number 7 using ci_hdrc</div><div>[ 4573.665662] usb-storage 1-1.4:1.0: USB Mass \
Storage device detected</div><div>[ 4573.682193] scsi host2: usb-storage \
1-1.4:1.0</div><div>[ 4574.684643] scsi 2:0:0:0: Direct-Access       SanDisk   Ultra \
Fit            1.00 PQ: 0 ANSI: 6</div><div>[ 4574.694109] sd 2:0:0:0: Attached scsi \
generic sg0 type 0</div><div>[ 4574.699445] sd 2:0:0:0: [sda] 121438208 512-byte \
logical blocks: (62.1 GB/57.9 GiB)</div><div>[ 4574.708366] sd 2:0:0:0: [sda] Write \
Protect is off</div><div>[ 4574.713862] sd 2:0:0:0: [sda] Write cache: disabled, read \
cache: enabled, doesn&#39;t support DPO or FUA</div><div>[ 4574.755483]   sda: \
sda1</div><div>[ 4574.760713] sd 2:0:0:0: [sda] Attached SCSI removable \
disk</div><div>...</div><div>[10.004588] [00000410] libusb: debug \
[libusb_get_device_list]</div><div>[10.004680] [00000410] libusb: debug \
[libusb_get_device_descriptor]</div><div>   Vendor AAAA   Product AAAA</div><div>   \
device id 4</div><div>[10.004756] [00000410] libusb: debug \
[libusb_get_device_descriptor]</div><div>   Vendor BBBB   Product BBBB</div><div>   \
device id 1</div><div>[10.004813] [00000410] libusb: debug \
[libusb_exit]</div><div>[10.004834] [00000410] libusb: debug [libusb_exit] destroying \
default context</div><div><br></div><div><br></div><div>It was not noticed by \
libusb.</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div>*** \
Try again, keeping the USB disk in ***</div><span \
class=""><div><br></div><div>[timestamp] [threadID] facility level [function call] \
&lt;message&gt;</div><div>--------------------------------------------------------------------------------</div></span><div>[ \
0.005216] [00000425] libusb: debug [libusb_get_device_list]</div><div>[ 0.005366] \
[00000425] libusb: debug [libusb_get_device_descriptor]</div><div>   Vendor CCCC   \
Product CCCC (USBDISK)</div><div>   device id 7</div><div>[ 0.005621] [00000425] \
libusb: debug [libusb_get_device_descriptor]</div><div>   Vendor AAAA   Product \
AAAA</div><div>   device id 4</div><div>[ 0.005674] [00000425] libusb: debug \
[libusb_get_device_descriptor]</div><div>   Vendor BBBB   Product BBBB</div><div>   \
device id 1</div><div><br></div><div>** Unplug USB disk \
***</div><div><br></div><div>[ 4594.489214] usb 1-1.4: USB disconnect, device number \
7</div><div>...</div><div>[10.005832] [00000425] libusb: debug \
[libusb_get_device_list]</div><div>[10.005926] [00000425] libusb: debug \
[libusb_get_device_descriptor]</div><div>   Vendor CCCC   Product CCCC \
(USBDISK)</div><div>   device id 7</div><div>[10.006004] [00000425] libusb: debug \
[libusb_get_device_descriptor]</div><div>   Vendor AAAA   Product AAAA</div><div>   \
device id 4</div><div>[10.006060] [00000425] libusb: debug \
[libusb_get_device_descriptor]</div><div>   Vendor BBBB   Product BBBB</div><div>   \
device id 1</div><div>[10.006108] [00000425] libusb: debug \
[libusb_exit]</div><div>[10.006129] [00000425] libusb: debug [libusb_exit] destroying \
default context</div></div><div><br></div><div>libusb still thinks it is \
there.</div><div><br></div><div><br></div><div><br></div><div>Am I using the library \
correctly?</div><div>Did I build the library incorrectly or configure it \
incorrectly?</div><div>Is this commonly encountered?</div><div><br></div><div>Cheers, \
Sam</div><div><br></div></div><div class="HOEnZb"><div class="h5"><div \
class="gmail_extra"><br><div class="gmail_quote">On 18 July 2016 at 15:57, Sam \
Jaeschke <span dir="ltr">&lt;<a href="mailto:sam.jaeschke@maptek.com.au" \
target="_blank">sam.jaeschke@maptek.com.au</a>&gt;</span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>I&#39;m using  \
libusb_get_device_list() to discover attached USB devices, which does work on the \
first call, but the second call never refreshes the list of devices, and always \
returns the same list contents. This is obviously a big problem! The only workaround \
is to use libusb_init() / libusb_exit() around the cluster of libusb calls to refresh \
it, but that is ugly and undesirable.</div><div><br></div><div><br></div><div>Output \
with LIBUSB_LOG_LEVEL_DEBUG:</div><div><br></div><div><br></div><div>*** First, \
don&#39;t attach USB disk. ***</div><div><br></div><div><div>[timestamp] [threadID] \
facility level [function call] \
&lt;message&gt;<br></div><div>--------------------------------------------------------------------------------</div><div>[ \
0.011622] [00000479] libusb: debug [libusb_get_device_list]</div><div>[ 0.011851] \
[00000479] libusb: debug [libusb_get_device_descriptor]</div><div>   &lt;DEVICE \
A&gt;</div><div>   device id 2</div><div>[ 0.012045] [00000479] libusb: debug \
[libusb_get_device_descriptor]</div><div>   &lt;DEVICE B&gt;</div><div>   device id \
1</div><div>USB disk present: 0</div><div><br></div><div>*** Attach USB disk here \
***</div><div><br></div><div>[   578.446649] usb 1-1.4: new high-speed USB device \
number 7 using ci_hdrc<br></div><div>[   578.558873] usb-storage 1-1.4:1.0: USB Mass \
Storage device detected</div><div>[   578.575495] scsi host4: usb-storage \
1-1.4:1.0</div><div>[   579.587555] scsi 4:0:0:0: Direct-Access       SanDisk   Ultra \
Fit            1.00 PQ: 0 ANSI: 6</div><div>[   579.597158] sd 4:0:0:0: Attached scsi \
generic sg0 type 0</div><div>[   579.602668] sd 4:0:0:0: [sda] 121438208 512-byte \
logical blocks: (62.1 GB/57.9 GiB)</div><div>[   579.612141] sd 4:0:0:0: [sda] Write \
Protect is off</div><div>[   579.617631] sd 4:0:0:0: [sda] Write cache: disabled, \
read cache: enabled, doesn&#39;t support DPO or FUA</div><div>[   579.659281]   sda: \
sda1</div><div>[   579.664504] sd 4:0:0:0: [sda] Attached SCSI removable \
disk</div><div>....</div><div>[ 9.823734] [00000479] libusb: debug \
[libusb_get_device_list]<br></div><div>[ 9.823929] [00000479] libusb: debug \
[libusb_get_device_descriptor]</div><div>   &lt;DEVICE A&gt;</div><div>   device id \
2</div><div>[ 9.824056] [00000479] libusb: debug \
[libusb_get_device_descriptor]</div><div>   &lt;DEVICE B&gt;</div><div>   device id \
1</div><div>USB disk present: 0</div></div><div><br></div><div><br></div><div>It did \
not find the newly inserted USB disk device (device id \
7).</div><div><br></div><div><br></div><div>Keep the USB disk in, and try \
again:</div><div><br></div><div><div>[timestamp] [threadID] facility level [function \
call] &lt;message&gt;</div><div>--------------------------------------------------------------------------------</div><div>[ \
0.013379] [0000049b] libusb: debug [libusb_get_device_list]</div><div>[ 0.013609] \
[0000049b] libusb: debug [libusb_get_device_descriptor]</div><div>   &lt;DEVICE C: \
USB DISK&gt;</div><div>   device id 7</div><div>[ 0.013808] [0000049b] libusb: debug \
[libusb_get_config_descriptor] index 0</div><div>USB disk present: \
1</div><div><br></div><div><div>*** Remove USB disk here \
***</div></div><div><br></div><div>[   596.446067] usb 1-1.4: USB disconnect, device \
number 7<br></div><div>....</div><div>[ 5.416610] [0000049b] libusb: debug \
[libusb_get_device_list]<br></div><div>[ 5.416744] [0000049b] libusb: debug \
[libusb_get_device_descriptor]</div><div>   &lt;DEVICE C: USB DISK&gt;</div><div>   \
device id 7</div><div>[ 5.416848] [0000049b] libusb: debug \
[libusb_get_config_descriptor] index 0</div><div>USB disk present: \
1</div></div><div><br></div><div><br></div><div>It didn&#39;t notice that this USB \
disk device was removed (device id \
7).</div><div><br></div><div><br></div><div><br></div><div>Yes, I do call \
libusb_free_config_descriptor(*descriptor) at the end of processing each \
descriptor.</div><div>And I do call libusb_free_device_list(**list, 1) at the end of \
processing the list.</div><div><br></div><div>Note that I do save my context from \
libusb_init, and pass that in everywhere instead of NULL. This is for the future \
possibility of using multiple contexts (which isn&#39;t yet done).</div><div>As you \
can see from the output, I&#39;m not using \
libusb_open().</div><div><br></div><div><br></div><div>I&#39;m \
using:</div><div>libusb 1.0.19</div><div>Linux kernel 4.4<br \
clear="all"><div><br></div><div><div>#define HAVE_LIBUDEV 1<br></div><div>#define \
HAVE_LIBUDEV_H 1<br></div><div>#define HAVE_LINUX_NETLINK_H 1<br></div><div>#define \
OS_LINUX 1<br></div><div>#define USE_UDEV \
1<br></div></div><div><br></div><div><br></div><div>Surely I&#39;m missing something \
that should make this work... can anyone give some insight on \
this?</div><div><br></div><div>Cheers, Sam</div><span><font \
color="#888888"><div><br></div><div><br></div>-- <br><div \
data-smartmail="gmail_signature"><div dir="ltr">Sam Jaeschke<br>Maptek | Software \
Engineer<br><br>63 Conyngham Street, Glenside, SA 5065, Australia<br>Tel: <a \
href="tel:%2B61-8%208338%209222" value="+61883389222" target="_blank">+61-8 8338 \
9222</a> | Dir: <a href="tel:%2B61-8%208338%209265" value="+61883389265" \
target="_blank">+61-8 8338 9265</a> | Fax: <a href="tel:%2B61-8%208338%209229" \
value="+61883389229" target="_blank">+61-8 8338 9229</a><br><a \
href="mailto:sam.jaeschke@maptek.com.au" \
target="_blank">sam.jaeschke@maptek.com.au</a> | <a href="http://www.maptek.com" \
target="_blank">www.maptek.com</a><div><br></div><div>Keep up to date with Maptek in \
our <a href="http://www.maptek.com/forge" target="_blank">Forge \
</a>newsletter</div></div></div> </font></span></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div \
data-smartmail="gmail_signature"><div dir="ltr">Sam Jaeschke<br>Maptek | Software \
Engineer<br><br>63 Conyngham Street, Glenside, SA 5065, Australia<br>Tel: <a \
href="tel:%2B61-8%208338%209222" value="+61883389222" target="_blank">+61-8 8338 \
9222</a> | Dir: <a href="tel:%2B61-8%208338%209265" value="+61883389265" \
target="_blank">+61-8 8338 9265</a> | Fax: <a href="tel:%2B61-8%208338%209229" \
value="+61883389229" target="_blank">+61-8 8338 9229</a><br><a \
href="mailto:sam.jaeschke@maptek.com.au" \
target="_blank">sam.jaeschke@maptek.com.au</a> | <a href="http://www.maptek.com" \
target="_blank">www.maptek.com</a><div><br></div><div>Keep up to date with Maptek in \
our <a href="http://www.maptek.com/forge" target="_blank">Forge \
</a>newsletter</div></div></div> </div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div \
class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Sam \
Jaeschke<br>Maptek | Software Engineer<br><br>63 Conyngham Street, Glenside, SA 5065, \
Australia<br>Tel: +61-8 8338 9222 | Dir: +61-8 8338 9265 | Fax: +61-8 8338 9229<br><a \
href="mailto:sam.jaeschke@maptek.com.au" \
target="_blank">sam.jaeschke@maptek.com.au</a> | <a href="http://www.maptek.com" \
target="_blank">www.maptek.com</a><div><br></div><div>Keep up to date with Maptek in \
our <a href="http://www.maptek.com/forge" target="_blank">Forge \
</a>newsletter</div></div></div> </div>



------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports.http://sdm.link/zohodev2dev

_______________________________________________
libusb-devel mailing list
libusb-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusb-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic