Jump to content
The simFlight Network Forums

hiddemo.lua doesn't see my device


Recommended Posts

Hi,

I'm using a controller based on some obscure (well, it seems more popular in Eastern Europe) homebrew board called "MJOY16". While it doesn't actually have more than 32 physical buttons, it does spread out the button events over the modern DirectInput range, so there are events that FSUIPC can't see without help.

As I understand it, the way to go is to adapt hiddemo.lua to my needs, but I've immediately hit a snag. According to hidscanner.exe, the device appears to use a "fake" Vendor ID (0x0000) and empty informational strings:

 Device at "\\?\HID#VID_0000&PID_0002#7&8a8d5bc&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}"
  Vendor=0000, Product=0002 (Version 1.3)
  Manufacturer=
  Product=
  Serial Number=
  Usage Page: 1
  Input Report Byte Length: 8
  Output Report Byte Length: 0
  Feature Report Byte Length: 0
  Number of Link Collection Nodes: 1
  Number of Input Button Caps: 3
  Number of InputValue Caps: 10
  Number of InputData Indices: 122
  Number of Output Button Caps: 0
  Number of Output Value Caps: 0
  Number of Output Data Indices: 0
  Number of Feature Button Caps: 0
  Number of Feature Value Caps: 0
  Number of Feature Data Indices: 0
  Buttons range 57 -> 96 at indices 56 -> 95
  Buttons range 97 -> 112 at indices 102 -> 117
  Value POV at index 96, range 0 -> 7, using 4 bits
  Value 0x01 at index 97, range 0 -> 7, using 4 bits
  Value U/RX at index 98, range -512 -> 511, using 10 bits
  Value Z at index 99, range -512 -> 511, using 10 bits

When I try to open this device from hiddemo.lua, I get the message "Could not open HID":

  1208422 LUA.0: beginning "C:\Lockheed Martin\P3Dv42\Modules\HidDemo.lua"
  1208422 LUA.0: Global: ipcPARAM = 0
  1208422 LUA.0: Global: Vendor = 0
  1208422 LUA.0: Global: Product = 2
  1208422 LUA.0: Global: Device = 0
  1208437 LUA.0: Global: Logging = true
  1208437 LUA.0: Global: Pollrate = 25
  1208437 LUA.0: Global: Report = 0
  1208437 LUA.0: Global: dev = 0
  1208437 LUA.0: Could not open HID

I'm not sure what I could be doing wrong this early in the process, so I wonder whether that com.* library might refuse to open the device because of the "special" Vendor ID or something like that?

Is there anything I can do about that?

Thanks,
Marc

 

 

Edited by aurel42
Link to comment
Share on other sites

8 hours ago, aurel42 said:

I'm not sure what I could be doing wrong this early in the process, so I wonder whether that com.* library might refuse to open the device because of the "special" Vendor ID or something like that?

Ouch! It's the VendorID being zero. The code assumes that zero is an omitted value, so either a zero VID or zero PID would give this result UNLESS the names were used instead. But it looks like there's no Vendor (Manufacturer) name and no Product name! That is really bad -- they've broken all the rules for HID devices! 😞

You could see if it will work with "" (the null string) for the VID and PID parameters. That should get it passed the first checks.

Otherwise I will see if I can fix this somehow in the next interim update of FSUIPC5. I hope you ARE using P3D4, as I'm not developing FSUIPC4 any more.

Pete

 

 

 

Link to comment
Share on other sites

Thanks for the advice (null string), I will try that tonight. I won't get my hopes up just yet, I do need the numeric PID, because I actually have two of those MJOY16 devices; and it seems likely that "" would match any of the other game controllers. Maybe VID='' and PID=2 (or PID=3, for the second device) will work to identify the device.

I would appreciate a fix in FSUIPC5, I am indeed using the latest and greatest P3D.

Thank you very much for your help,
Marc

Link to comment
Share on other sites

Oh, one more thing: Windows displays unique names for the devices (in my case: "TRTL" and "MJ16"). The names indicate that they're indeed provided by the controllers ("TRTL" being shorthand for "throttle", "MJ16" for "MJOY16").

I have no idea whether there are additional information fields in the USB protocol which are ignored by hidscanner.exe while Windows can use them for device naming, or whether the creator of the MJOY16 board does something non-standard for the "Product" field which results in the field being parsed somehow by Windows while at the same time appearing empty to hidscanner.exe.

Maybe those device names ("TRTL", "MJ16") could be used to identify the devices?

I would be happy to provide debug information or a dump of the USB handshake or something like that; if you consider that useful, please just let me know what to do.

Marc

Link to comment
Share on other sites

20 minutes ago, aurel42 said:

I do need the numeric PID, because I actually have two of those MJOY16 devices; and it seems likely that "" would match any of the other game controllers. Maybe VID='' and PID=2 (or PID=3, for the second device) will work to identify the device.

No. I think that won't be a difference in PID, if the devices are the same. In HIDDEMO it is the Device number which needs incrementing.

9 minutes ago, aurel42 said:

Oh, one more thing: Windows displays unique names for the devices (in my case: "TRTL" and "MJ16"). The names indicate that they're indeed provided by the controllers ("TRTL" being shorthand for "throttle", "MJ16" for "MJOY16").

Well, the values I can read are those shown in the HIDscanner output. Are you sure those names are not just in the Registry, maaybe installed by a driver? What does the FSUIPC5.LOG show?

Try the "" string values first,.

Pete

 

Link to comment
Share on other sites

27 minutes ago, Pete Dowson said:

No. I think that won't be a difference in PID, if the devices are the same. In HIDDEMO it is the Device number which needs incrementing.Try the "" string values first,.

I understand why you would think that, but, in my case, the two devices (actually it's one physical device with two controller boards and two USB connections) really have two different PIDs (see log below). The wonders of homebrew devices. 🙂

 

Quote

Well, the values I can read are those shown in the HIDscanner output. Are you sure those names are not just in the Registry, maaybe installed by a driver? What does the FSUIPC5.LOG show?

Yes, I'm sure, I did not install any drivers or software for the devices. I plugged them in and they immediately showed up as "TRTL" and "MJ16" in Win's "USB game controller" dialog. They are handled by the default HID drivers that come with Windows. The only possible source for the identifiers "TRTL" and "MJ16" is the devices.

Here's the log excerpt:

      109 ---------------------- Joystick Device Scan -----------------------
      125 Product= Joystick - HOTAS Warthog
      125    Manufacturer= Thustmaster
      125    Vendor=044F, Product=0402 (Version 1.0)
      172    GUIDs returned for product: VID_044F&PID_0402:
      172       GUID= {5BBFA880-8594-11E6-8001-444553540000}
      172       Details: Btns=19, POVs=(0, 0, 0, 0), Cal=x00000000, Max=R0,U0,V0,X65535,Y65535,Z0
      172 Product= Control Manager ID #00
      172    Manufacturer= Control Manager ID #00
      172    Serial Number= Control Manager ID #00
      172    Vendor=068E, Product=C0F2 (Version 0.0)
      172    GUIDs returned for product: VID_068E&PID_C0F2:
      172       GUID= {2B876BE0-E803-11E6-8001-444553540000}
      172       Details: Btns=0, POVs=(0, 0, 0, 0), Cal=x00000000, Max=R0,U0,V0,X255,Y255,Z255
      172 Product= 
      172    Vendor=0000, Product=0002 (Version 1.3)
      172    GUIDs returned for product: VID_0000&PID_0002:
      172       GUID= {B309EF20-A4C7-11E8-8001-444553540000}
      172       Details: Btns=112, POVs=(0, 0, 0, 0), Cal=x00000000, Max=R511,U511,V511,X511,Y511,Z511
      187 Product= 
      187    Vendor=0000, Product=0003 (Version 1.3)
      187    GUIDs returned for product: VID_0000&PID_0003:
      187       GUID= {A82A1320-A4AC-11E8-8001-444553540000}
      187       Details: Btns=112, POVs=(0, 0, 0, 0), Cal=x00000000, Max=R511,U511,V511,X511,Y511,Z511
      187 Product= Throttle - HOTAS Warthog
      187    Manufacturer= Thrustmaster
      187    Vendor=044F, Product=0404 (Version 1.0)
      187    GUIDs returned for product: VID_044F&PID_0404:
      187       GUID= {DF43BF50-8591-11E6-800A-444553540000}
      187       Details: Btns=32, POVs=(0, 0, 0, 0), Cal=x00000000, Max=R16383,U1023,V0,X1023,Y1023,Z16383
      187 -------------------------------------------------------------------
      187 Device acquired for use:
      187    Joystick ID = 3 (Registry okay)
      187    3=Joystick - HOTAS Warthog
      187    3.GUID={5BBFA880-8594-11E6-8001-444553540000}
      187 Device acquired for use:
      187    Joystick ID = 0 (Registry okay)
      187    0=CH Pro Pedals USB
      187    0.GUID={2B876BE0-E803-11E6-8001-444553540000}
      187 Device acquired for use:
      187    Joystick ID = 2 (Registry okay)
      187    2=MJ16
      187    2.GUID={B309EF20-A4C7-11E8-8001-444553540000}
      187 Device acquired for use:
      187    Joystick ID = 1 (Registry okay)
      187    1=TRTL
      187    1.GUID={A82A1320-A4AC-11E8-8001-444553540000}
      187 Device acquired for use:
      187    Joystick ID = 4 (Registry okay)
      187    4=Throttle - HOTAS Warthog
      187    4.GUID={DF43BF50-8591-11E6-800A-444553540000}
      187 -------------------------------------------------------------------

In case you're curious, this is the device in question: 

 

 

I really appreciate your help, I understand that the trouble is caused by the unconventional approach the designers took with their homebrew solution and that I'm asking you to make FSUIPC work around their flaws. 😞

Thanks,
Marc

Link to comment
Share on other sites

27 minutes ago, aurel42 said:

I understand why you would think that, but, in my case, the two devices (actually it's one physical device with two controller boards and two USB connections) really have two different PIDs (see log below).

Ouch. Okay, then. I'll have to track through the code to see where I can get through with a zero VID -- but always a non-zero PID. I could probably "fiddle" that okay. But obviously I can't test here so please send me an email (petedowson@btconnect.com) and I can send you a link to download a test version of FSUIPC5 when I think I've done.

Also, it is interesting that in the Registry they do have names:

25 minutes ago, aurel42 said:

187 Device acquired for use:
187 Joystick ID = 2 (Registry okay)
187 2=MJ16
187 2.GUID={B309EF20-A4C7-11E8-8001-444553540000}
187 Device acquired for use:
187 Joystick ID = 1 (Registry okay)
187 1=TRTL 187 1.GUID={A82A1320-A4AC-11E8-8001-444553540000}

Pete

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.