v1993 / linuxmotehook

Cemuhook-compliant WiiMote motion provider for Linux
Apache License 2.0
14 stars 0 forks source link

Problem launching in step 5 of the documentation - "Run main.lua in terminal" #3

Closed Wirexuser01 closed 4 years ago

Wirexuser01 commented 4 years ago

Hello,

First of all, thank you for your work.

The lua libraries were installed manually via luarocks. Everything works fine before step 5. At this point when I try to run main.lua, here is the error message returned:

:~/linuxmotehook$ lua main.lua

(process:32213): xwiimote-cemu-WARNING **: 02:10:56.080: Failed to parse config file presets.json: "bad argument #2 to 'json.decode' (number expected, got table)", continuing...

(process:32213): xwiimote-cemu-WARNING **: 02:10:56.080: Failed to parse config file config.json: "bad argument #2 to 'json.decode' (number expected, got table)", continuing... lua: /home/XXX/linuxmotehook/configloader.lua:126: Property UseProfile not found in config but is required stack traceback: [C]: in function 'error' /home/XXX/linuxmotehook/configloader.lua:126: in local 'resolvePropertyDT' /home/XXX/linuxmotehook/configloader.lua:195: in main chunk main.lua:54: in main chunk [C]: in ?

Did i do something wrong?

v1993 commented 4 years ago

Hmm, interesting and weird. Thank you for reporting this, I'll take a look.

v1993 commented 4 years ago

It appears that JSON module is not one my program is expecting? Have you installed anything with luarocks yourself? Does

echo "$LUA_PATH"

(in terminal) show anything?

While I'm on this, what distro/version are you using?

Wirexuser01 commented 4 years ago

Thank you for your reply.

This command line does not work on my Xubuntu 19.04. But here is the return of two other command lines:

:~/linuxmotehook$ whereis lua
lua: /usr/bin/lua /usr/bin/lua5.3 /usr/lib/x86_64-linux-gnu/lua /usr/local/bin/lua /usr/local/lib/lua /usr/include/lua5.1 /usr/include/lua5.3 /usr/share/lua /usr/share/lua5.1 /usr/share/lua5.3 /usr/share/man/man1/lua.1.gz
:~/linuxmotehook$ lua
Lua 5.3.4  Copyright (C) 1994-2017 Lua.org, PUC-Rio
> 

First, I installed the package bundle directly from the apt manager of my distribution. But it didn't work properly, things were missing. So I delete to start from scratch by installing via luarocks. With the exception oflgifrom the git source as recommended in your documentation.

I also tried with your linuxmotehook-bundle.tar.gz, which includes the libraries, but the same error is returned. In this regard, some files were not the same size as those installed locally. Anyway, even replacing them with those included in linuxmotehook-bundle.tar.gz it doesn't work.

Ps: I haven't configured any profile yet, just copy config.template.json to config.json.

v1993 commented 4 years ago

There are a lot of different modules named json for lua, so you likely installed the wrong one with luarocks. Try removing it and installing that package from (apt) repository. What is the result of that?

If this fails, I can help you with installing one with luarocks yourself. It's really recommended to use bundle unless you've worked with luarocks before.

Wirexuser01 commented 4 years ago

Thanks a lot for the clarifications.

I had never used luarocks and I accidentally installed several json for lua. The problem is now fully resolved. However, I encountered a new problem even with the right json module, so I started from scratch.

Here is how I solved the problem:

  1. Complete deletion of lua5.3 and other packages from the apt repository.
  2. Installation of lua5.3 and libxwiimote2 only. lua-json does not work by installing it from the apt repository (even if performed via the bundle).
  3. Complete deletion of lua libraries via luarocks.
  4. Installation of lua libraries via luarocks, except for lgi and luajson installed from the source.
  5. main.lua result: WiiMote successfully registered (MAC 0x0005057E0306)

I think installing luajson from source is the perfect solution for me.

Thanks again for your support, it helped me! I want to use linuxmotehook in dolphin-emu, and now I am able to use it as a DSU server.

One last thing that has nothing to do with this issue, is that the DSU client available in dolphin-emu mentions "Dualshock4". It's very strange because only my wiimote is connected.

v1993 commented 4 years ago

Glad it worked for you!

There are few more things you'd like to know:

  1. They call any DSU controller "Dualshock4". There's no way to send controller name.
  2. Git version have profile made specially for usage with dolphin, which maps all axles like real wiimote would do.
  3. You might want to check your config with either PadTest or built-in dolphin motion test (those two spheres).
  4. Until you have a good reason, why not use "Real Wiimote" or even Bluetooth passtrough? It really does have some advantages.
Wirexuser01 commented 4 years ago

Thank you for all these details, they are appreciated!

Regarding the "real wiimote", unfortunately I can not use it, the wii controller does not synchronize when Bluetooth Passthrough is active. My hardware is probably not compatible. So I use the traditional pairing (udev) integrated for the moment.

For the profile made specially for usage with dolphin, how does it name it please? I'm not sure which one it is.

Ps: For the moment, everything is working well with a custom profile based on pointed away. Only the accelerometer does not work correctly (for example, an axis does not respond in dolphin).