Source Code for using a USB Stick

Hi,

I plan to use qnx for a new product which uses a pc104 board. One main feature has to be storing data on demand on a USB Memory Stick. The user plugs in the memory stick presses a key and data is transferred.

I have searched the forum for hints how to implement this in C/C++ but didn’t find anything. I only found how to implement the USB stack on the command line but using the command line is not suitable.

My (maybe nOOb) question ist:
Does anybody please give me hints how to code this or does anybody have a sample in C/C++ how to realize that?

Thanks for your help

I’m not sure what you mean by ‘using the command line is not suitable’. You can spawn a binary or shell script from your program to mount (and later unmount) the USB stick properly, and write to it. That’s all. Or not?

Ok, spawn is clear.

But how do I recogize that a USB stick was plugged in (or removed) and how do I get the device (like /dev/hd3)?

Does QNX suppport Your USB stick, and how it’s recognized (usb mass storage device or something special)? Try to connect USB stick and use ‘usb -vvvvvvvv’ utility - very useful info ;)

As I mentioned we haven’t started this project yet, so we haven’t selected any USB stick yet.

QNX doesn’t support so many USB sticks, be careful. We use SanDisk, they work fine, and some others too.

Automounting is buggy in current release of io-blk.so but we obtained an experimental patch some weeks ago that correctly mounts and unmounts the file system everytime the stick is plugged in / out. If you have actually purchased QNX, you can ask Tech support for that patch. I don’t know when it will be available commercially. Using the automount feature of io-blk.so is the cleanest solution, I believe.

Regards,
Albrecht

@albrecht:
Thanks for that hint.

You should be carefull with that kind of statements ;)

These posts tell a different story:
http://www.openqnx.com/index.php?name=PNphpBB2&file=viewtopic&t=5099
http://www.openqnx.com/index.php?name=PNphpBB2&file=viewtopic&t=3075

@LupusC:
You should search the forum to find a supported USB stick there are some posts stating “I use this XX stick”. But make sure to get exactly the one that is recommended, from my own experience I can tell you that my Kingston Data Traveller Elite 512MB does not work, but I think other Data Travellers (non Elite) do work, but these are just rumors.

You are probably better off installing QNX on a laptop, take it to the shop, and test the stick before you purchase it. (or you use a laptop with QNX in VMware just in case it won’t run on your machine ;) )