Ports
May 23, 2013, 05:32:28 am *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: SMF - Just Installed!
 
   Home   Help Search Login Register  
Welcome to the PORTS Forum. Please post your questions, answers, and comments relating to USB and other hardware interfaces in the appropriate forums below. - Jan
Pages: [1]
  Print  
Author Topic: Access to multiple devices with same VID and PID  (Read 997 times)
vineetrvce
Member
*
Posts: 2


« on: May 23, 2012, 07:16:48 am »

Hello,
  I am able to access my embedded PIC device with the .NET app. But when I connect 2 devices, then there are issues accessing the 2 USB devices.

The problem is that whenever the 2nd device is inserted, i notice an addition in the device path name.

But how to ensure the the handle i get for the second device should be from the 2 device path name and not the first.
The call to get the handle is below:

hidHandle[hid_index] = FileIO.CreateFile(myDevicePathName, FileIO.GENERIC_READ | FileIO.GENERIC_WRITE, FileIO.FILE_SHARE_READ | FileIO.FILE_SHARE_WRITE, IntPtr.Zero, FileIO.OPEN_EXISTING, 0, 0);


Please suggest!

Thanks,
Vineet.
Logged
Jan Axelson
Administrator
Frequent Contributor
*****
Posts: 1629


WWW
« Reply #1 on: May 23, 2012, 09:36:07 am »

Open the handle with exclusive access and you won't be able to get a handle the next time around.

Jan
Logged
vineetrvce
Member
*
Posts: 2


« Reply #2 on: May 24, 2012, 11:51:17 pm »

 Thanks Jan, it worked!
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!