learning about USB

I have decided that I would like to (try) to write a block-level device driver
for the USB Compact Flash reader that I have (SanDisk ImageMate SDDR-31). Of
course, I haven’t poked around with USB before, so I know very little about it
at this point.

So far I have managed to start up the USB protocol stack on my machine, and
have written a simple program that gets the insertion and removal callbacks
from the protocol stack.

Now I am stuck. I’ve been trying to follow the DDK docs, and they assume
that I know one hell of a lot more than I actually do. Under the section
titled “How a class driver works”, I am on “2.2 Get descriptors”. This is
where my [lack of] knowledge fails me. I can’t make head nor tails out of
the usbd_descriptor() function call and what I actually need to ask for.

My assumption is that if I can get the damned thing to give me the same
information that the usb utility prints out, then I’ll have all the info
I need to actually DO something with the device plugged in.

Is the source for the usb utility available? Or can someone provide some
working code samples that are not overly complicated and inter-twined with
resmgr stuff (like the sample class drivers) are?

Cheers,
Camz.


Martin Zimmerman camz@passageway.com
Camz Software Enterprises www.passageway.com/camz/qnx/
QNX Programming & Consulting www.qnxzone.com

camz@passageway.com wrote:

I have decided that I would like to (try) to write a block-level device driver
for the USB Compact Flash reader that I have (SanDisk ImageMate SDDR-31). Of
course, I haven’t poked around with USB before, so I know very little about it
at this point.

So far I have managed to start up the USB protocol stack on my machine, and
have written a simple program that gets the insertion and removal callbacks
from the protocol stack.

Now I am stuck. I’ve been trying to follow the DDK docs, and they assume
that I know one hell of a lot more than I actually do. Under the section
titled “How a class driver works”, I am on “2.2 Get descriptors”. This is
where my [lack of] knowledge fails me. I can’t make head nor tails out of
the usbd_descriptor() function call and what I actually need to ask for.

My assumption is that if I can get the damned thing to give me the same
information that the usb utility prints out, then I’ll have all the info
I need to actually DO something with the device plugged in.

Is the source for the usb utility available? Or can someone provide some
working code samples that are not overly complicated and inter-twined with
resmgr stuff (like the sample class drivers) are?

Hi Martin

Keep me informed of your progress. I’m also a USB novice and would
like to learn what you learn.

What do you plan to address as your first USB device? It would be
great to have support for the USB IOmega Zip Drives.

Of course that leads to the question to QSSL:

What is the state of the Disk DDK now that 6.2.1 is out?

This is something that is badly needed.

camz@passageway.com wrote:

…snip …
Is the source for the usb utility available? Or can someone provide some
working code samples that are not overly complicated and inter-twined with
resmgr stuff (like the sample class drivers) are?

Cheers,
Camz.


Martin Zimmerman > camz@passageway.com
Camz Software Enterprises > www.passageway.com/camz/qnx/
QNX Programming & Consulting > www.qnxzone.com

Hi Martin -
Some time ago I did a simple USB code loader for the EZ-USB chip in a
MIDI
interface. You can find the code on my web site www.obtsoftware.ca -
down near the
bottom under Pro Bono software. This is obviously output only, and IIRC,
has no resmgr
stuff at all. If you have questions I’ll have to refresh my memory a
bit, but that’s OK.
I still haven’t gotten to the actual USB MIDI driver, though. (Peer
pressure or
financial incentives welcome :slight_smile: )
BTW, I have an IBM usb memory stick which is crying out for a driver.
I’d be happy
to work with someone on sussing out the block device stuff. I gave up on
waiting for QSSL
to do a block device DDK about a year after Neutrino 2.0 came out…
can’t remember how
long ago that was! As I recall, it was “still changing” and “not
sufficiently documented”.

Phil Olynyk
OBT Software Corp.

Phil Olynyk <pholynyk@rogers.com> wrote:

Some time ago I did a simple USB code loader for the EZ-USB chip in a
MIDI interface. You can find the code on my web site > www.obtsoftware.ca > -
down near the bottom under Pro Bono software.

Excellent, thank you… I’ve pulled down the code and am looking at it now.


BTW, I have an IBM usb memory stick which is crying out for a driver.
I’d be happy to work with someone on sussing out the block device stuff.

Sounds like a plan. I’m not sure about the block device stuff, nor am I
even sure that tying into the whold io-blk.so is even the best way to go.
I think that the very worst case is that we manage to manifest these things
as a file and then we should be able to mount those in a similiar manner to
how we mount a QFS file. That certainly reduces the resmgr complexity to
almost nothing.

We should meet on IRC sometime to disucss this!

Cheers,
Camz.


Martin Zimmerman camz@passageway.com
Camz Software Enterprises www.passageway.com/camz/qnx/
QNX Programming & Consulting www.qnxzone.com

Bill Caroselli <qtps@earthlink.net> wrote:

Keep me informed of your progress. I’m also a USB novice and would
like to learn what you learn.

I will do my best. I’ll try to submit suggestions to the QNX Doc
group too, since improving the docs benefits everyone.

What do you plan to address as your first USB device? It would be
great to have support for the USB IOmega Zip Drives.

I’ve got a SanDisk ImageMate Compact Flash reader (SDDR-31) that I
am going to try to get working.

What is the state of the Disk DDK now that 6.2.1 is out?

Last I heard, we were still waiting for io-cam, and the related docs
for it and io-blk. Those were the only missing pieces.

As I mentioned to Phil though, I’m not convinced that the current
arrangement of .so’s and binaries is the best way for things to be
done. I openly admit that my opinion is biased and the if I had
actual documentation on how those layers worked in the existing fsys
architecture, that I might change my mind.

Cheers,
Camz.


Martin Zimmerman camz@passageway.com
Camz Software Enterprises www.passageway.com/camz/qnx/
QNX Programming & Consulting www.qnxzone.com

<camz@passageway.com> wrote in message news:b49f4l$7a3$1@inn.qnx.com

I have decided that I would like to (try) to write a block-level device
driver
for the USB Compact Flash reader that I have (SanDisk ImageMate SDDR-31).
Of
course, I haven’t poked around with USB before, so I know very little
about it
at this point.

So far I have managed to start up the USB protocol stack on my machine,
and
have written a simple program that gets the insertion and removal
callbacks
from the protocol stack.

Well, that’s a good start.

Now I am stuck. I’ve been trying to follow the DDK docs, and they assume
that I know one hell of a lot more than I actually do.

If you are new to USB, I’d heartily recommend reading the USB specs and
familiarize yourself with them first. I’d also recommending reading the 1.1
specs rather than the 2.0 specs. The 1.1 specs contain most of the software
info you’ll need to know for typical embedded apps without the complexity of
the high-speed stuff that really complicates things. If you need high-speed
operation, read the 2.0 specs after you digest the 1.1 stuff.


Under the section
titled “How a class driver works”, I am on “2.2 Get descriptors”. This is
where my [lack of] knowledge fails me. I can’t make head nor tails out of
the usbd_descriptor() function call and what I actually need to ask for.

To be honest, storage class device drivers are among the more complex
class drivers in USB (there are worse, but the storage class is not where
I’d
start when learning USB, indeed, I wouldn’t start with class drivers at
all).


My assumption is that if I can get the damned thing to give me the same
information that the usb utility prints out, then I’ll have all the info
I need to actually DO something with the device plugged in.

Hopefully, you’re already familiar with the SCSI protocol, since USB
storage devices (usually) tunnel SCSI commands through the USB
packets.


Is the source for the usb utility available? Or can someone provide some
working code samples that are not overly complicated and inter-twined with
resmgr stuff (like the sample class drivers) are?

I heard QSSL is working on a storage class driver.
Of course, there are the Linux sources, but they have Linux file manager
junk intertwined (and suffer from GPL, poor documentation, etc., etc.).
Cheers,
Randy Hyde

Randall Hyde <randall.nospam.hyde@ustraffic.net> wrote:

If you are new to USB, I’d heartily recommend reading the USB specs and
familiarize yourself with them first. I’d also recommending reading the 1.1
specs rather than the 2.0 specs. The 1.1 specs contain most of the software
info you’ll need to know for typical embedded apps without the complexity of
the high-speed stuff that really complicates things. If you need high-speed
operation, read the 2.0 specs after you digest the 1.1 stuff.

Excellent suggestion, I was googling for some information on the net about
these things and everything came up short on details. I did download the 1.1
spec but have not yet looked at it. I will now.

As for that high-speed USB 2 crap, I hope to never use it and would always
choose firewire over USB2.


To be honest, storage class device drivers are among the more complex
class drivers in USB (there are worse, but the storage class is not where
I’d start when learning USB, indeed, I wouldn’t start with class drivers at
all).

Well, techinically, I don’t care about making a class driver, I’ll be happy
with a driver that can read and write blocks (not files) to/from the specific
unit that I have.

Hopefully, you’re already familiar with the SCSI protocol, since USB
storage devices (usually) tunnel SCSI commands through the USB
packets.

Somewhat, I’ve never had to do much with it, until now. :slight_smile:

The source that Phil provided was great, it got me much farthur than the
actual DDK docs did. I was able to duplicate most of the output of the
USB command (at least for my device) and now have a bit better understanding
of how things work in the world of USB. That should hopefully make reading
the 1.1 spec easier too.

I heard QSSL is working on a storage class driver.

I have heard similiar rumors, and I am eagerly anticipating it. The USB DDK
has been around for a long time now, with its start in qnx4, it’s almost
embarrasing that it has taken this long (QNX 6.2.1) to finally have USB mouse
and keyboards auto-detected. I think that there is tremendous demand out
there for USB mass-storage devices (since USB keyrings are now becoming quite
common), as well as for USB networking hardware. Those two areas of USB
are where QNX desperately needs more support.

Of course, there are the Linux sources, but they have Linux file manager
junk intertwined (and suffer from GPL, poor documentation, etc., etc.).

I’ve tried to look at some of those, and man…

Cheers,
Camz.


Martin Zimmerman camz@passageway.com
Camz Software Enterprises www.passageway.com/camz/qnx/
QNX Programming & Consulting www.qnxzone.com