Automatically detecting a USB device


Closed Thread
Results 1 to 10 of 10
  1. #1
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,598

    Default Automatically detecting a USB device

    Hi,

    I want an executable to start up whenever a specified USB device is connected. Is that done with a windows INF file? And if so, any idea on how to go about doing that?

    Robert
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898

    Default

    i would guess that you can load and hide a VB application using the Mecanique HID library, then somewhere in the HIDdetect event(or something like that), reading the according infos and launch your application if it match.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #3
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,598

    Default

    zooooooooooooooooooo.........

    That's the sound of all that information passing right over my head.

    Robert
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  4. #4
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898

    Default

    begin slow, create a running application in VB with HID maker. Then scroll in the code onto the ...
    Code:
    '*****************************************************************
    ' a HID device has been plugged in...
    '*****************************************************************
    Public Sub OnPlugged(ByVal pHandle As Long)
    Dim DeviceHandle As Long
       If hidGetVendorID(pHandle) = VendorID And hidGetProductID(pHandle) = ProductID Then
        ' Here you have a perfect match of the pre-define USB device
          
          
          ' ** YOUR CODE HERE **
       End If
    End Sub
    Do you still hae the VB PDFs i think i already sent you? If not let me know... soon 'cause i have to go in few minutes.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  5. #5
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,598

    Default

    Ah, yes, I saw that in the code that was generated when I was looking at it in VB.

    I won't be able to test that until I get the proper cap and have the device recognized. I have a box full of VCR circuits and other crap and I can't find it.

    I hope this doesn't mean I have to clean my basement...

    Robert
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  6. #6
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898

    Default

    if you have some amplifier or else audio, look close to the input/output jack. Some use 0.47uF (470nf) ... TADA!

    Now, i have to trash out serious car radio stuff. if you're interested.. it will be free. it takes too much room in here and i'll probably never use them as spare parts. I plan to close the repair shop in few months/days
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  7. #7
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,598

    Default

    Quote Originally Posted by mister_e
    i would guess that you can load and hide a VB application using the Mecanique HID library, then somewhere in the HIDdetect event(or something like that), reading the according infos and launch your application if it match.
    What happens when you connect a USB mouse in Windows XP? How does it know to start a Logitech software? That's what I'm after.

    Robert
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  8. #8
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898

    Default

    From what i feel, all driver should run in background, when they detect the right USB device, they run the program

    I know it doesn't help

    Be back later...
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  9. #9
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,598

    Default

    Yeah, I know I could do that. I probably will have to, but I'm sure there's a more efficient way to do this.

    When you plug a USB device, XP will ask you for a driver to associate with it if it doesn't have one already. I'd like to do this like the pros if I can.

    Robert
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  10. #10
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898

    Default

    sure but as far as i know, there's no commercial stuff who launch an application automatically like that... as i know so far. Usually when you first connect your device it will send you to the software and/or driver installation plahplah.. not much... oh well i can't know every USB device on the market so far so i can be wrong.

    So you don't have any other choice to run something in background. I mean a little few Kbs application wich you add to the Windows Registry list (run, Runonce or else) wich just monitor the VendorId or whatever else, then once you got a match it launch the main application.

    Maybe there's other much elegant way.. now i don't know
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. USB CDC Communications for Dummies!
    By Squibcakes in forum USB
    Replies: 104
    Last Post: - 15th January 2014, 13:43
  2. USB Bootloader.
    By HenrikOlsson in forum USB
    Replies: 22
    Last Post: - 2nd May 2013, 02:46
  3. Simple USB Comms Problem
    By awmt102 in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 6th January 2010, 20:17
  4. USB Device Not Recognized ???
    By keymuu in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 8th October 2008, 00:53
  5. usb - device not recognised
    By mpardinho in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 8th January 2007, 17:47

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts