timower/rM2-stuff

Keyboard input

Closed this issue · 6 comments

it seems like the keyboard is accepting input only from stylus and not touch. Anyway to fix it?
Sorry it is my first time reporting a bug I may have done it badly.

I assume this is about yaft.
Can you share which device and firmware version you're using?
I know the inputs paths changed, but I use uinput so most stuff should keep working.

I am running 2.10.2.356 rm1
Yes it is abouy yaft.

Eeems commented

@timower newer versions of the rM OS change input paths. You'll likely want to dynamically listen to input events for both pen and touch enabled devices to survive OS upgrades better.
Oxide's apps use the following to determine pen/touch/button inputs: https://github.com/Eeems/oxide/blob/master/shared/devicesettings.cpp#L18-L64

Yeah, I use udev to discover devices, that's how keyboard input works.
But to get the correct scaling and rotation of the events I still have some hard coded paths:

constexpr auto wacom_transform =
Transform{ { { 0, float(screen_width) / wacom_width },
{ -float(screen_height) / wacom_height, 0 } },
{ 0, screen_height } };
const InputPaths rm1_paths = {
// touch
"/dev/input/event1",
Transform{ { { -float(screen_width) / rm1_touch_width, 0 },
{ 0, -float(screen_height) / rm1_touch_height } },
{ screen_width, screen_height } },
// pen
"/dev/input/event0",
wacom_transform,
// keys
"/dev/input/event2"
};
const InputPaths rm2_paths = {
// touch
"/dev/input/event2",
Transform{ { { 1, 0 }, { 0, -1 } }, { 0, screen_height } },
// pen
"/dev/input/event1",
wacom_transform,
// keys
"/dev/input/event0"
};

@Eeems Is there a generic way to get the scaling and rotation from an input device?

Eeems commented

I currently hardcode it per device. There might be a way but I haven't had the need to determine it dynamically yet.

9b1a967 uses the device name instead of path, so it should be more stable. I haven't verified the rM1 names of course.