derkyjadex / M8WebDisplay

Display for headless M8 tracker
https://derkyjadex.github.io/M8WebDisplay/
MIT License
196 stars 39 forks source link

Fails to connect to serial on linux #1

Closed JakeWorrell closed 3 years ago

JakeWorrell commented 3 years ago

Hi As above, I cannot get Chrome to connect to my Teensy. I'm on Ubuntu 20.04.2 LTS and have Chrome Version 88.0.4324.96. Here's my console contents:

connect @ (index):127
async function (async)
connect @ (index):127
(anonymous) @ (index):127
(index):127 Uncaught (in promise) TypeError: Cannot read property 'write' of undefined
    at SerialConnection.disconnect ((index):127)
    at SerialConnection.connect ((index):127)
disconnect @ (index):127
connect @ (index):127
async function (async)
connect @ (index):127
(anonymous) @ (index):127
JakeWorrell commented 3 years ago

For what it's worth, Chrome has just updated to 88.0.4324.150 and the behaviour is still the same

derkyjadex commented 3 years ago

I've managed to recreate this in a VM and there's a bug in the code that needs fixing, but the problem ultimately seems to come down to permissions.

The way Ubuntu is set up means that only members of the dialout group are able to open the serial port on the M8 (other distros may have different policies). Users don't appear to be in this group by default. You can add yourself to the group with the following command in the terminal:

sudo adduser $USER dialout

Logging out and back in again should be enough for this to take effect (for some reason I had to do a full reboot 🤷‍♂️ ). In any case, once I was in the group I could connect the to the M8 in Chrome and get the display working (the sound isn't working for me but I don't know how much that has to do with my specific VM set up).

I'll need to fix the bug that's stopping the error message from displaying and update the text it with some information about permissions.

JakeWorrell commented 3 years ago

Thanks @derkyjadex I will try adding myself to the group and trying again in the next couple of days and report back

JakeWorrell commented 3 years ago

Can confirm adding myself to the group and rebooting fixed this. Also audio seems to work fine for me after fiddling with the setting in Ubuntu so I think it is safe to assume the problem you saw was related to your VM set up.

Thanks