usb joysticks

The intent of this forum is to discuss my DOS TSR programs (available at http://bretjohnson.us), how they work and don't work, new/missing features, status of updates, and anything else related to them that may need to be discussed.

Re: usb joysticks

Postby watlers world » Sun Feb 19, 2012 7:22 am

all right
got the first return from Transaction Request
(with out windows errors)

ignored ds just put the 16bit real address in the dx

with the request structure created (but not set to anything )
I got

00000000
0000FFFF
0000FFFF
0000FFFF

nice to have somthing working :)
watlers world
 
Posts: 113
Joined: Sat Feb 04, 2012 3:08 am

Re: usb joysticks

Postby Bret » Mon Feb 20, 2012 5:26 am

watlers world wrote:can I just use DX,
or do I have to use DS?


You have to use DS. An offset without a segment doesn't mean anything.

watlers world wrote:ignored ds just put the 16bit real address in the dx

with the request structure created (but not set to anything )
I got

00000000
0000FFFF
0000FFFF
0000FFFF

nice to have somthing working


Since you didn't provide a specific segment, though, DS was random and you have no idea what you actually told the USB driver to do. The fact that AX returned 0 instead of some other value is a good sign, but doesn't necessarily tell you anything.

watlers world wrote:since most old uhci computers only have 1 or 2 ports
on those you only need to make the call support a few joysticks


Not true, Even if there is only a single port on the host, you can at least theoretically have more than 100 joysticks attached by using Hubs. The USB bus would run out of bandwidth if you actually had that many devices, though, so on a real system the practical limit is much less than that.

watlers world wrote:my usb joystick has 7 button inputs
AH is 8 bits right?


It is, but the BIOS spec only allows four of the bits to be used. You can't use the other four bits of the register, or any of the other registers either, or you will be incompatible with other programs and may cause them to crash.

watlers world wrote:how many VR suits do you have?


None. I'm just saying that if a NEW standard were developed, it should be flexible enough to allow for things like VR suits and two-way communications. I currently don't have any devices with force feedback, either, though would like to get one to test with.

watlers world wrote:and how many buttons does your average old used usb controller have?


I personally have two USB devices I use for testing: one joystick and one gamepad. The joystick has four axes: a regular handle (an X and a Y axis), you can twist the handle left and right (rotation around the Z axis), and a slider on the base. It also has a small 8-way hat-switch on the handle. There are a total of 7 buttons, 5 on the handle and 2 on the base.

The gamepad has three axes: you "rotate" the gamepad in the air left/right/forward/backward for the X & Y axes (there is some sort of "gravity sensor" inside the gamepad), and there is a slider. There is also an 8-way direction pad, and a total of 12 buttons. I think in general gamepads have more buttons than joyticks do.
Bret
 
Posts: 478
Joined: Fri Oct 10, 2008 3:43 am
Location: Rio Rancho, NM

Re: usb joysticks

Postby watlers world » Tue Feb 21, 2012 2:18 am

though I had good luck locating dpmi info
It took one full day to search my computers
did find several different pascal dpmi units,
and several programs that make use of dpmi

when you want to pass segment registers you have to use dpmi RM int calls
I've more to read yet

think I know what you are talking about
some one gave me a playstation controller
so I created a win3x driver for it

Are you thinking somthing like allegro or directx?

or are you just saying you would like to make a driver
that can handle more general controller I/O info?

humm... that joystick sounds sort of like mine
guess my twisty handle thing is broken
Logitech wingman extreme?

too bad you dont have a dos dpmi example ;)
watlers world
 
Posts: 113
Joined: Sat Feb 04, 2012 3:08 am

Re: usb joysticks

Postby Bret » Tue Feb 21, 2012 4:27 am

watlers world wrote:Are you thinking somthing like allegro or directx?


I really have no idea. I don't program for Windows, and really don't want to.

watlers world wrote:or are you just saying you would like to make a driver
that can handle more general controller I/O info?


If somebody developed a RM BIOS-level API that could do that, and had a "real" application that could actually use it, I would probably update my drivers to support it. It would need to be a pretty "complete" API, much more complete than anything I've ever seen so far, or it wouldn't be worth the trouble, though.

watlers world wrote:Logitech wingman extreme?


Yes.

watlers world wrote:too bad you dont have a dos dpmi example


Look at this thread:

http://bretjohnson.us/forum/viewtopic.php?f=5&t=99&sid=18ac886edf0537c74a964c7d7183a395

Dinosaur went though this with DOS DPMI, and I think in the end he actually got it working. You can try to contact him, and he may be able to send you something.
Bret
 
Posts: 478
Joined: Fri Oct 10, 2008 3:43 am
Location: Rio Rancho, NM

Re: usb joysticks

Postby watlers world » Tue Feb 21, 2012 6:41 am

Allegro started as a bunch of files to help dos games programmers
the first releases had DOS (DJGPP, Watcom) and bcc files
it supports many joysticks
you have look at ver 3 or 4

found pascal functions for working with the windows segment functions
I can get pointers to memory such as (FFFF,0005)

for let me see if I have this right....
dos jargon
everything over 1mb is a linear address
and everything under is a real address

my programming is just for fun ;)
thanks for the help
watlers world
 
Posts: 113
Joined: Sat Feb 04, 2012 3:08 am

Re: usb joysticks

Postby watlers world » Wed Feb 22, 2012 5:12 am

after doing what you told me to
I was vastly uncertain if my work was done right

untill I got the driver to BEEP!

well at least I was able to prove I have a 64byte structure
watlers world
 
Posts: 113
Joined: Sat Feb 04, 2012 3:08 am

Re: usb joysticks

Postby Bret » Wed Feb 22, 2012 6:50 am

Beeping is an easy test that definitely proves you're on the right track!
Bret
 
Posts: 478
Joined: Fri Oct 10, 2008 3:43 am
Location: Rio Rancho, NM

Re: usb joysticks

Postby watlers world » Wed Feb 22, 2012 9:00 am

all the c constants went to pascal easy as pie

slowly I read over various parts of the api document...

looking at the usbjstik asm
I keep seeing assembly (jumping calling etc..)

what order of commands am I to attempt?
watlers world
 
Posts: 113
Joined: Sat Feb 04, 2012 3:08 am

Re: usb joysticks

Postby Bret » Wed Feb 22, 2012 10:11 am

watlers world wrote:looking at the usbjstik asm
I keep seeing assembly (jumping calling etc..)


It's an assembly language source code file -- did you actually expect to find any Pascal or C or BASIC or Fortran?

watlers world wrote:what order of commands am I to attempt?


Look at the code section that starts with LookForNewDevice.
Bret
 
Posts: 478
Joined: Fri Oct 10, 2008 3:43 am
Location: Rio Rancho, NM

Re: usb joysticks

Postby watlers world » Thu Feb 23, 2012 3:06 am

you have a very simple pascal dpmi example
http://win31.no-ip.org/freeware/new/watlers/uhcip5.zip

you already have two c examples

think GFA basic has inline asm

actually I've seen somthing like functions in asm (like in fasmw)

I've never seen any Fortran programming
guess it would have inline wasm?
that would be cool

you have great ideas :)

still reading...
watlers world
 
Posts: 113
Joined: Sat Feb 04, 2012 3:08 am

Re: usb joysticks

Postby watlers world » Sat Feb 25, 2012 9:56 am

may I have a c translation of the usbjstik structures please?
(USB/Joystick-Related)

also does (-1) DB mean
255 as a regular byte?

thanks
watlers world
 
Posts: 113
Joined: Sat Feb 04, 2012 3:08 am

Re: usb joysticks

Postby Bret » Sat Feb 25, 2012 11:54 am

I don't have anything like that for C. There are some general applicable definitions in the CPP source code for INKLEVEL and USBDEVIC, but nothing related specifically to joysticks or HID's (Human Interface Devices, which includes mice, keyboards, and various other devices, in addition to joysticks).

Yes, -1 is the same as 255 (FFh) for a byte, or 65535 (FFFFh) for a word.
Bret
 
Posts: 478
Joined: Fri Oct 10, 2008 3:43 am
Location: Rio Rancho, NM

Re: usb joysticks

Postby watlers world » Sun Feb 26, 2012 6:47 am

not the driver related structures
I'm talking about the jstik program structures

have any programmers other than EI created any opensource programs
that use the the driver?

thanks for the help
watlers world
 
Posts: 113
Joined: Sat Feb 04, 2012 3:08 am

Re: usb joysticks

Postby Bret » Sun Feb 26, 2012 8:29 am

None that I know of. I've heard of a few people who've written programs, but I've never seen any of the programs myself, much less the source coe. Like I said earlier, Dinosaur might be able to provide you something if you contact him -- don't know for certain, though.
Bret
 
Posts: 478
Joined: Fri Oct 10, 2008 3:43 am
Location: Rio Rancho, NM

Re: usb joysticks

Postby watlers world » Sun Feb 26, 2012 10:44 am

the one c example uses an asm program as a buffer to get usb data...
that sound right?

sent Dinosaur an email
he said he will get back home on the weekend
and will look up and see what he can send.

hopefully it will be just what the DR ordered :)
watlers world
 
Posts: 113
Joined: Sat Feb 04, 2012 3:08 am

Re: usb joysticks

Postby Bret » Sun Feb 26, 2012 4:02 pm

If you're talking about the CPP examples I wrote, they don't "use an asm program as a buffer", but they do have quite a bit of in-line ASM.
Bret
 
Posts: 478
Joined: Fri Oct 10, 2008 3:43 am
Location: Rio Rancho, NM

Re: usb joysticks

Postby watlers world » Mon Feb 27, 2012 1:20 am

pardon me my mistake

let me try again....
inklevel is not an int14 but an int17 example correct?

for those not good at asm
perhaps you could showboat some?
watlers world
 
Posts: 113
Joined: Sat Feb 04, 2012 3:08 am

Re: usb joysticks

Postby Bret » Mon Feb 27, 2012 4:33 am

watlers world wrote:inklevel is not an int14 but an int17 example correct?


Correct. INKLEVEL is written in CPP, and uses the INT 17h extensions provided by USBPRINT that allow two-way communications with a device attached to a parallel port. INKLEVEL is a relatively simple program, specifically allowing you to determine the ink fill level for certain HP and Epson printers. In theory, the program could be expanded to download ink level information for other brands of printers as well, though there is no standard that addresses how to do this -- every manufacturer does it differently. The reason it's limited to HP and Epson are because those are the only printers I had to test with. You could also use INKLEVEL as a starting point to design a program that downloads any type of information you want from a printer (or anything else attached to a parallel port).

USBDEVIC is also written in CPP, and uses INT 14h to download some basic information about the USB devices attached to the buses. You can use USBDEVIC as a starting point for developing almost any type of USB-related utility.

watlers world wrote:perhaps you could showboat some?


I'm not sure what you mean by this.
Bret
 
Posts: 478
Joined: Fri Oct 10, 2008 3:43 am
Location: Rio Rancho, NM

Re: usb joysticks

Postby watlers world » Mon Feb 27, 2012 9:18 am

updated the test program with error code translations
http://win31.no-ip.org/freeware/new/watlers/uhcip6.zip

the following is for the logitech wingman extreme
hub=0
device=2

function getdvcvendinfo
Vendor ID:0001
Product ID:FF00
No Error

function getdvcvendinfo
Vendor ID:0001
Product ID:FF65
No Error

do those numbers sound right?

(not shure if the asm hex functions are the same as in pascal)
Last edited by watlers world on Fri Mar 23, 2012 4:03 am, edited 1 time in total.
watlers world
 
Posts: 113
Joined: Sat Feb 04, 2012 3:08 am

Re: usb joysticks

Postby Bret » Mon Feb 27, 2012 10:15 am

My Logitech Wingman Extreme has a Vendor ID of 046Dh, and Product ID of C207h. Host Index of 0 and address of 2 is probably legitimate.

You can see this by viewing the output of USBDEVIC, or USBUHCIL with the /AD Option (which simply executes USBDEVIC as a child program). As mentioned earlier, USBDEVIC is written in CPP and makes lots of INT 14h calls, including GetDvcVendInfo.
Bret
 
Posts: 478
Joined: Fri Oct 10, 2008 3:43 am
Location: Rio Rancho, NM

Re: usb joysticks

Postby watlers world » Tue Feb 28, 2012 3:21 am

usb hosts:0 (hosts are on zero based indexing)

usb device:1 (always hub number 1)
usb device:2 (in this case joystick)

if I call getdvcvendinfo (before any other function)
with just I14RHostIndex=0 and I14RDeviceAddress=2 set
then
BX=1 (1)
cx=FF65h (65381)
(with no errors)

just as you said
usbdevic says
046Dh (1133)
c207h (49671)

do I have enable or configure anything first
or is calling getdvcvendinfo first ok?
watlers world
 
Posts: 113
Joined: Sat Feb 04, 2012 3:08 am

Re: usb joysticks

Postby Bret » Tue Feb 28, 2012 5:22 am

No, you shouldn't need to configure anything -- it should just work.
Bret
 
Posts: 478
Joined: Fri Oct 10, 2008 3:43 am
Location: Rio Rancho, NM

Re: usb joysticks

Postby watlers world » Tue Feb 28, 2012 7:14 am

I cant see as its the bits mirrored... or swaped hex
as far as I can see other commands are returning bx and cx just fine
(such as power)

there seems to be a problem
my source code is open if you care to look at the *.pas file
the commands are done using your classic const names
watlers world
 
Posts: 113
Joined: Sat Feb 04, 2012 3:08 am

Re: usb joysticks

Postby Bret » Tue Feb 28, 2012 8:04 am

Well, in USBDOS.PAS I see the following problem:

Code: Select all
function s64GetDvcVendInfo(v0,v1:byte):byte; begin
with lpProtModePtr^ do begin
I14RRequestType:=I14RRTGetDvcStatus;  { <<-- this should be I14RRequestType:=I14RRTGetDvcVendInfo}
Bret
 
Posts: 478
Joined: Fri Oct 10, 2008 3:43 am
Location: Rio Rancho, NM

Re: usb joysticks

Postby watlers world » Tue Feb 28, 2012 8:57 am

wow you are not only good at asm
your also a wizard with pascal

http://win31.no-ip.org/freeware/new/watlers/uhcip7.zip

Install check
usbuhci installed

function GetHostHWInfo
UHCI
PCI
IRQ#: 11
Root Hub Ports: 02
No Error

function GetHostVendInfo
Vendor:8086
8086
Product:2442h
No Error

function GetDvcStatus
... ... not being configured ... ...
No Error

function getdvcvendinfo
Vendor ID:046D
Product ID:C207
No Error

function GetDvcClassInfo
DeviceClass=00
DevicesubClass=00
DeviceProtocol=00
low speed flag=Y
Device Protocol=0
usb version=0
No Error

function GetDvcHubInfo
1
0
No Error

function DvcPowerInfo
device gets power via USB
20
Write Configuration Value
1
No Error

function GetAltIntfInfo
Interface Class=3
Interface SubClass=0
Interface Protocol=0
Alternate Interface Bitmap=1
No Error

think I have about all the basic functions from devic
now to take a look at jstik

thanks for the help
watlers world
 
Posts: 113
Joined: Sat Feb 04, 2012 3:08 am

PreviousNext

Return to Programs

Who is online

Users browsing this forum: No registered users and 2 guests

cron