khampf / g13

libusb driver for the g13
23 stars 15 forks source link

Bind file not actually loading on start #11

Open Techjar opened 4 years ago

Techjar commented 4 years ago

Simple as that. The bind file passed via --config is not actually loading, despite the log claiming that it is. I enabled DEBUG and didn't get anything more than this:

1599301254 INFO  : config_fn = /etc/g13/default.bind
1599301254 INFO  : reading configuration from /etc/g13/default.bind
khampf commented 4 years ago

Good find, I have only tested making changes in /etc/g13/default.bind so it has not occured to me the loading might fail

Techjar commented 4 years ago

To be clear that is the file I am passing to --config, so it just fails to load any config as far as I can tell.

tmackay commented 4 years ago

I haven't had any issues loading config (apart from the comment thing) using the included bindfiles examples and can't see any reference to /etc/g13/default.bind - this has to be explicitly passed, right? What are the contents of your default.bind file?

Techjar commented 4 years ago

I tried putting only binds in it (no comments or other commands) and it still didn't work. Yes it is being passed via --config, though I'm not sure what the default is. In any case, if that's part of the issue then it's still a bug.

khampf commented 4 years ago

This should be quite easy to test with verbose debugging turned on. I can not access my Arch Linux right. I decided to work on my thesis in FreeBSD as Arch is full of distractions... like work on g13d... which I also have looked into porting to FreeBSD but try really hard not to look at right now

Techjar commented 4 years ago

I did turn on verbose debugging (assuming that's what --log_level DEBUG does) but did not get anything particularly useful. You can see all the relevant output in my initial comment.

tmackay commented 4 years ago

I'm happy to take a look, but as I said, I am unable to reproduce the issue - it's working fine for me (in PopOS, a Ubuntu derivative). I could fire up Arch in Vagrant to see if it's distro related, but this is pretty low level file reading? I don't see how. Can you try one of the included examples in bindfiles, so I have something to go off? I'm guessing the s.good() check is failing for some reason, what about file permissions?

Techjar commented 4 years ago

I tried chmod 777 and it still didn't work, so it's not permissions. Did you test passing a specific file path with --config?

tmackay commented 4 years ago

Yes, both relative and absolute worked for me. I even created one in /etc/g13/default.bind

Techjar commented 4 years ago

I tried starcraft2.bind and none of the keys do anything. I also tried a bind file with simply bind G1 KEY_A, same result. I removed --config and the log no longer mentions loading any config file, and of course the bindings still are not functional.

tmackay commented 4 years ago

There's not actually any further debug messages produced in that branch of code, maybe we could add something like: if (s.fail()) G13_LOG(log4cpp::Priority::DEBUG << "Error: " << strerror(errno)); Though that's probably worth more than a DEBUG

18 adds error text

nihilman commented 4 years ago

Hello, I don't understand how you do to pass your command. I use script to run different config like this:

#!/bin/bash
cat /etc/g13/default.bind > /run/g13d/g13-0