the-via / app

GNU General Public License v3.0
736 stars 168 forks source link

Is it possible to be clearer about Linux permissions? #236

Open igorsantos07 opened 4 months ago

igorsantos07 commented 4 months ago

This is a split of one of the many issues reported at #91 (and possibly other issues around the board, such as https://github.com/the-via/releases/issues/257): on Linux, it's usually necessary to run the browser with root privileges, or otherwise give the current user permissions over /dev/hidraw* (or similar files), as pointed by wlarch.

Given the amount of people reacting to the linked solutions, it seems to affect many Linux users (if not all of them).

The only thing that the VIA app can say are two errors (one quite misleading), since it can see the keyboard, but can't really talk to it:

Failed to open the device.
Device: Keychron Keychron K10 Pro
Vid: 0x3434
Pid: 0x02A0

Received invalid protocol version from device
Device: Keychron Keychron K10 Pro
Vid: 0x3434
Pid: 0x02A0

The first one seems to be replaceable by the following in some other distros (or other keyboards):

The device must be opened first.
Device: Alicianrone
Vid: 0x414E
Pid: 0x4152

That said, it's possible to pinpoint the issue if you visit chrome://device-log (found by hofheinz and confirmed by others) - there, it complains about missing permission on the specific file.

Is there any chance the VIA app could drink from that log and tell specifically about the lack of permissions? If not, maybe could the "failed to open device" hint about a possible lack of root permissions, if the OS is Linux?

P.S.: it would be somewhat expected for this kind of issue to arise on Mac as well, but not sure if it really happens there.

maciek134 commented 2 weeks ago

You don't need to, and should never run a browser as root. All you need is a udev config, for the example pid/vid in the issue:

/etc/udev/rules.d/90-qmk.rules

SUBSYSTEM=="usb", ATTR{idVendor}=="3434", ATTR{idProduct}=="02A0", GROUP="plugdev", TAG+="uaccess"

unplug the keyboard, plug back in and it should work