LaserWeb / LaserWeb4

Collaborative effort on the next version of LaserWeb / CNCWeb
GNU Affero General Public License v3.0
692 stars 186 forks source link

Wrong serial ports are shown in connection GUI #644

Closed BorisBrock closed 1 year ago

BorisBrock commented 2 years ago

In the connection tab I can choose between "/dev/ttyS0" ... "/dev/ttyS31". None of these work (laser cutter is not found).

I then checked other tools (e.g. Lightburn, HTerm, PlatformIO), which also can connect to serial ports. These immediately found the laser cutter at "/dev/ttyUSB0".

Is there any way I can use this port in LaserWeb, too? Entering the string "/dev/ttyUSB0" manually seems not possible.

PS: I'm using Manjaro Linux.

Laserweb-Workspace.json.txt

cprezzi commented 2 years ago

Your Laserweb-Workspace file doesn't contain the settings that it should. Can you try to export it again?

Are you running the LaserWeb frontend on the same PC as the server? LaserWeb queries the available ports from the OS (on server side). If you run the server on a different PC, you need to change the Server IP under Comms / Server Connection (in the frontend) to the IP of the server, otherwise you get the ports of the frontend PC.

If you are running all on one PC, then you might need to fiddle with the userrights to access the USB port.

BorisBrock commented 2 years ago

Hi, I restarted Laserweb and exported the Workspace again. Laserweb-Workspace2.json.txt

Regarding frontend/server: I guess so. I downloaded and started "laserweb-builder-v4.0.996-130-x86_64.AppImage". No server involved.

The user rights regarding USB seem fine. As mentioned before, all other applications can access the USB-port just fine (e.g. Lightburn, VS Code etc.). So it seems to be definitely an issue with LaserWeb.

cprezzi commented 2 years ago

Unfortunately I'm not a linux guy. I just heard from other linux users, that access to ttyUSB0 is prohibited by default. You could try to start LaserWeb as root to check that.

LaserWeb is a NodeJS Electron App that uses the chromium browser that is embedded in electron for the gui. This might be different in access rights than native Apps like Lightburn.

harlock999 commented 2 years ago

Hi, I'm using Debian and when I type ls /dev/ttyACM0 I get the following: crw-rw---- 1 root dialout 166, 0 Jul 4 09:21 /dev/ttyACM0

In your case ttyACM0 may be ttyUSB0.

The first important part is dialout. This is the group specific for my ttyACM0 port. The second important part is the second rw which means the group has read-write access. Thus any user in the dialout group would have read-write access to ttyACM0. When I type groups as a user (not root) I see a list of groups I am part of, in my case dialout is listed. Now I'm not sure about Manjaro Linux, but in Debian you could type the following: sudo usermod –a –G GroupName UserName where you replace GroupName by dialout and UserName by your user name from which you run the server.

dariusmihai commented 1 year ago

Hello. I'm also experiencing a similar issue on Laserweb desktop version. OS: Windows 11 21H2 build 22000.1098

Laserweb info: Frontend: 4.0.999 Backend: 4.1.000 Connected to lw.comm-server version 41000 - as reported by version.txt - running on Raspbian 11 (bullseye) on a Raspberry Pi Zero W

My workaround:

  1. Open the desktop app and connect to the server using the Comms page. Only use "Server Connection" at this time.
  2. Open the gui in Chrome by navigating to http://rasp.berry.ip.addr:8000 (Frontend 4.0.999, Backend 4.1.000).
  3. Go to Comms page.
  4. In the Server Connection section, connect to rasp.berry.ip.addr (not localhost, not 127.0.0.1, but the network ip) and click "Connect"
  5. In the Machine Connection section, select USB and then select the port in the "USB/SERIAL PORT" section and click "Connect"
  6. Close the browser and continue using the desktop version as usual, nothing needs to be done on the connection page. Even if the "Machine Connection" section remains empty, Laserweb desktop will work and the console will report that the connection is successful immediately after it is done from the web version.

This way the usb ports are correctly populated, as opposed to the @undefined that is displayed in the desktop version. Since both the desktop and the web versions are connected to the same lw.comm-server instance, it doesn't seem to matter which one triggers the USB connection, they both work as long as at least one of them does the usb connection successfully.

Note: While gathering version info for this message, I noticed that ~there is a newer version (4.0.999-138)~ which says that one of the solved problems is "memory leak @ each connect for usb port list". I'll post an update once I get the chance to test that.

Update: I'm already on 4.0.999-138. I checked the installer and it's 4.0.999-138. Not sure why the application shows the "New versions for windows" section on the About screen.

This is the screenshot of the USB/Serial Port dropdown after the server connection is made. The first option is an empty string and the second one is 1a86 @ undefined and neither can be selected.

image

For comparison, this is the web version - both options have correct values and are selectable:

image
cprezzi commented 1 year ago

@dariusmihai What you describe is a different issue. The Linux issue is caused by missing dialout access rights on some linux distros.

What you describe is a configuration mistake. When you start the LW desktop app you first need to change the Server Connection from localhost:8000 to raspi-ip:8000 and click connect to establish a connection with the lw.comm-server on the Raspberry Pi. After that you get the USB ports of the raspi, otherwise you get the ports of the PC that runs the app.

dariusmihai commented 1 year ago

@cprezzi No that's not it. Here is a screenshot: image

I'm already connected to the raspberry pi IP, so I don't think it's a configuration mistake.

In the previous screenshots it's the same 2 ports that are displayed correctly in the browser version, but on desktop one of them is an empty string and the other one is 1a86 @undefined

cprezzi commented 1 year ago

@dariusmihai Then you might have used a too new lw.comm-server which is not compatible with the actual desktop app. Only older lw.comm-server is compatible with the app. See https://github.com/LaserWeb/LaserWeb4/issues/649

dariusmihai commented 1 year ago

Thank you for the clarification @cprezzi, it could be related to that.