Closed eiswind closed 1 year ago
Hi @eiswind - thanks for the report - so you had Ubuntu 21.04 running with Projecteur and updated to 21.10 - did I get that right?
Yes. I had some older version of projecteur on 21.04, updated to 0.9.2 when I found that it doesn't work anymore, but that did not help ... :) Let be know if I can be of any assistance.
same thing happening on NixOS with gnome 41.1 (on wayland) with 0.9.2 as well as https://github.com/jahnf/Projecteur/pull/173 , x11 works though.
Thank you for reporting. In the last few months I could not pay much attention to the project.
Question @benneti, did you test it with the latest version from the develop
branch?
for #173 - on that feature branch unfortunately nothing has happened yet. 🙁
I just double checked with https://github.com/jahnf/Projecteur/commit/21e5e606ff2fb5daf712d66fc2a77cdb7aa3cdde and the cursor still does not move. Maybe it is similar to this problem: https://github.com/Plagman/gamescope/issues/33 and https://bbs.archlinux.org/viewtopic.php?id=228032 .
If it is something like that, an option to keep the os device of the mouse and disable the virtual mouse would be a simple workaround.
EDIT: some more links: https://github.com/ValveSoftware/steam-for-linux/issues/4738#issuecomment-271682124 https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/431
Ok so this might be relevant: On starting projecteur, I see
KERNEL[4924.721502] add /devices/virtual/input/input47/event23 (input)
KERNEL[4924.721527] add /devices/virtual/input/input47/mouse3 (input)
UDEV [4924.723389] add /devices/virtual/input/input47/mouse3 (input)
UDEV [4924.740647] add /devices/virtual/input/input47/event23 (input)
in udevadm monitor
and then moving the pointer leads to
event23 POINTER_MOTION +5.041s 94.00/ 40.00 (+47.00/+20.00)
event23 POINTER_MOTION +5.057s 74.00/ 18.00 (+37.00/ +9.00)
event23 POINTER_MOTION +5.065s 52.00/ -4.00 (+26.00/ -2.00)
event23 POINTER_MOTION +5.073s 32.00/-24.00 (+16.00/-12.00)
event23 POINTER_MOTION +5.081s 18.00/-44.00 ( +9.00/-22.00)
event23 POINTER_MOTION +5.097s 6.00/-66.00 ( +3.00/-33.00)
event23 POINTER_MOTION +5.105s -4.00/-86.00 ( -2.00/-43.00)
event23 POINTER_MOTION +5.113s -8.00/-106.00 ( -4.00/-53.00)
event23 POINTER_MOTION +5.121s -14.00/-122.00 ( -7.00/-61.00)
event23 POINTER_MOTION +5.137s -14.00/-138.00 ( -7.00/-69.00)
event23 POINTER_MOTION +5.145s -20.00/-152.00 (-10.00/-76.00)
event23 POINTER_MOTION +5.153s -22.00/-162.00 (-11.00/-81.00)
event23 POINTER_MOTION +5.161s -26.00/-168.00 (-13.00/-84.00)
when running libinput debug-events
but the pointer does not move.
However when quitting projecteur (the virtual inputs get removed) and cursor moves and I see
event25 POINTER_MOTION +0.106s -142.00/136.00 (-71.00/+68.00)
event25 POINTER_MOTION +0.114s -130.00/164.00 (-65.00/+82.00)
event25 POINTER_MOTION +0.122s -110.00/180.00 (-55.00/+90.00)
event25 POINTER_MOTION +0.130s -86.00/182.00 (-43.00/+91.00)
event25 POINTER_MOTION +0.146s -64.00/176.00 (-32.00/+88.00)
event25 POINTER_MOTION +0.154s -40.00/164.00 (-20.00/+82.00)
event25 POINTER_MOTION +0.162s -18.00/152.00 ( -9.00/+76.00)
event25 POINTER_MOTION +0.170s 28.00/142.00 (+14.00/+71.00)
event25 POINTER_MOTION +0.186s 48.00/132.00 (+24.00/+66.00)
event25 POINTER_MOTION +0.194s 66.00/124.00 (+33.00/+62.00)
event25 POINTER_MOTION +0.202s 82.00/118.00 (+41.00/+59.00)
event25 POINTER_MOTION +0.210s 102.00/110.00 (+51.00/+55.00)
event25 POINTER_MOTION +0.226s 120.00/102.00 (+60.00/+51.00)
event25 POINTER_MOTION +0.234s 134.00/ 90.00 (+67.00/+45.00)
now comparing udevadm info /dev/input/event25
P: /devices/pci0000:00/0000:00:01.3/0000:02:00.0/usb1/1-10/1-10:1.1/0003:046D:C53E.0019/input/input40/event25
N: input/event25
L: 0
S: input/by-id/usb-Logitech_USB_Receiver-if01-event-mouse
S: input/by-path/pci-0000:02:00.0-usb-0:10:1.1-event-mouse
E: DEVPATH=/devices/pci0000:00/0000:00:01.3/0000:02:00.0/usb1/1-10/1-10:1.1/0003:046D:C53E.0019/input/input40/event25
E: DEVNAME=/dev/input/event25
E: MAJOR=13
E: MINOR=89
E: SUBSYSTEM=input
E: USEC_INITIALIZED=2206419819
E: PATH=/nix/store/5j8dddibhvd930gyp3pilif7lvqbia3k-udev-path/bin:/nix/store/5j8dddibhvd930gyp3pilif7lvqbia3k-udev-path/sbin
E: LIBINPUT_DEVICE_GROUP=3/46d/c53e:usb-0000:02:00.0-10
E: ID_INPUT=1
E: ID_INPUT_MOUSE=1
E: ID_VENDOR=Logitech
E: ID_VENDOR_ENC=Logitech
E: ID_VENDOR_ID=046d
E: ID_MODEL=USB_Receiver
E: ID_MODEL_ENC=USB\x20Receiver
E: ID_MODEL_ID=c53e
E: ID_REVISION=4101
E: ID_SERIAL=Logitech_USB_Receiver
E: ID_TYPE=hid
E: ID_BUS=usb
E: ID_USB_INTERFACES=:030101:030102:030000:
E: ID_USB_INTERFACE_NUM=01
E: ID_USB_DRIVER=usbhid
E: ID_PATH=pci-0000:02:00.0-usb-0:10:1.1
E: ID_PATH_TAG=pci-0000_02_00_0-usb-0_10_1_1
E: ID_FOR_SEAT=input-pci-0000_02_00_0-usb-0_10_1_1
E: DEVLINKS=/dev/input/by-id/usb-Logitech_USB_Receiver-if01-event-mouse /dev/input/by-path/pci-0000:02:00.0-usb-0:10:1.1-event-mouse
E: TAGS=:seat:uaccess:
E: CURRENT_TAGS=:seat:uaccess:
to udevadm info /dev/input/event23
P: /devices/virtual/input/input48/event23
N: input/event23
L: 0
E: DEVPATH=/devices/virtual/input/input48/event23
E: DEVNAME=/dev/input/event23
E: MAJOR=13
E: MINOR=87
E: SUBSYSTEM=input
E: USEC_INITIALIZED=5488016370
E: PATH=/nix/store/5j8dddibhvd930gyp3pilif7lvqbia3k-udev-path/bin:/nix/store/5j8dddibhvd930gyp3pilif7lvqbia3k-udev-path/sbin
E: LIBINPUT_DEVICE_GROUP=5/17ef/60db*
E: ID_INPUT=1
E: ID_INPUT_MOUSE=1
E: ID_INPUT_KEY=1
E: ID_INPUT_KEYBOARD=1
E: ID_SERIAL=noserial
E: TAGS=:power-switch:seat:uaccess:
E: CURRENT_TAGS=:power-switch:seat:uaccess:
I have no particular idea what could break it but for me only
the missing ID_TYPE=hid
or the different TAGS
would make sense
EDIT: ID_TYPE=hid does not help with the movement but at least I now have
Device: Projecteur_input_device
Kernel: /dev/input/event23
Group: 8
Seat: seat0, default
Capabilities: keyboard pointer
Tap-to-click: n/a
Tap-and-drag: n/a
Tap drag lock: n/a
Left-handed: disabled
Nat.scrolling: disabled
Middle emulation: disabled
Calibration: n/a
Scroll methods: button
Click methods: none
Disable-w-typing: n/a
Accel profiles: flat *adaptive
Rotation: n/a
in libinput list-devices
.
Any news at this point. Would love to use your tool but unfortunately it's not working (same as above) in ubuntu 21.10 :-/
Yes, sorry I couldn't allocate time for Projecteur.
So it seems it is a two-folded problem.
I will need to install 21.10 in a VM and do some issue tracking. I will try to do that during next week.
A question for users on X11 on Ubuntu 21.10:
--disable-uinput
? (This will essentially also disable custom key mappings)Ah thanks projecteur --disable-uinput
works for me on wayland (with the normal circle pointer)!
Ah thanks
projecteur --disable-uinput
works for me on wayland (with the normal circle pointer)!
Good to know, of course the nice feature of mapping custom inputs is disabled 😞 - so this is only kind of a workaround. Seems one issue is around the area of grabbing all the device input and feeding it (mapped) to a virtual uinput device. That definitely narrows down my issue tracking.
indeed, but it is far better than a pointer that does not move :sweat_smile:
Now that Ubuntu 22.04 is released I will check with that release and see if anything from earlier versions changed in regards to the uinput
device handling.
Edit: @eiswind In case you updated already to 22.04 (I haven't yet) - is the issue the same on 22.04?
It is definitely related on how to uinput
and wayland on newer distribution releases. Sadly I do not have a quick fix or workaround at the moment. I need to see how other projects might solve this issue.
I know such time problems too well...... So thanks a million that the tool exists at all with such comprehensive functionality!
Yes, I can confirm that in a regular 22.04-setup (no vm, fresh install yesterday). On 18.04 it works out of the box with your binary. On 22.04 the above workaround is necessary. However, it is strange that everything worked during the very first start-up on 22.04. Then I switched to Win10 (dual boot machine), installed the respective app and configured the device. Back in 22.04 no movement anymore. The Pointer with all features is displayed though. Maybe this is a useful additional information or just coincidence?
Thanks @jahnf for the wonderful work. Hopefully I can continue working on Projecteur, it would be great to have it running on Ubuntu 22.04 100%. I'm not a developer, but if I can collaborate with something, with testing or with any situation, I'm attentive. This is the only alternative to bring Logitech Spotlight to life on Linux-Ubuntu.
When executing: projecteur --disable-uinput
the following error messages appear:
[2022-09-15T00:01:26.086][inf][default] Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
[2022-09-15T00:01:26.283][inf][projecteur.device] Virtual device initialization was skipped.
[2022-09-15T00:01:26.427][wrn][projecteur.mainapp] Qt 'xcb' platform and Wayland session detected.
[2022-09-15T00:01:26.492][inf][projecteur.device] Connected device: Logitech Spotlight (Bluetooth) (046d:b50e)
[2022-09-15T00:01:30.030][err][projecteur.desktop] Screenshot via GNOME DBus interface failed.
[2022-09-15T00:01:34.698][err][projecteur.desktop] Screenshot via GNOME DBus interface failed.
[2022-09-15T00:01:42.145][err][projecteur.desktop] Screenshot via GNOME DBus interface failed.
[2022-09-15T00:01:52.832][err][projecteur.desktop] Screenshot via GNOME DBus interface failed.
[2022-09-15T00:01:58.402][err][projecteur.desktop] Screenshot via GNOME DBus interface failed.
[2022-09-15T00:02:04.094][err][projecteur.desktop] Screenshot via GNOME DBus interface failed.
[2022-09-15T00:34:55.631][err][projecteur.desktop] Screenshot via GNOME DBus interface failed.
[2022-09-15T00:34:58.066][err][projecteur.desktop] Screenshot via GNOME DBus interface failed.
[2022-09-15T00:35:06.220][err][projecteur.desktop] Screenshot via GNOME DBus interface failed.
[2022-09-15T00:35:12.464][err][projecteur.desktop] Screenshot via GNOME DBus interface failed.
[2022-09-15T00:35:15.780][err][projecteur.desktop] Screenshot via GNOME DBus interface failed.
[2022-09-15T00:35:20.847][err][projecteur.desktop] Screenshot via GNOME DBus interface failed.
[2022-09-15T00:35:26.033][err][projecteur.desktop] Screenshot via GNOME DBus interface failed.
[2022-09-15T00:35:34.595][err][projecteur.desktop] Screenshot via GNOME DBus interface failed.
[2022-09-15T00:35:38.622][err][projecteur.desktop] Screenshot via GNOME DBus interface failed.
[2022-09-15T00:35:42.600][err][projecteur.desktop] Screenshot via GNOME DBus interface failed.
[2022-09-15T00:35:47.949][err][projecteur.desktop] Screenshot via GNOME DBus interface failed.
SO: Ubuntu 22.04 Projecteur versión: 1.0-alpha.120 (for Ubuntu 21.10)
@khalil-i-o, thats a great idea. @jahnf: You are very welcome to contact me too if testing is necessary.
TL;DR; read Edit2!
I did some investigation and found out something interesting.
I recorded the movement with libinput record /dev/input/event## > file.yml
and compared the records from the original with moving cursor and from the virtual device without a moving cursor.
libinput replay file.yml
did what anyone would expect: when replaying the record of the original device, the cursor moves, replaying the virtual device doesn't move.
BUT: If you change the line in the record file of the virtual device at position devices[0].codecs.1
(EV_KEY) to the same value given in the record of the original device, the cursor moves when replaying. Yaaay! (i.e. [272..287] instead of [1..767]). To get rid of the upcoming warning device is missing recorded udev property
, I tried [1..287] and it still works but without this kind of warning (I still get the warning unexpected property: LIBINPUT_DEVICE_GROUP
but I guess, this is a different topic)
I don't know if this helps figuring out what the actual problem is, but I hope it helps a little ;)
Oh, BTW: running fedora 37 workstation on gnome 43.2 with wayland and rpm-installation.
EDIT: I seems there is a problem with key-codes above 562 (0x232). I.e. changing KEY_CNT
to KEY_ROTATE_LOCK_TOGGLE
in https://github.com/jahnf/Projecteur/blob/323532fcd420f761b885e1a7c68161789aa73dc1/src/virtualdevice.cc#L76 should do the trick. I don't know, if this has side-effects, it probably crashes key-combinations with keys above this keycode and the root of the problem is still unknown. I mean, whats the problem with keys like KEY_BRIGHTNESS_MENU
(649 / 0x289). It makes also no sense, that it "breaks" at this position. There are no keycodes defined between 562 / 0x232 and 575 / 0x23f. linux/input-event-codes.h
EDIT2: I think I got it:
ID_INPUT_KEYBOARD, ID_INPUT_KEY, ID_INPUT_MOUSE, ID_INPUT_TOUCHPAD, ID_INPUT_TOUCHSCREEN, ID_INPUT_TABLET, ID_INPUT_JOYSTICK, ID_INPUT_ACCELEROMETER If any of the above is set, libinput initializes the device as the given type, see Device type assignment via udev. Note that for historical reasons more than one of these may be set at any time, libinput will select only one of these to determine the device type. To ensure libinput selects the correct device type, only set one of them. https://wayland.freedesktop.org/libinput/doc/1.10.7/udev_config.html
long story short: We will need two virtual devices, one for the virtual mouse and one for the keyboard. I don't know, what the difference between ID_INPUT_KEY
and ID_INPUT_KEYBOARD
is, but this seems to be a valid combination “for historical reasons”. At least my cherry-keyboard has this combination and it works.
EDIT3: Everything with key-ids between BTN_MOUSE
(272 / 0x110) and BTN_JOYSTICK - 1
(287 / 0x11f) is considered a mouse, everything else is not. (udev-builtin-input_id.c#L185). This correlates with the keycodes of the original device. ID_INPUT_KEY
is always set with ID_INPUT_KEYBOARD
(udev-builtin-input_id.c#L299-L308)
EDIT4: Changing the keycodes to the mentioned above brings back the mouse-functionality but disables all keymappings (for obvious reasons). skipping them brings the mappings back to libinput debug-events
but it still doesn't work, although udevadm
doesn't mention ID_MOUSE=1
anymore.
EDIT5: I tried the following code:
// Set all key code bits on virtual device
const bool keyboard = true;
const bool mouse = true;
const bool upper_keys = true;
if (keyboard) {
for (int i = 1; i < BTN_MISC; ++i) {
ioctl(fd, UI_SET_KEYBIT, i);
}
}
if (mouse) {
for (int i = BTN_MISC; i < KEY_OK; ++i) {
ioctl(fd, UI_SET_KEYBIT, i);
}
}
if (keyboard) {
for (int i = KEY_OK; i < KEY_MACRO1; ++i) {
ioctl(fd, UI_SET_KEYBIT, i);
}
}
if (upper_keys) {
for (int i = KEY_MACRO1; i < KEY_CNT; ++i) {
ioctl(fd, UI_SET_KEYBIT, i);
}
}
keyboard with anything else (current state: all true): (KMU, KM, KU)
only keyboard: (K)
mouse with or without upper_keys: (MU, M)
everything false or only upper_keys: (U, ø)
conclusion: mouse and keyboard must not be used in the same virtual device if the mouse-button and keymappings should work. upper_keys crash the keyboard. I didn't check the spotlight functionality on all 8 combinations, it behaves different and there are probably some independent issues with wayland.
Wow thank you @Blaimi for the detailed investigation - that is very useful - I will use your input to create a fix!!
@Blaimi @benneti @eiswind @markoott
If possible please test a version build from the https://github.com/jahnf/Projecteur/tree/bugfix/input-virtualdevice branch. I integrated the results of @Blaimi 's investigation.
Thank you very much in advance
Also as artifacts available attached to this action run: https://github.com/jahnf/Projecteur/actions/runs/4285629256
sorry for the late reply, tested it now on several occasions and so far the new branch is working great for me with gnome+wayland.
Description I installed projecteur-0.9.2_ubuntu-21.04-x86_64.deb, and updated my machine to 21.10. w/o Projecteur running I can move the mouse and use the next/back button. when I start projecteur, the highlight apperears when I press the button, but I cannot move it at all, also back/next shows no action. Happens both on wayland and x11.
Desktop/Linux Environment (please complete the following information):
Desktop/Window Manager and Version [e.g. GNOME 3.28, KDE 5.4...]
gnome 40.4.0 on wayland or x11
Did you built Projecteur yourself?:
[y/n]
no (If yes: Please run cmake for existing build directories, to ensure the generated version info is up to date)What is the output of
projecteur -f
?: ... Projecteur 0.9.2git-branch: master
git-hash: 82d9cfac1082a5cf28debb79a7be732fabf4dfd4
compiler: GNU 10.2.1
qt-version: (build: 5.15.2, runtime: 5.15.2)
device-scan: (errors: 0, devices: 1 [readable: 1, writable: 1])
What is the output of
projecteur -d
?: ... Projecteur 0.9.2; device scanFound 1 supported devices. (1 readable, 1 writable)
+++ name: 'SPOTLIGHT' userName: 'Logitech Spotlight (Bluetooth)' vendorId: 046d productId: b503 phys: 64:6e:e0:5a:27:e1 busType: Bluetooth devices: /dev/input/event21, /dev/input/event20 readable: true writable: true