Results 1 to 20 of 47

Thread: Windows USB example

Hybrid View

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

    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......

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    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.


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

    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..............

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

    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

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

    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 20:22.

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

    galrub (9th February 2012)

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

    Thumbs up Re: Windows USB example

    Quote Originally Posted by stringer View Post
    Try to use this libraries and demos: microchip.com


    Added after 6 minutes:




    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 
    well, it's just a part of the issue, I just realized that the USB hub for the front panel of this PC is, well, not a very 'well built' one,
    so this is why I get the wParam = 7, I tried using the USB socket in the back... no problem there.
    thanks.
    Last edited by galrub; 9th February 2012 at 22:55.

  8. #7
    Join Date
    Jan 2009
    Location
    Midlands UK
    Posts
    62
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    6
    Thanked 9 Times in 6 Posts

    Default Re: Windows USB example

    Hi All,

    I've followed this thread with great interest and with Gavagai's very usefull initial sourcefiles and everyone else's additions I finally managed to get a working usb interface between my PIC 4550 chip and a pc. I've attached my sources for both ends of the link so that others might find them useful. I also added some extra error trapping to make my life easier.

    Note the PIC end is on a Mikroelectronica EasyPIC4 board using their C Pro software.
    Attached Files Attached Files

  9. #8
    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.

  10. #9
    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)

  11. #10
    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

  12. #11
    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

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
  •  
Qt is a trademark of The Qt Company.