USB

BlitzMax Forums/BlitzMax Programming/USB

Is it possible to communicate with a USB device in Blitz?

I'm starting to look at electronics for fun and wanted to make something simple like something that beeps when a key is pressed.

(Also a quick question for anyone who may have done something like this, would a driver need to be made for it to work?)

Thanks
Matt

Is it possible to communicate with a USB device in Blitz?
Not directly, no.

(Also a quick question for anyone who may have done something like this, would a driver need to be made for it to work?)
Probably. Unless your device can work with one of the standard drivers supplied with your OS of choice.

You'd be best looking at something like Nigel Brown's SerialIO module...

http://www.nigelibrown.pwp.blueyonder.co.uk/blitz/index.html

You'd be best looking at something like Nigel Brown's SerialIO module...
Except that won't work with USB ports, only RS232C type serial ports.

http://vertex.art-fx.org/GBA-Net.zip (sorry, bad code)

Communication between BMax and GBA Flashlinker.

You need a usb driver. This driver you open with CreateFile command(winapi, you get a handle of this driver). Now, you must know, what functions this driver support. This functions have a "IOControlCode".

You must use to communicate with this driver the DeviceIOControl function. You hand out the IOControlCode. You request goes to in-pointer, the answer will go in out-pointer. Request size as in-size, answer size as out-size. (Is like CallDLL in BlitzBASIC)

I don't know, if a usb driver support file streams like writef readf.

At the end, you must close the driver with CloseHandle.

cu olli

Vertex, could you please repost your code. I need to interface with an USB device and a working example would be real nice to have. I have the required hardware to do so ;)