WimDeMeester / eFinder

The software and documentation for the eFinder
0 stars 1 forks source link

Connecting hand pad #52

Closed AstroKeith closed 1 year ago

AstroKeith commented 1 year ago

I've found that the device name assigned to a USB device isn't fixed. Especially true if more than one is plugged in. Currently Display.py assumes "/dev/ttyACM1" The following script will return the actual name assigned.

import subprocess result = subprocess.check_output('ls -l /dev/serial/by-id/',shell=True) result =(result.decode('ascii')).splitlines() for n in range(len(result)): if "MicroPython" in result[n]: dev_name = "/dev/"+ result[n][-7:] print (dev_name)

WimDeMeester commented 1 year ago

Thanks @AstroKeith @mrosseel Can you add this code to the pull request?

mrosseel commented 1 year ago

My raspbian does not have the /dev/serial/by-id/ folder

On Fri, 31 Mar 2023 at 14:48, Wim De Meester @.***> wrote:

Thanks @AstroKeith https://github.com/AstroKeith @mrosseel https://github.com/mrosseel Can you add this code to the pull request?

— Reply to this email directly, view it on GitHub https://github.com/WimDeMeester/eFinder/issues/52#issuecomment-1491876329, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALFXXWDWF5EMPFAHCQEUZ3W63HBLANCNFSM6AAAAAAWNOJAGU . You are receiving this because you were mentioned.Message ID: @.***>

AstroKeith commented 1 year ago

I see. I tried it on a fresh Pi with nothing plugged into USB, and you're right. Then I hot plugged in the hand box. Still no joy. Then I rebooted the PI, with the handbox plugged in. Yey - it's there! Unplugged the handbox - it goes. Rebooted the Pi without handbox - not there. Hot plugged in the handbox - it appears.

So the safest way, is to boot up the PI with the handbox plugged in. (I find this the most stable anyway)

WimDeMeester commented 1 year ago

I tested this, and I can not see the /dev/serial/by-id folder, not even when booting with the handbox. The code is such that if /dev/serial/by-id is not known, /dev/ttyACM0 is taken.