Page 3 of 3 FirstFirst 123
Results 41 to 47 of 47

Thread: Windows USB example

  1. #41
    Join Date
    Feb 2012
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Windows USB example

    Hi All,
    After I found this example I was very happy and even before trying I modified it to match with my application... then I found out that device detection worked properly but write failed.
    I get a proper read and write handle, no errors at write, but... it seems to send nothing.

    I went back to the example changed nothing but MY_DEVICE_VIDPID and added a debug message after WriteFile to check BytesWritten
    It may be clear that the protocol to my device differs, but I should at least be able to send something even when it is wrong -- or not?
    If I only received an error would help already

    any ideas?
    Thanks

    ---
    BytesWritten always 0
    Last edited by Marc van der Kamp; 14th March 2012 at 08:37.

  2. #42
    Join Date
    Feb 2012
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Windows USB example

    Oops... inverted my error checking, WriteFile did give an error (87)

  3. #43
    Join Date
    Mar 2012
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Windows USB example

    Hi there,
    I have the same error..I am wondering if you managed to fix it!!
    Thanks

  4. #44
    Join Date
    Jul 2011
    Location
    Pune, India
    Posts
    21
    Thanks
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Windows USB example

    Quote Originally Posted by gavagai View Post
    Don't use the class GUID returned by device manager, it don't works. It is the device SETUP GUID class. We need the device INTERFACE GUID class (see http://msdn.microsoft.com/en-us/libr...(v=vs.85).aspx).
    Try this:
    - be sure that your device is installed and recognized in the system
    - start regedit and search for your vid&pid (VID_XXXX&PID_XXXX) in the following key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Contro l\DeviceClasses. You can get more of a result.
    - Try to use the parent class GUID where the descriptor starts with the type of device (##?#HID#VID... or ##?#IMAGE#VID...).
    For more informations see the examples in http://msdn.microsoft.com/en-us/library/ff551069.aspx

    Your device seems to be an image device. I do not know if endpoint size (InputBuffer and OutputBuffer size) is correct for this device. Depends on the driver.

    Good luck
    Hi gavagai,
    First of all thanks for the great upload.
    I am tryint to build qt application to detect a usb device(Not necessarily a HID) when plugged in.
    Now, i have two HIDs connected to my PC a keyboard and a mouse.
    how do i know which VID/PID is for which device? Coz its really confusing even when i navigate to registry location you mentioned above.
    how does HID differs from Mass storage device in terms of VID/PID?
    Just want to put me in the right direction.
    Thnx.

  5. #45
    Join Date
    Mar 2012
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Windows USB example

    Hi Marc van der Kamp,

    I am still getting error 87.. Have you fixed it ? I really need to make it work..
    Please help me..

    Many thanks

    Quote Originally Posted by Marc van der Kamp View Post
    Oops... inverted my error checking, WriteFile did give an error (87)
    Hi Marc van der Kamp,

    I am still getting error 87.. Have you fixed it ? I really need to make it work..
    Please help me..

    Many thanks

  6. #46
    Join Date
    Dec 2014
    Posts
    1
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: Windows USB example

    Thanks for great example. With Qt 5 you should use code like:

    To header:
    bool nativeEvent(const QByteArray & eventType, void * message, long *result);

    And to CPP:
    bool USBexample::nativeEvent(const QByteArray & eventType, void * message, long *result)
    {
    MSG* msg = reinterpret_cast<MSG*>(message);
    ...
    }

  7. #47
    Join Date
    Apr 2015
    Posts
    1
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Windows Android

    Default Re: Windows USB example

    Hi
    How i can get product name of HID device?
    Thanks

Similar Threads

  1. Replies: 2
    Last Post: 6th September 2010, 15:22
  2. Replies: 3
    Last Post: 12th July 2010, 07:25
  3. Program runs on Windows 7, crashes on Windows XP
    By JovianGhost in forum General Programming
    Replies: 8
    Last Post: 7th June 2010, 01:55
  4. Deployment Procedure On Windows On Linux and Windows
    By Harshith J.V. in forum Installation and Deployment
    Replies: 4
    Last Post: 9th July 2009, 12:27
  5. Replies: 10
    Last Post: 25th February 2007, 01:23

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.