asUSB - Forum

Forum Navigation
You need to log in to create posts and topics.

asUSB

How do you know which device is inserted?

There are Subroutines to detect both inserted and removed USB devices and the ComboBox list is updated accordingly with the device description. However,  if you insert a device with the same description as multiple other devices such as a USB Composite Device, how do you know which one you just inserted?

Sometimes Vendor_IDs change... What is the constant identifying variable for a device?

@pauljonestindall

Product_ID and Vendor_ID are stable, you can create desired device IDs from them. I have been using a program for more than a year that runs only if I have inserted the desired flash drive into the computer. The asUSBDevice plugin is used.

I attach a demo project. It is in Russian, but you can translate all the lines you need with an online translator, for example DeepL (https://www.deepl.com/translator).

 

Uploaded files:
  • You need to login to have access to uploads.
luishp has reacted to this post.
luishp

@vadim

Thanks for the demo. I wrote down the wrong ID variable when I was testing my code to see what if anything was changing. I think I'm on the same idea as you in your demo. Would be nice though to have an action or variable to tell you what the last inserted device is.

What I did was Loop through the device list at startup and create a single string variable of all the items on the list. Then in the "inserted" subroutine I Loop again with a SearchStr of my initial list variable. If it returns 0, I found the last inserted device.