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

List:       libusb-devel
Subject:    Re: [libusb] Uniquely identify device during LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT
From:       David Grayson <davidegrayson () gmail ! com>
Date:       2017-10-30 16:33:33
Message-ID: CAJ127VzJMZdooYY0XRBefWSi3WnFN+_dOqmi6nyJ7oyytue2Kw () mail ! gmail ! com
[Download RAW message or body]

Ben,

Maybe libusb_get_port_numbers would be a good way to uniquely identify
your devices?  You would store the libusb_get_port_numbers result for
any of the devices your application cares about.  Then when you get a
hotplug notification, you re-enumerate all of the system's USB devices
and use libusb_get_port_numbers to see which ones are still there and
which have left.

--David

On Mon, Oct 30, 2017 at 9:01 AM, Tim Roberts <timr@probo.com> wrote:
> Ben Spoor wrote:
>> I have multiple devices with the same vendor and product id and thus
>> cannot purely distinguish on that.
>
> The CORRECT way to do this is to give each unit a unique serial number,
> and distinguish based on that.  Are you doing that?
>
>
>> * Is there a common pattern to uniquely identify a the device during a
>> LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT?
>
> There are few options.  In Windows, for example, the root event that
> notifies the system that something has changed tells you no more than
> that:  SOMETHING has changed, not WHAT has changed.
>
> --
> Tim Roberts, timr@probo.com
> Providenza & Boekelheide, Inc.
>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> libusb-devel mailing list
> libusb-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/libusb-devel

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
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