Author Topic: DOS VDM - USB and Game port Gamepad support  (Read 147676 times)

Mark Szkolnicki

  • Sr. Member
  • ****
  • Posts: 433
  • Karma: +18/-0
    • View Profile
Re: DOS VDM - USB and Game port Gamepad support
« Reply #135 on: March 06, 2022, 09:57:30 pm »
Heh Dave!

Your knowledge is far more extensive than mine in these quarters - my knowledge, as mentioned is skilled and expert in a different quarter .........

And I'm hoping it is not needed much more this year. But that is my hope, no my expectation.

A fine rest of the weekend and week to you Sir and Best!

M

Vincit Que Se Vincit - "He Who Conquers Self Succeeds"

Mark Szkolnicki

  • Sr. Member
  • ****
  • Posts: 433
  • Karma: +18/-0
    • View Profile
Re: DOS VDM - USB and Game port Gamepad support
« Reply #136 on: March 11, 2022, 11:01:45 pm »
Heh Guys!

I started doing some testing related to USB devices including the game controllers I have available and had two questions today, about HIDAPI:

1) I've downloaded the experimental version of HIDAPI that was posted accessible through a repository available for download via ANPM, as well as USB1 and a couple of multimedia libraries, as per the announcement on OS2World a couple of weeks ago. I was wondering if anyone has found any other dependencies that are required for HIDAPI testing purposes?

2) I'm currently using Dave Yeo's version of Hidapitester, and have been using the --list functions extensively, to have a look at what USB equipment is being recognized so I understand its use to start. However, I also wanted to run a couple of tests on my controllers, to see if the the buttons are functional and recognized. Is there some command line syntax I can use in Hidapitester to generate a continuous hex output report as I press certain buttons, or while I move the joystick?

In the current --list functions the following items are reported:

[D:\]hidapitester --list

1EA7/1005: BTL - Gaming Mouse
1EA7/1005: BTL - Gaming Mouse
0A81/0205: CHESEN - PS2 to USB Converter
0A81/0205: CHESEN - PS2 to USB Converter
0583/2031: Padix Co. Ltd. - 4-axis,4button joystick w/view finder

lsusb reports the following for the same system:

Protocol spec without prior Class and Subclass spec at line 23281

Bus 001 Device 001: ID 046d:08b5 Logitech, Inc. QuickCam Sphere
Bus 001 Device 002: ID 1ea7:1005 SHARKOON Technologies GmbH
Bus 001 Device 003: ID 058f:6362 Alcor Micro Corp. Flash Card Reader/Writer
Bus 001 Device 004: ID 0a81:0205 Chesen Electronics Corp. PS/2 Keyboard+Mouse Adapter
Bus 001 Device 005: ID 0583:2031 Padix Co., Ltd (Rockfire) RM-203 USB Nest [mode 2]

Is there a reason why hidapitester would report two of the devices twice? Also, as both a camera and a flash card reader are reported with lsusb but not under hidapitester, would these items not be seen or addressed by HIDAPI?

Best of the day and weekend to you!

Mark
Vincit Que Se Vincit - "He Who Conquers Self Succeeds"

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4787
  • Karma: +99/-1
    • View Profile
Re: DOS VDM - USB and Game port Gamepad support
« Reply #137 on: March 12, 2022, 04:46:06 am »
Hi Mark, this works for my joystick, change the vidpid to yours,
Code: [Select]
hidapitester --vidpid 046D/C216 -l 64 -t 1500 --open --read-input-foreverI see hex values changing when pressing buttons etc. Could play with the -t (time) parameter.
Your mouse may be actually dual function like your keyboard and mouse thingy. Lots of devices are actually multiple devices such as some gaming mice also registering as a keyboard so some buttons can report key presses.
The flash card reader and camera are not HID (human interface device) devices, but MSD (mass storage device) or similar for the camera. Completely different class of device.

Mark Szkolnicki

  • Sr. Member
  • ****
  • Posts: 433
  • Karma: +18/-0
    • View Profile
Re: DOS VDM - USB and Game port Gamepad support
« Reply #138 on: March 12, 2022, 07:53:47 pm »
Hi Mark, this works for my joystick, change the vidpid to yours,
Code: [Select]
hidapitester --vidpid 046D/C216 -l 64 -t 1500 --open --read-input-foreverI see hex values changing when pressing buttons etc. Could play with the -t (time) parameter.
Your mouse may be actually dual function like your keyboard and mouse thingy. Lots of devices are actually multiple devices such as some gaming mice also registering as a keyboard so some buttons can report key presses.
The flash card reader and camera are not HID (human interface device) devices, but MSD (mass storage device) or similar for the camera. Completely different class of device.

Heh Again Dave!

The mouse listed is marketed as the Aula Ghost Shark Gaming Mouse and is programmable - it has both standard mouse functions (right and left mouse keys, and and roller/click function) in addition to 4 other programmable buttons (in windows all are programmable) - interestingly those 4 buttons didn't seem to function before now correspond to 3 keyboard letters (c,w,s) and opening of a file save window. I don't know if that is a function of HIDAPI or not - I would have to disable the API as a test and see if that could be reproduced without the library installed.

As to the Chesen PS/2 to USB converter I'm not sure what device it is referring to - it is not related in any way to the logilink adapter where the joystick is attached, as it has a different PID and it corresponds to the joystick, which disappears if unplugged from USB.

I'll try the command line syntax you provided, substituting the PID values for my devices and see what happens.

Thanks for the tip and Best!

M
Vincit Que Se Vincit - "He Who Conquers Self Succeeds"

Wim Brul

  • Sr. Member
  • ****
  • Posts: 295
  • Karma: +25/-0
    • View Profile
    • Wim's home page
Re: DOS VDM - USB and Game port Gamepad support
« Reply #139 on: March 17, 2022, 06:16:00 pm »
Martin Iturbide was so kind to send me some usb game controllers for me to experiment with. What I have done so far (still very experimental):

I created GAMEPAD.SYS (new driver) which talks to modified GAMEDD.SYS (replacement).
I created xevents.cmd which uses USBECD.SYS to obtain events from those controllers.
This xevents.cmd (written in rexx) sends transformed events to GAMEPAD.SYS and so on.
At the end these events arrive in GAMEVDD.SYS what I have seen happening right now.

I can play some games with my C=64 emulator for OS/2 using those controllers. I can play OS/2 game MAKMAN and DOS game WOLF3D using those controllers.
Martin Iturbide did some testing with his own usb game controllers as well. He suggested to go public so others can test and provide their comments. So here it is.

@Mark: for your Padix RM-203 there are 2 REXX scripts to try out:

1) I modified oinput.cmd which now only reports changed input events.
2) I created xevents.cmd to send transformed events into GAMEPAD.SYS.

I already did some ad hoc mapping of various controls into just 4 axis and 4 buttons.
The big challenge is to come up with proper mapping for each usb game controller.

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4712
  • Karma: +41/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: DOS VDM - USB and Game port Gamepad support
« Reply #140 on: March 17, 2022, 08:57:12 pm »
Thank you very much Wim.

This is a video I created some time ago testing the drivers with an USB Gamepad.
https://youtu.be/QAP0pEUwpx0

Just to clarify, these drivers are to make USB gamepad works with OS/2 games that uses the "gamedd.sys" driver and DOS games under the DOS VDM sessions (gamevdd.sys).

It does not overlaps with the efforts to make a USB Gamepad driver to work on SDL ported games. I hope it can be complementary at the end.

Please test it out and provide feedback, let's see how far we can get with this.

Regards
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Jochen Schäfer

  • Sr. Member
  • ****
  • Posts: 306
  • Karma: +27/-0
    • View Profile
Re: DOS VDM - USB and Game port Gamepad support
« Reply #141 on: March 18, 2022, 09:00:25 am »
It does not overlaps with the efforts to make a USB Gamepad driver to work on SDL ported games. I hope it can be complementary at the end.
In the now available SDL version 2.0.18, USB HID support for game controllers was enabled. Also native joystick support is reintroduced.
If I understand this correctly, we get native joystick support with this driver. If so, I will test the driver with Dosbox next week.

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4712
  • Karma: +41/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: DOS VDM - USB and Game port Gamepad support
« Reply #142 on: March 18, 2022, 02:07:19 pm »
It does not overlaps with the efforts to make a USB Gamepad driver to work on SDL ported games. I hope it can be complementary at the end.
In the now available SDL version 2.0.18, USB HID support for game controllers was enabled. Also native joystick support is reintroduced.
If I understand this correctly, we get native joystick support with this driver. If so, I will test the driver with Dosbox next week.

Thanks Jochen. I also want to test that. I will be looking forward to the DOSBox update.
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Mark Szkolnicki

  • Sr. Member
  • ****
  • Posts: 433
  • Karma: +18/-0
    • View Profile
Re: DOS VDM - USB and Game port Gamepad support
« Reply #143 on: March 18, 2022, 04:23:02 pm »
Martin Iturbide was so kind to send me some usb game controllers for me to experiment with. What I have done so far (still very experimental):

I created GAMEPAD.SYS (new driver) which talks to modified GAMEDD.SYS (replacement).
I created xevents.cmd which uses USBECD.SYS to obtain events from those controllers.
This xevents.cmd (written in rexx) sends transformed events to GAMEPAD.SYS and so on.
At the end these events arrive in GAMEVDD.SYS what I have seen happening right now.

I can play some games with my C=64 emulator for OS/2 using those controllers. I can play OS/2 game MAKMAN and DOS game WOLF3D using those controllers.
Martin Iturbide did some testing with his own usb game controllers as well. He suggested to go public so others can test and provide their comments. So here it is.

@Mark: for your Padix RM-203 there are 2 REXX scripts to try out:

1) I modified oinput.cmd which now only reports changed input events.
2) I created xevents.cmd to send transformed events into GAMEPAD.SYS.

I already did some ad hoc mapping of various controls into just 4 axis and 4 buttons.
The big challenge is to come up with proper mapping for each usb game controller.

Hi Wim!

Sounds like you've been doing a HUGE amount of work. Thanks for all the efforts.

Two questions:

Are the REXX scripts your describing for me in the package you attached, and

Are there any installation instructions that come with the packages?

If not I will see if I can come up with something after doing my tests, as a guide for testing.

But thanks for all the work sir and hopefully we can get some feedback to you soon!

Best!

Mark

Vincit Que Se Vincit - "He Who Conquers Self Succeeds"

Jochen Schäfer

  • Sr. Member
  • ****
  • Posts: 306
  • Karma: +27/-0
    • View Profile
Re: DOS VDM - USB and Game port Gamepad support
« Reply #144 on: March 18, 2022, 05:12:10 pm »
Thanks Jochen. I also want to test that. I will be looking forward to the DOSBox update.
If the driver works like I think it would, there is no update to Dosbox or SDL1 necesarry. ;-)
« Last Edit: March 18, 2022, 05:13:49 pm by Jochen Schäfer »

Wim Brul

  • Sr. Member
  • ****
  • Posts: 295
  • Karma: +25/-0
    • View Profile
    • Wim's home page
Re: DOS VDM - USB and Game port Gamepad support
« Reply #145 on: March 18, 2022, 06:12:30 pm »
Hallo Mark,

Quote
Are the REXX scripts your describing for me in the package you attached, and
Are there any installation instructions that come with the packages?
Sub directory RM203  contains oinput.cmd and xevents.cmd for your device. That directory also contains testing.txt with installation and test instructions. 

Wim

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4787
  • Karma: +99/-1
    • View Profile
Re: DOS VDM - USB and Game port Gamepad support
« Reply #146 on: March 18, 2022, 07:11:27 pm »
I already did some ad hoc mapping of various controls into just 4 axis and 4 buttons.
The big challenge is to come up with proper mapping for each usb game controller.

In theory you can query the (HID) device for a feature report. Here's mine for a "046D/C216: Logitech - Logitech Dual Action" joypad,
Code: [Select]
K:\work\hidapitester>idapitester.exe --vidpid 046D:C216 --open --read-feature 0
Opening device, vid/pid: 0x046D/0xC216
Reading 64-byte feature report, report_id 0...read -1 bytes:
 00 FA 00 00 00 D8 55 03 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00
 00 00 00 00 00 09 02 29 00 01 01 00 80 34 00 00 00 74 00 00 00 50 01 03 20 B8 A7 03 20 00 00 00
Closing device

Unluckily it doesn't look straight forward, here's the official document on it, https://www.usb.org/sites/default/files/hut1_2.pdf

Mark Szkolnicki

  • Sr. Member
  • ****
  • Posts: 433
  • Karma: +18/-0
    • View Profile
Re: DOS VDM - USB and Game port Gamepad support
« Reply #147 on: March 19, 2022, 06:41:23 pm »
Hi Wim!

Hallo Mark,

Quote
Are the REXX scripts your describing for me in the package you attached, and
Are there any installation instructions that come with the packages?
Sub directory RM203  contains oinput.cmd and xevents.cmd for your device. That directory also contains testing.txt with installation and test instructions. 

Wim

Will have a look today (Saturday) and see whats there in the package.

Couldn't do that yesterday as I was about 200 km south of the Arctic Circle, at a corporate clients site, using their computers to check my e-mails and sites.

But I'm quite excited about this - hope to have some positive reports to relate soon!

A fine weekend to you Sir and Best!

M
Vincit Que Se Vincit - "He Who Conquers Self Succeeds"

Mark Szkolnicki

  • Sr. Member
  • ****
  • Posts: 433
  • Karma: +18/-0
    • View Profile
Re: DOS VDM - USB and Game port Gamepad support
« Reply #148 on: March 20, 2022, 01:06:53 am »
Hi Wim!

Hope your having a fine weekend!

Hallo Mark,

Quote
Are the REXX scripts your describing for me in the package you attached, and
Are there any installation instructions that come with the packages?
Sub directory RM203  contains oinput.cmd and xevents.cmd for your device. That directory also contains testing.txt with installation and test instructions. 

Wim

As to my current tests

Test environment:

ArcaOS v5.0.7

Equipment tested:

Thrustmaster Pro Joystick attached to Logilink (Padix) Game Port to USB connector in Mode 2 of 4 (reports as 4 axis, 4 button joystick with view finder, under Hidapitester --list)

Installation (USBECD)

Undertaken previously as per instructions Part A - A1 to A2

Verbose boot reports USBECD present and active using the parameters outlined

Test 1 - Buttons

Oinput.cmd worked perfectly. However adding command oinput.cmd > Button.log hung the process until control-c was pressed, so could not generate log. Tried syntax oinput.cmd >button.log. Same result.

Took a screen shot of results instead.

Screen shot Button Test 1 - 4 Buttons (attached)

First Hex set    - Thrustmaster at rest (no buttons pressed)
Second set   - Trigger pressed
Third set   - Trigger released
Fourth Set   - Red button beside Hat pressed
Fifth Set            - Red button beside Hat released
Sixth set            - Red button left side pressed
Seventh set   - Red button left side released
Eighth set   - Red button bottom front pressed
Ninth set   - Red button bottom front released

I have generated a second screen shot, Button Test 1 - Hat (attached) as the Joystick has a viewfinder (Hat) as well.

First Hex set    - Thrustmaster Hat at rest (hat centre position)
Second set   - Hat pressed upwards
Third set   - Hat released
Fourth Set   - Hat pressed downwards
Fifth Set   - Hat released
Sixth set   - Hat pressed left
Seventh set   - Hat released
Eighth set   - Hat pressed right
Ninth set   - Hat released

As mentioned the LOG instructions are not working - do you have any idea why?

Haven't had time today to send a picture of the joystick indicating which button is which - will try to do that tomorrow and Best!

M
« Last Edit: March 20, 2022, 01:12:41 am by Mark Szkolnicki »
Vincit Que Se Vincit - "He Who Conquers Self Succeeds"

Wim Brul

  • Sr. Member
  • ****
  • Posts: 295
  • Karma: +25/-0
    • View Profile
    • Wim's home page
Re: DOS VDM - USB and Game port Gamepad support
« Reply #149 on: March 20, 2022, 10:18:34 am »
Hi Mark,

I played tennis yesterday for one hour. Good for my health and fun to do.
Quote
Oinput.cmd worked perfectly. However adding command oinput.cmd > Button.log hung the process until control-c was pressed, so could not generate log. Tried syntax oinput.cmd >button.log. Same result.
.
As mentioned the LOG instructions are not working - do you have any idea why?
It seems to me that oinput.cmd > button.log is not working up to your expectation. What you do with the controls is not shown but written to the log instead.

I have no idea what the Thrustmaster Pro Joystick looks like i.e. how many buttons it has and where these are located.
Do you have a picture and description of what controls it has  and how you would use those controls?

Thanks for your efforts sofar!

Wim