|
From: Robert R. <R.R...@Qu...> - 2021-09-22 16:18:35
|
Hi Matthias, At 06:08 PM 9/22/2021 +0200, Matthias Bolte wrote: >Am Mi., 22. Sept. 2021 um 17:10 Uhr schrieb Robert Ritchey ><R.R...@qu...>: > > > > Hi Matthias, > > I wish to apologize for a misstatement I made. See below > > > > At 11:18 AM 9/22/2021 +0200, Matthias Bolte wrote: > > >Am Mi., 22. Sept. 2021 um 03:38 Uhr schrieb Xiaofan Chen > <xia...@gm...>: > > > > > > > > On Wed, Sep 22, 2021 at 7:37 AM Robert Ritchey > > > > <R.R...@qu...> wrote: > > > > > > > > > > >A few things to check: > > > > > >- Why are you only checking the vendor ID before opening the device? > > >You should check the product ID too to avoid trying to open the wrong > > >device. > > > > You are right, I do not check the Product ID before opening. > > > > I guess since this is my Vendor ID and I intend to use this for a number > > of devices (which device is checked elsewhere in the code) I did not see a > > reason to restrict the USB code to look for specific Product IDs. My > > products range with an ID of 1 - 127 and the test fixtures are numbered > > from 128 - 255. I guess I could check this range but why would another > > device have my Vendor ID and if it did, they could have a Product ID in > > the range of 1 -255 anyway. > >Not everybody has their own VID these days. There were times where you >could buy a single PID without owning a full VID. That's why I'm >asking. Also are you sure that all your future USB devices with that >VID will be compatible with libusb? So there's a bit of future >proofing as well. I missed that you check the PID later on but only >after you already opened the device. I doubt I will be doing this for more than 5 more years so I don't see any reason why the devices I develop between now and then will not be compatible. I guess I am not sure why the would not be? In the code I posted, I save the handle, VID, PID and SN to a structure and I pass a pointer to that structure back to the other code to determine what to do with that PID. Thanks for your insights. I am going to try the newest version of the lib to see if it makes any difference. >Regards >Matthias -Bob -------------------------------------------------------------------- Robert Ritchey Quest Engineering & Development, Inc. Suite B-8 6125 South Ash Avenue Tempe, AZ 85283 Tel: (480) 460-2652 -------------------------------------------------------------------- |