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

Jochen Schäfer

  • Full Member
  • ***
  • Posts: 221
  • Karma: +20/-0
    • View Profile
Re: DOS VDM - USB and Game port Gamepad support
« Reply #60 on: December 08, 2021, 04:48:24 pm »
Hi Jochen

[...]
Have you posted the updated hidapi? Didn't see it attached to any of the posts at the moment, and might want to see if it can see my joystick.

No, it's part of SDL2, so I have to try understand the code and tinker around with it, first. Perhaps, the new libusb helps. We will see.

Mark Szkolnicki

  • Sr. Member
  • ****
  • Posts: 284
  • Karma: +13/-0
    • View Profile
Re: DOS VDM - USB and Game port Gamepad support
« Reply #61 on: December 08, 2021, 07:45:08 pm »

No, it's part of SDL2, so I have to try understand the code and tinker around with it, first. Perhaps, the new libusb helps. We will see.

Understood.

Will watch with interest where things go from here with interest and Best!

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

Jochen Schäfer

  • Full Member
  • ***
  • Posts: 221
  • Karma: +20/-0
    • View Profile
Re: DOS VDM - USB and Game port Gamepad support
« Reply #62 on: December 09, 2021, 12:01:20 pm »
We've always been missing a lot of the wide character functions, Bitwise has added most but hadn't added wcsdup(). Sylvan must have seen this thread and opened the above referenced issue about it, so slowly we're getting all of them.

To keep everyone informed: I just made a pull request for a wcsdup implementation.

Jochen Schäfer

  • Full Member
  • ***
  • Posts: 221
  • Karma: +20/-0
    • View Profile
Re: DOS VDM - USB and Game port Gamepad support
« Reply #63 on: December 10, 2021, 04:14:03 pm »
By now, I have finished work on libusb (hopefully). I'll ask BWW to create an updated RPM. You might want to try the updated version and see if that helps. Proper support of "libusb_get_port_numbers" is still a problem (what error message did you get when trying out hidapi ?)
Where do I get your version from to build it myself?

Mark Szkolnicki

  • Sr. Member
  • ****
  • Posts: 284
  • Karma: +13/-0
    • View Profile
Re: DOS VDM - USB and Game port Gamepad support
« Reply #64 on: December 10, 2021, 04:24:53 pm »
Hi Jochen

By now, I have finished work on libusb (hopefully). I'll ask BWW to create an updated RPM. You might want to try the updated version and see if that helps. Proper support of "libusb_get_port_numbers" is still a problem (what error message did you get when trying out hidapi ?)
Where do I get your version from to build it myself?

Dave's build of HIDAPI was attached to one of his earlier posts. I downloaded it there and tried it previously. Don't know where he derived the source code from.

Also don't know if Dave has an update to that.

Best!

Mark

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

Lars

  • Hero Member
  • *****
  • Posts: 957
  • Karma: +46/-0
    • View Profile
Re: DOS VDM - USB and Game port Gamepad support
« Reply #65 on: December 10, 2021, 04:52:19 pm »
By now, I have finished work on libusb (hopefully). I'll ask BWW to create an updated RPM. You might want to try the updated version and see if that helps. Proper support of "libusb_get_port_numbers" is still a problem (what error message did you get when trying out hidapi ?)
Where do I get your version from to build it myself?

It's here:
https://github.com/bitwiseworks/libusb1-os2

but there is still work to do (something's not quite right when you end a process with Ctrl-C). Nonetheless, you might want to try it.

« Last Edit: December 10, 2021, 04:54:26 pm by Lars »

Jochen Schäfer

  • Full Member
  • ***
  • Posts: 221
  • Karma: +20/-0
    • View Profile
Re: DOS VDM - USB and Game port Gamepad support
« Reply #66 on: December 10, 2021, 06:23:17 pm »

It's here:
https://github.com/bitwiseworks/libusb1-os2

but there is still work to do (something's not quite right when you end a process with Ctrl-C). Nonetheless, you might want to try it.
Thank you, I wil try it out.

Dave Yeo

  • Hero Member
  • *****
  • Posts: 3664
  • Karma: +77/-0
    • View Profile
Re: DOS VDM - USB and Game port Gamepad support
« Reply #67 on: December 10, 2021, 06:52:41 pm »
By now, I have finished work on libusb (hopefully). I'll ask BWW to create an updated RPM. You might want to try the updated version and see if that helps. Proper support of "libusb_get_port_numbers" is still a problem (what error message did you get when trying out hidapi ?)
Where do I get your version from to build it myself?

It's here:
https://github.com/bitwiseworks/libusb1-os2

but there is still work to do (something's not quite right when you end a process with Ctrl-C). Nonetheless, you might want to try it.

What flags are you using? I succeeded with,
Code: [Select]
sh configure --prefix=h:/tmp/libusb1 CFLAGS=-Iw:/usbdev LDFLAGS="-Zomf -Zbin-files -Zmap -Lw:/usbdev"
Which left me wondering about libcx and -Zhigh-mem

Dave Yeo

  • Hero Member
  • *****
  • Posts: 3664
  • Karma: +77/-0
    • View Profile
Re: DOS VDM - USB and Game port Gamepad support
« Reply #68 on: December 10, 2021, 08:10:08 pm »
Anyways, dropping in the new usb100.dll gave
Code: [Select]
12-10-2021  09:59:35  SYS2070  PID 2128  TID 0001  Slot 00a6
H:\TMP\HIDAPI\LIB\HIDTEST.EXE
HIDAPI0->USB100._clock_gettime
127

So I rebuilt hidapi, some wrestling to link to usbcalls (see libcx is also linked in by the pkgconfig script). Things have improved as the PATH error is gone but still unable to open the device.
Code: [Select]
H:\tmp\hidapi\lib>hidtest.exe
hidapi test/example tool. Compiled with hidapi version 0.11.0, runtime version 0.11.0.
Compile-time version matches runtime version of hidapi.

Device Found
  type: 046d c534
  path: 1-3:1.0
  serial_number: (null)
  Manufacturer: Logitech
  Product:      USB Receiver
  Release:      2901
  Interface:    0
  Usage (page): 0x0 (0x0)

Device Found
  type: 046d c534
  path: 1-3:1.1
  serial_number: (null)
  Manufacturer: Logitech
  Product:      USB Receiver
  Release:      2901
  Interface:    1
  Usage (page): 0x0 (0x0)

Device Found
  type: 046d c216
  path: 0-4:1.0
  serial_number: (null)
  Manufacturer: Logitech
  Product:      Logitech Dual Action
  Release:      300
  Interface:    0
  Usage (page): 0x0 (0x0)

unable to open device

Edit: notice the serial number is still null, perhaps the problem, perhaps caused by working around iconv.
« Last Edit: December 10, 2021, 08:12:12 pm by Dave Yeo »

Jochen Schäfer

  • Full Member
  • ***
  • Posts: 221
  • Karma: +20/-0
    • View Profile
Re: DOS VDM - USB and Game port Gamepad support
« Reply #69 on: December 10, 2021, 08:17:32 pm »
You have to change the hardcoded device id for the hid_open call, so that it points to one of the connected devices.

But I cannot configure libusb, because it seems my system cannot link usbcalls.
« Last Edit: December 10, 2021, 08:21:23 pm by Jochen Schäfer »

Dave Yeo

  • Hero Member
  • *****
  • Posts: 3664
  • Karma: +77/-0
    • View Profile
Re: DOS VDM - USB and Game port Gamepad support
« Reply #70 on: December 10, 2021, 08:34:08 pm »
Code: [Select]
emximp -o usbcalls.def usbcalls.dll
emximp -o usbcalls.a usbcalls.def

Will create the import library.

Jochen Schäfer

  • Full Member
  • ***
  • Posts: 221
  • Karma: +20/-0
    • View Profile
Re: DOS VDM - USB and Game port Gamepad support
« Reply #71 on: December 10, 2021, 09:16:42 pm »
Thank you, that did the job.
I keep forgetting the emximp incantation all the time ;-)

Compiled HIDAPI. Now I see the usb path in the device summary, but the test still can't write to the joystick.
Because I have no experience with USB programming, I have to ask, whether this can happen with some USB devices or should it always be posible to send feature reports?
« Last Edit: December 10, 2021, 09:50:06 pm by Jochen Schäfer »

Dave Yeo

  • Hero Member
  • *****
  • Posts: 3664
  • Karma: +77/-0
    • View Profile
Re: DOS VDM - USB and Game port Gamepad support
« Reply #72 on: December 11, 2021, 03:06:53 am »
You have to change the hardcoded device id for the hid_open call, so that it points to one of the connected devices.

Does seem to work after changing the device id. Here I pressed a button.
Code: [Select]
Device Found
  type: 046d c216
  path: 1-4:1.0
  serial_number: (null)
  Manufacturer: Logitech
  Product:      Logitech Dual Action
  Release:      300
  Interface:    0
  Usage (page): 0x0 (0x0)

Manufacturer String: Logitech
Product String: Logitech Dual Action
Serial Number String: (1033)
Indexed String 1: Logitech
Feature Report
   00
waiting...
Data read:
   80 7f 80 7f 08 00 04 fc

Thanks Lars, your libusb seems to be working better compared to the last.

Lars

  • Hero Member
  • *****
  • Posts: 957
  • Karma: +46/-0
    • View Profile
Re: DOS VDM - USB and Game port Gamepad support
« Reply #73 on: December 11, 2021, 12:29:42 pm »
Thanks, I am still ironing out some bugs, in particular related to iso transfers. Just checked in again.

As to logging: if you specify "SET LIBUSB_DEBUG=4" on the commandline before running your app, then usb100.dll will dump a whole lof of logging info to stderr.

That might give a clue as to what goes wrong, if any.

Lars

  • Hero Member
  • *****
  • Posts: 957
  • Karma: +46/-0
    • View Profile
Re: DOS VDM - USB and Game port Gamepad support
« Reply #74 on: December 11, 2021, 01:09:12 pm »
1) as to running configure, I was given this shell script (content of file conf.txt):

export CFLAGS='-Zomf -Wno-attributes'
export CXXFLAGS='-Zomf -Wno-attributes'
export LDFLAGS='-Zhigh-mem -Zomf -lcx'

../git/configure --disable-static \
  --program-prefix= --prefix=/@unixroot/usr --exec-prefix=/@unixroot/usr \
  --bindir=/@unixroot/usr/bin --sbindir=/@unixroot/usr/sbin \
  --sysconfdir=/@unixroot/etc --datadir=/@unixroot/usr/share \
  --includedir=/@unixroot/usr/include --libdir=/@unixroot/usr/lib \
  --libexecdir=/@unixroot/usr/libexec --localstatedir=/@unixroot/var \
  --sharedstatedir=/@unixroot/usr/com --mandir=/@unixroot/usr/share/man \
  --infodir=/@unixroot/usr/share/info

I had to do a "sh conf.txt" in the root of my build directory, after that, I could do a "make" or "make install".

2) as to usbcalls import library: if you install RPM package "usbcalls-devel" from the NETLABS release repo, the import library is in there (in .A as well as in .LIB format)