Results 1 to 20 of 35

Thread: How to get vendor id and product id of a USB device on windows system

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2010
    Posts
    48
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    4

    Default Re: How to get vendor id and product id of a USB device on windows system

    . . . .
    Last edited by newb; 31st May 2010 at 15:39.

  2. #2
    Join Date
    Apr 2010
    Posts
    48
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    4

    Default Re: How to get vendor id and product id of a USB device on windows system

    Hi...

    the application comes and prints this

    "\\?\usb#vid_04f2&pid_0111#5&1ba5a77f&0&2#{a5dcbf1 0-6530-11d2-901f-00c04fb951ed}"

    again it goes to while loop ....

    here it gets breaked in the else statement...

    Qt Code:
    1. if (GetLastError() == ERROR_INSUFFICIENT_BUFFER)
    2. {
    3. // Change the buffer size.
    4. if (buffer) LocalFree(buffer);
    5.  
    6. buffer = (LPTSTR)LocalAlloc(LPTR,buffersize);
    7.  
    8. }
    9.  
    10. else
    11. {
    12. qDebug ()<<"Here it quits the application";
    13.  
    14. // Insert error handling here.
    15. break;
    16.  
    17. }
    To copy to clipboard, switch view to plain text mode 

    Any ideas in this....
    Last edited by newb; 31st May 2010 at 12:49.

  3. #3
    Join Date
    Apr 2010
    Posts
    48
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    4

    Default Re: How to get vendor id and product id of a USB device on windows system

    Hello Qt Experts....

    Kindly guide me on my problem...

  4. #4
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    6
    Thanked 348 Times in 333 Posts

    Default Re: How to get vendor id and product id of a USB device on windows system

    Say, did you write that code or copy it from somewhere? As you don't seem to understand how it works?

    Secondly, why are you expecting the call to fail with an insufficient buffer error code? Surely having a sufficient buffer size is a good thing, rather than a bad one?

  5. #5
    Join Date
    Apr 2010
    Posts
    48
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    4

    Default Re: How to get vendor id and product id of a USB device on windows system

    Actually i want to get the vendor id and product id of a usb device which is get plugged....

    i searched for Qt related implementation but i don seem to get any sample source code .

    So i searched forums and links for that..

    so i referred the links and followed the code they have used ..

    Any ideas

  6. #6
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    6
    Thanked 348 Times in 333 Posts

    Default Re: How to get vendor id and product id of a USB device on windows system

    Ok, well if you use what I say in post #8, that will tell you when a device is plugged/unplugged, which seems to be what you want.

    If you google it, there will no doubt be lots of other people who have used it, and thus example code.

Similar Threads

  1. Get the product/device name using QT library?
    By predatorz in forum Newbie
    Replies: 3
    Last Post: 14th January 2010, 04:53
  2. Vendor and Model Name from USB Devices
    By NoRulez in forum Qt Programming
    Replies: 6
    Last Post: 20th July 2009, 10:01
  3. Replies: 1
    Last Post: 19th September 2008, 16:43
  4. Problem whis open device in Windows
    By Pavka in forum Qt Programming
    Replies: 3
    Last Post: 19th November 2007, 11:13
  5. Ho to get the windows system directory with Qt4
    By rmagro in forum Qt Programming
    Replies: 4
    Last Post: 30th August 2007, 14:30

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.