Page 1 of 2 12 LastLast
Results 1 to 20 of 47

Thread: Windows USB example

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2009
    Location
    Russia
    Posts
    309
    Thanks
    2
    Thanked 43 Times in 42 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Windows USB example

    aah, I understand, thank you.

  2. #2
    Join Date
    Mar 2011
    Posts
    10
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Windows USB example

    i can conect with USB, but when i open it ,so my computer is broke dow,, why such that??

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

    Default Re: Windows USB example

    Please rephrase. Don't understand.

  4. #4
    Join Date
    Mar 2011
    Posts
    10
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Windows USB example

    sorry, because my english is not good..i can connect this project with USB,but when i open this project ,my computer can't run.
    please help me!!

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Windows USB example

    You mean it reboots?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. The following 2 users say thank you to wysota for this useful post:

    caodungviet (28th April 2011), Gamer (12th October 2013)

  7. #6
    Join Date
    Mar 2011
    Posts
    10
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Windows USB example

    sorry but i can't understand how you can search HID_CLASSGUID {0x6bdd1fc6, 0x810f, 0x11d0,{ 0x08, 0x00, 0x2b, 0xe2, 0x09, 0x2f }},.everytime i have searched and i allway search "{a5dcbf10-6530-11d2-901f-00c04fb951ed}" with the another USB.
    please help me!! thanks
    Please give me the directions by images!!

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

    Default Re: Windows USB example

    I don't understand your question. This example is made for HID devices, a5dcbf10-6530-11d2-901f-00c04fb951ed is USB raw device ?

  9. #8
    Join Date
    Mar 2011
    Posts
    10
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Windows USB example

    sorry, i wrong. However how can you find PID and VID of a USB HID?? please help me!!

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

    Default Re: Windows USB example

    Use SetupDi API

  11. #10
    Join Date
    Aug 2011
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Windows USB example

    Hi there

    I'm a newbie in c++ programming, I'm doing my thesis and stealing code from here and there.... So thanks for the example first!

    I noted that the ReadThread is actually eating one CPU because it's in an endless loop, checking for events. I added a sleep statement that lets it run once per second and CPU usage dropped dramatically. Of course you lose responsiveness and you get a notification a second after the device is plugged in, but I don't think it's a major drawback.

    EDIT: My bad, I'm looking from the perspective of my device (a thermometer) that really doesn't run in realtime. Following joystick movement requires more frequent updates. Still some delay of 0.01sec won't be noticeable and should reduce CPU usage too.
    Attached Images Attached Images
    Last edited by bigblondewolf; 4th August 2011 at 19:20.

  12. #11
    Join Date
    Dec 2011
    Posts
    5
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Windows USB example

    Hi, all!
    First of all I want to tell "Thanks" for this example!
    Now I write project for using Magnetic Stripe Reader that recognized by Windows as USB HID Device:
    Qt Code:
    1. ##?#HID#VID_1136&PID_3003#6&2b575f1c&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
    To copy to clipboard, switch view to plain text mode 
    But in this example it always return INVALID_HANDLE_VALUE in usbexample.cpp:273 on:
    Qt Code:
    1. ReadHandle = CreateFile((DetailedInterfaceDataStructure->DevicePath), GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, 0);
    To copy to clipboard, switch view to plain text mode 
    And DevicePath is correct:
    Qt Code:
    1. qDebug() << QString::fromWCharArray(DetailedInterfaceDataStructure->DevicePath);
    To copy to clipboard, switch view to plain text mode 
    return
    Qt Code:
    1. \\?\hid#vid_1136&pid_3003#6&2b575f1c&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
    To copy to clipboard, switch view to plain text mode 

    What's wrong?
    Last edited by stringer; 21st December 2011 at 15:35.

  13. #12
    Join Date
    Jul 2010
    Location
    Ahmedabad,Gujarat,India
    Posts
    25
    Thanks
    14
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Windows

    Default Re: Windows USB example

    Hi stringer,

    try following code might it help's you.

    Qt Code:
    1. HANDLE hFile = CreateFile( DetailedInterfaceDataStructure->DevicePath, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL );
    To copy to clipboard, switch view to plain text mode 

  14. #13
    Join Date
    Nov 2011
    Location
    Bangalore
    Posts
    26
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60

    Post Re: Windows USB example

    i am trying to develop qt application using USB to control relay board..... I was trying this windows USB Example...
    always getting an error message " :: error: No rule to make target `../../qt/2010.05/qt/mkspecs/win32-g++/qmake.conf', needed by `makefile'. Stop." Can anyone please give suggestion how to recover from this error.........Is there any sample application available using USB in windows.....

  15. #14
    Join Date
    Nov 2011
    Location
    Bangalore
    Posts
    26
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60

    Smile Re: Windows USB example

    please reply to my post......can any one help me to overcome this problem.....

  16. #15
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Windows USB example

    Call qmake. This has nothing to do with USB.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  17. #16
    Join Date
    Nov 2011
    Location
    Bangalore
    Posts
    26
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60

    Smile Re: Windows USB example

    Please help me regarding this !!!!!!!!!!!!!... i have entered correct VID & PID for the device but this application is not showing the device connected......
    i tried to connect USB relay board which uses Microchip Pic 18 series.... I want to control those relays through USB......

  18. #17
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Windows USB example

    Are you sure your device is compliant with this example?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  19. #18
    Join Date
    Nov 2011
    Location
    Bangalore
    Posts
    26
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60

    Default Re: Windows USB example

    My device is getting connected with this app....... now the proble is that, wen am creating file ReadHandle and WriteHandle bot are getting value 0xffffffff...... i tried by changing the values but no use..... when i tried to display device path its showing correct only...... CreateFile function always returns 0xffffffff only..............

  20. #19
    Join Date
    May 2011
    Posts
    11
    Thanks
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Maemo/MeeGo

    Question Re: Windows USB example

    Hello, I am using this example and it seems to be recognizing my HID device just fine in the checkUSB(),
    but, in the winEvent I am getting wParam = 7 all the time, both when I connect or disconnect the device, so it doesn't catch these events:
    DBT_DEVICEARRIVAL = 0x8000 and DBT_DEVICEREMOVECOMPLETE = 0x8004.

    any ideas?
    Thanks

  21. #20
    Join Date
    Dec 2011
    Posts
    5
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Windows USB example

    My device is getting connected with this app....... now the proble is that, wen am creating file ReadHandle and WriteHandle bot are getting value 0xffffffff...... i tried by changing the values but no use..... when i tried to display device path its showing correct only...... CreateFile function always returns 0xffffffff only..............
    Try to use this libraries and demos: microchip.com


    Added after 6 minutes:


    Quote Originally Posted by galrub View Post
    Hello, I am using this example and it seems to be recognizing my HID device just fine in the checkUSB(),
    but, in the winEvent I am getting wParam = 7 all the time, both when I connect or disconnect the device, so it doesn't catch these events:
    DBT_DEVICEARRIVAL = 0x8000 and DBT_DEVICEREMOVECOMPLETE = 0x8004.

    any ideas?
    Thanks
    Try to add this line into .pro file:
    Qt Code:
    1. DEFINES += _WIN32_WINNT=0x0501
    To copy to clipboard, switch view to plain text mode 
    Last edited by stringer; 9th February 2012 at 19:22.

  22. The following user says thank you to stringer for this useful post:

    galrub (9th February 2012)

Similar Threads

  1. Replies: 2
    Last Post: 6th September 2010, 14:22
  2. Replies: 3
    Last Post: 12th July 2010, 06:25
  3. Program runs on Windows 7, crashes on Windows XP
    By JovianGhost in forum General Programming
    Replies: 8
    Last Post: 7th June 2010, 00: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, 11:27
  5. Replies: 10
    Last Post: 25th February 2007, 00: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.