Thread: Opening a specific USB device.

  1. #1
    Registered User
    Join Date
    Nov 2001
    Posts
    47

    Opening a specific USB device.

    Hello PPl,

    some time ago i've seen a cool way to open a serial port.

    handle = CreateFile ("COM1" ....) ;

    Is there a similar way to open a specifc USB driver / device.

    handle = CreateFile ("USB1" ...);
    doesn't work.

    Any suggestions ? :-)

    Regards,
    Robert

    Regards,
    Robert

  2. #2
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    As far as I know USB doesnt support this....

    There will probably be another option....what are you trying to do?

  3. #3
    Registered User
    Join Date
    Nov 2001
    Posts
    47
    I'm trying to open a driver for a specific device that
    are driven by usbio.sys driver form thesycon.

    Currently i'm about to enumerate all devices over the ports,
    begining like that:

    Code:
    FOR ..
           wsprintf(HCName, "\\\\.\\HCD%d", HCNum);
            hHCDev = CreateFile(HCName,
                                GENERIC_WRITE,
                                FILE_SHARE_WRITE,
                                NULL,
                                OPEN_EXISTING,
                                0,
                                NULL);
    
          if HCDDev != INVALID_HANDLE_VALUE
    
                            OpenRootHub etc.

    Sorry for that ugly pseudo code but, that is how im making it.

    Here is an output what my code produces.

    Host Controller Device 0: HCD0
    HCD Driver Name Length: 24
    HCD Driver Name: USB\0000
    RootHub Name length: 116
    RootHub Name: 0000000000000002#{f18a0e88-c30c-11d0-8815-00a0c906bed8}
    Opening RootHub: \\.\0000000000000002#{f18a0e88-c30c-11d0-8815-00a0c906bed8}
    Anzahl der Geräte am HUB: 3
    ROOT:
    Dev: 1 >Device Connected
    Dev: 2 >No device
    Dev: 3 >No device

    Host Controller Device 1: HCD1
    HCD Driver Name Length: 24
    HCD Driver Name: USB\0001
    RootHub Name length: 116
    RootHub Name: 0000000000000003#{f18a0e88-c30c-11d0-8815-00a0c906bed8}
    Opening RootHub: \\.\0000000000000003#{f18a0e88-c30c-11d0-8815-00a0c906bed8}
    Anzahl der Geräte am HUB: 3
    ROOT:
    Dev: 1 >Device Connected
    Dev: 2 >No device
    Dev: 3 >No device
    >



    I just want to skip this part and open a driver directly.
    Not scanning over all connected devices to the HCD.

    Hope it's not too confusing.

    Regards,
    Robert

  4. #4
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,380
    For USB communication you could try the free USB driver from Thesycon, note that its the lite-version, but its a nice thing to use when learning USB.

    www.thesycon.de/usbio/eng/usbio.htm

  5. #5
    Registered User
    Join Date
    Nov 2001
    Posts
    47
    Shiro

    thanks, i'm using the Thesycon driver, but when i want
    to open the driver by static name, as decribed:
    #define DEVICE_NAME "blblb" withn the source there,
    i cannt obtain a handle.


    Thanks to all for help!

    Regards,
    Robert

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Interacting with USB device
    By AKalair in forum C Programming
    Replies: 2
    Last Post: 02-20-2008, 02:07 PM
  2. How to talk to PIC PLC or any other device thru USB
    By jabka in forum Networking/Device Communication
    Replies: 9
    Last Post: 10-01-2007, 02:31 PM
  3. Device Driver: sysfs confusion
    By filker0 in forum Linux Programming
    Replies: 0
    Last Post: 12-02-2005, 11:36 AM
  4. Replies: 4
    Last Post: 06-30-2004, 03:11 PM
  5. how can i detect usb device?
    By orcher in forum C++ Programming
    Replies: 2
    Last Post: 06-13-2002, 09:00 PM