I ve been told that it was very easy to program usb directly...

what I would like to do is to be able to use a mouse from something like dos, or just after bios gives the hand to the OS loader, so all I have is bios ints loaded... I ve seen some "ohch/uhci" (?) drivers working to install an int33h driver, but they dont work well...
I would want something _very simple_ , what would be best would be how to setup an irq that gives me the bytes of the mouse (movement, click...) .

Anyone knows?

I ve seen some pascal code for usb and it has huge initialisation procedures where you call bios PCI routines to detect billions of usb controllers... isnt there anything less specific and simplier that all motherboard undrstand with no extra features?

Help please , masters ! :)
(and if that could allow me to get the frames from an usb webcam that would be even better but i think i m dreaming...)
Posted on 2003-11-17 15:00:56 by HeLLoWorld
Man, things are not so simple on this planet :grin:

You can try and study MenuetOS or SolarOS for IRQ setups and code for mouse reading but i do not think it is "that easy" for USB ...
Posted on 2003-11-17 17:57:43 by BogdanOntanu

I ve been told that it was very easy to program usb directly...

what I would like to do is to be able to use a mouse from something like dos, or just after bios gives the hand to the OS loader, so all I have is bios ints loaded... I ve seen some "ohch/uhci" (?) drivers working to install an int33h driver, but they dont work well...
I would want something _very simple_ , what would be best would be how to setup an irq that gives me the bytes of the mouse (movement, click...) .

Anyone knows?

I ve seen some pascal code for usb and it has huge initialisation procedures where you call bios PCI routines to detect billions of usb controllers... isnt there anything less specific and simplier that all motherboard undrstand with no extra features?

Help please , masters ! :)
(and if that could allow me to get the frames from an usb webcam that would be even better but i think i m dreaming...)


I'm afraid your going to have to probe for USB devices with the PCI BIOS.
Posted on 2003-11-17 19:12:05 by x86asm
I don't know how easy it is to program the host side using existing host controllers. It may be easy, but I would not call it "very" easy. Those controllers are not simple devices. Also, USB is easier if you eliminate a lot of so-called "required" features.

For example, you can restrict what you connect to the USB port to exactly one device of one kind. When you do that, a lot of required work becomes redundant. You still need to check that the plugged in device is what you expect it to be. But that's simpler than downloading all the descriptors from the device, and then parsing them to find out what's possible.

As far as I can tell (and I've worked on the device side of USB), the truly required operations include:

USB reset - to allow standard commands to be processed
Set address command - before a device can work fully, you must change its address from the default of 0
Set configuration command - this "turns on" the device, enabling its full functionality

There may be other commands needed to set appropriate operating modes.

You will want to use the "Get descriptor(device)" command to check what device you have plugged in.

You will probably want to set up the host controller for auto-polling, with interrupt generation, for keyboard and mouse devices. The typical host controller has buffer management features that you need to initialize and service.
Posted on 2003-11-17 20:15:22 by tenkey
Aargh.


hey bogdanontanu, its you nasty boy that filled me with innocent and sincere hope :) by saying

(quote)
"
USB is very easy to do, i have seen many USB drivers in ASM (NDA prevents me from talking)

"

when answering a former question of mine on caching and video mem...
(btw youre planning to make an os too? woohoo!)

I didnt know menuet did work with usb mice? at startup it says "ps2(usb)" ... whattheheck??i thought it was a way to say"if youve got an usb then plug it through an adapter or youll get nothin!"...


well it seems usb will be too hard for me. I WANT HARDWARE STANDARDS! (hum _simple_ hardware standards please, with minimum/no drivers at all ... (sigh) )

:)
Posted on 2003-11-18 09:52:20 by HeLLoWorld
btw:

i m not a "code warrior" yet and dont see where i can change that.
i dont see where i can add my picture
i find it annoying to be forced to login 5 times in 5 minutes.
i know these option must be somewhere in my account and i didnt find them so i know i m lame
and if someone with knowledge of usb could post a link to a tut, a spec doc, or a source, that would be great!

bye!

(and i WANT HARWARE STAND... okay okay sorry:)
Posted on 2003-11-18 10:06:34 by HeLLoWorld
Hi HelloWord

.... or should i say Hello?

I was thinking "easy" for the ones that know and/or have acces to technical documentation, unfortunately such documents are usually keept secret (remember NDA) for competitive advantages in capitalismus.

Besides doing your own little OS and direct hardware access is not for the faint of heart... no special skills are required :grin: just ASM and HARDWARE knowledge/understanding and plain work...

Ah and i forgot: knowing the TRUTH is required when you are directly dealing with hardware devices, any wrong assumptions or standardization dreaming here are "fatal" i.e. generate many hours of frustration

Competition prevents standards, only the winners establish standards and do so ONLY in order to prevent OTHERS from disturbing them (most of the times)

Yeah i am also still searching for a free asm sourcecode for USB devices
or for free docs on hadware acceleration in "plain" video bards like nVidia Geforce or ATI Radeon... for my SOL OS

Sorry for this much philosophy, but until you get more precise there is nothing else to say...
Posted on 2003-11-18 14:42:40 by BogdanOntanu

I ve been told that it was very easy to program usb directly...


If you access the device using the file system, then it's pretty easy. E.g.,


fopen( "someusbDeviceName", "r" );


OTOH, if whomever you were talking to was discussing the ease with which you can program a USB device directly, they were lying to you. Someone who knows the USB spec inside and out (about three month's study) and is familar with a particular USB host stack (e.g., the Win32 USB stack) might be able to do some simple things relatively quickly. But by and large, writing a client driver for a USB stack is not a trivial task. And if whomever told you this was talking about programming the USB device directly through the USB host controller, they were crazy (a decent USB stack is about 10 man years of work, even programming the chip to talk to *only* your device requires several months of study and work).

Cheers,
Randy Hyde
Posted on 2003-11-18 15:07:36 by rhyde
Thank you guys

BogdanOntanu:
"
Sorry for this much philosophy, but until you get more precise there is nothing else to say...
"

No problem at all , what you say enlightens me... more precise, about what I want to do?huh...

It was only a vague project in fact, doing a soft 3d engine under dos (or no OS, direcly using hardware(keyb controller, irqs, serial/ps2 mouse , vesa card, and even a processor! incredible!) , to learn about the pc and to struggle endlessly with the problems that come when you fiddle with unreal mode, 32b code and bios ints...
Anyone knows if you can tell nasm to ORG code and data differently, and to put them in different files?

Ack. maybe OSes are a good thing, maybe I ll even admit even drivers are a good thing(at least necessary).
(and yeah I know all this sort of programming is dead and what I do is useless but hey I do it for myself and if I m happy with it whattheheck , I also do some win prog besides that)

So in fact I had the idea of an usb mouse driver , and the dream of polygons with textures showing the stream of an usb webcam, or a webcam motion-capturing myself fighting against nothing like a fool and seeing my polygonal self on the screen fighting a polygonal nothing... or a polygonal troll:)

But if I achieve it, which is unlikely, it will probably be win32/ddraw.

And here the pascal sources for usb I found:
http://hobbes.nmsu.edu/pub/dos/Usb4pas.zip
And some asm sources too:
http://www.cybertrails.com/~fys/usb.htm

bye!
Posted on 2003-11-19 06:31:06 by HeLLoWorld
If your USB device is a HID class, you can use the Windows API to interact with it.

I've done this from a VB program to run a PIC16C765 USB chip I was playing with.

Try looking here for some info.
Posted on 2003-11-21 15:46:53 by Ernie
???

... I said NO OS!! :) (except bios)
Posted on 2003-11-24 14:30:17 by HeLLoWorld