aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2025-05-09 07:04:31 -0400
committerB. Watson <urchlay@slackware.uk>2025-05-09 07:04:31 -0400
commit6945d551317f9edcb106cfa528cf08499b7a636d (patch)
tree127b58c7d9bd99b61d4f5103c7f26a72f0a8435e
parentb3f612a055a426af38c35b8d03e23c698399a67c (diff)
downloadmarsond-6945d551317f9edcb106cfa528cf08499b7a636d.tar.gz
print /sys path to input device if debugging.
-rw-r--r--TODO1
-rw-r--r--marsond.c11
2 files changed, 9 insertions, 3 deletions
diff --git a/TODO b/TODO
index db24462..46b71a2 100644
--- a/TODO
+++ b/TODO
@@ -7,6 +7,5 @@ Maybe:
might interfere with stuff like JACK.
- use a log file instead of stderr, so we can have error/warning messages
after detaching from the tty.
-- print our /dev/input/event* node name, if possible.
- options to set the virtual device name and vendor/product IDs. would anyone
ever need this?
diff --git a/marsond.c b/marsond.c
index 2bc65f0..f438aa0 100644
--- a/marsond.c
+++ b/marsond.c
@@ -313,7 +313,7 @@ int main(int argc, char **argv) {
if(ioctl(outfd, UI_SET_KEYBIT, i) >= 0) {
/* we don't wanna be *that* verbose */
} else {
- die("UI_SET_KEYBIT failed: %s", strerror(errno));
+ die("UI_SET_KEYBIT %d failed: %s", i, strerror(errno));
}
}
debug("UI_SET_KEYBIT OK");
@@ -338,7 +338,14 @@ int main(int argc, char **argv) {
/* I was hoping the return value of this ioctl would be the
device number, but it's just 0 for no error. */
if(ioctl(outfd, UI_DEV_CREATE) >= 0) {
- debug("created virtual keyboard device");
+ if(debugging) {
+ char name[64];
+ if(ioctl(outfd, UI_GET_SYSNAME(sizeof(name)), name) >= 0) {
+ debug("created virtual keyboard device: /sys/devices/virtual/input/%s/", name);
+ } else {
+ debug("created virtual keyboard device but couldn't get its name (weird)");
+ }
+ }
} else {
die("UI_DEV_CREATE failed: %s", strerror(errno));
}