How to get data from USB device?
Hi, I'm kind of confused on how to get data from usb devices, more specifically a data logger. I guess first off can this be done using c#? I've really never had the pleasure of low-level programming, so I have no clue where to start or how to begin. Thank you.
[271 byte] By [
chobo] at [2007-11-20 10:53:59]

# 1 Re: How to get data from USB device?
i would begin with this search
http://www.google.dk/search?source=ig&hl=da&q=c%23+access+usb+driver+device&btnG=Google-s%C3%B8gning&meta=lr%3Dlang_da%7Clang_en
it gave results like
http://www.thescripts.com/forum/thread234362.html
http://www.thescripts.com/forum/thread238621.html
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=301007&SiteID=1
http://www.thesycon.de/eng/usbio.shtml
# 2 Re: How to get data from USB device?
Sadly I have seen all those links + about 10 pages of search results on this forum. I wish this kind of information was just sticked in one place, I read one thread and the go to another and there is conflicting information, I don't know what to believe.
Could someone be so kind as to answer some or all of these questions (no links to anything... )
1. Is there a c# api or library for working with USB at the user-mode level?
2. Can c# make calls at the kernel level, or do you need to interact with c or c++ programs for that?
3. Can you use some of the windows usb drivers to access the usb device and send/receive data to it?
4. What is the simplest way to work with USB in c#?
Thanks
chobo at 2007-11-9 11:37:05 >

# 3 Re: How to get data from USB device?
wihtout having worked with it
i dont think usb work like old serial
where one would just link to a com port and start using it
as a buffer to write bytes in and depending on what
was connected the device did as one would want it to
acording to the serial protocol of the device
i think usb are more like old pci and the likes
where
one have to get really down and dirty and write the device driver oneself
(this cant be on in c# i belive) and is pretty low lvl even for c++
or get a stub device driver with the device one have to connect to
which got an api with protocol and commands
often eks. of code for simple things too
often both for c++, c# and even delphi
# 4 Re: How to get data from USB device?
All the devices i've seen on USB in this way, usually emulate something else.. you plug a USB datacable in for your phone, and some circuits in the cable emulate a serial port, your computer suddenly gains a COM15 port and you read/write that to communicate with the phone..
Are you sure that nothing like this is done? it sounds like your datalogger is missing some drivers
cjard at 2007-11-9 11:39:11 >

# 5 Re: How to get data from USB device?
I don't have the logger with me, but it either had its own USB driver or was using one of the windows ones.
I'm going to assume the device has a driver (its own) or a windows one, so I shouldn't have to write a device driver, since it does work with their software? This is where I get confused, can I use the existing drivers that came with the device? If I can could this all be done with just c#? If so, where to begin?
Sorry for all the questions, I never thought something like USB would be such a pain, I moved from JAVA to c# thinking this would be a lot easier... ironically I made more progress with JAVA...
chobo at 2007-11-9 11:40:10 >

# 6 Re: How to get data from USB device?
you need some dll to connect to get to any sort of respond
if you dont you have to depend on ms's dll's to give you
commands to access a device maybe thats possible
if it's a generic driver
think that doing any sort of actions with hardware would be
harder with java then c# at least on the windows platform