1 Feb 2012 01:21
Re: saving enumerated devices
Zak Escano <zak <at> dxeltd.com>
2012-02-01 00:21:50 GMT
2012-02-01 00:21:50 GMT
Thanks Vitali, that's what I ended up doing.
I wasn't after an automated way of detecting changes between scans, I just wanted to know how I could differentiate between devices over different scans, handling devices being added and removed. After reading through the source of libusb-win32 I decided that saving the "filename" of each device externally and comparing that after a rescan was the only safe way to do so.
On Tue, Jan 31, 2012 at 5:40 PM, Vitali Lovich <vlovich <at> gmail.com> wrote:
You can also just set up a timer to poll. But yes - you're likely to
get garbage with libusb-win32. You should be able to use the file
path within the device structure in libusb-win32 as the cookie to use
to find devices between scans.
-Vitali
On Fri, Jan 27, 2012 at 2:20 AM, Xiaofan Chen <xiaofanc <at> gmail.com> wrote:
> On Wed, Jan 25, 2012 at 6:59 AM, Zak Escano <zak <at> dxeltd.com> wrote:
>> I do want to use libusb-win32, I am not so concerned about hot-plugging, I
>> just want to user to be able to plug in the device after starting the app,
>> without having to close and restart the app. In my app I will show a list of
>> devices in the gui and have a button near the list allowing to "rescan for
>> devices" if the user notices their device isn't on the list and so plugs in
>> their device.
>
> It that case, you probably want to use setupapi (out of libusb-win32)
> to handle the task.
>
> There are examples here which shows how how to use
> RegisterDeviceNotification and WM_DEVICE_CHANGE
> messages to detect when a device is attached or removed.
> http://www.lvr.com/hidpage.htms
>
>
> --
> Xiaofan
>
> ------------------------------------------------------------------------------
> Try before you buy = See our experts in action!
> The most comprehensive online learning library for Microsoft developers
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-dev2
> _______________________________________________
> Libusb-win32-devel mailing list
> Libusb-win32-devel <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/libusb-win32-devel
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developershttp://p.sf.net/sfu/learndevnow-d2d
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
_______________________________________________
Libusb-win32-devel mailing list
Libusb-win32-devel <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusb-win32-devel
------------------------------------------------------------------------------ Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________ Libusb-win32-devel mailing list Libusb-win32-devel <at> lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libusb-win32-devel
RSS Feed