-
-
Notifications
You must be signed in to change notification settings - Fork 398
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
using a stable /dev --port name on Linux #2845
Comments
I attempted a similar thing with the same result - I have to use $(readlink -f <udev_name>). I believe it's because the underlying serial library is very strict about the port names it will accept. So I'm not sure it's something arduino-cli can fix by itself. There was also some discussion about the issue here: arduino/Arduino#6776 |
Thanks, Oliver. I had not seen that issue. I decided to hack my udev rule to look like this: SUBSYSTEM=="tty", ATTRS{idVendor}=="239a", ATTRS{idProduct}=="80cd", SYMLINK+="ttyACM000" I don't think anyone else will generate /dev/ttyACM000, and it matches the regex filter. It would be helpful if arduino-cli had a clearer error message when the device name does not match the regex filter. |
I think that the message Could you run the upload command with the |
Thank you, yes, Christian, it looks like the "failed" message is from bossac. $ ls -l /dev/ttyA* /dev/fea* with /dev/feather_m4_can $ arduino-cli upload --port /dev/feather_m4_can --fqbn adafruit:samd:adafruit_feather_m4_can myprog --input-dir /home/me/lib/ardbin/myprog with /dev/feather_m4_can -v $ arduino-cli upload -v --port /dev/feather_m4_can --fqbn adafruit:samd:adafruit_feather_m4_can myprog --input-dir /home/me/lib/ardbin/myprog with /dev/ttyACM000 slinked to /dev/ttyACM0 arduino-cli upload works... oddly, I cut this bossac command from the upload output just above, and it doesn't work. "/home/me/.arduino15/packages/adafruit/tools/bossac/1.8.0-48-gb176eee/bossac" -i -d --port=ttyACM0 -U -i --offset=0x4000 -w -v "/home/me/lib/ardbin/myprog/myprog.ino.bin" -R |
Describe the request
I use arduino-cli on Intel Linux to compile and upload sketches to my Arduino, which is an Adafruit Feather M4 CAN.
Usually, the feather comes up as /dev/ttyACM0. Sometimes it's /dev/ttyACM1.
My request is that I would like to deal with the port device name in a clear stable way.
I had been resolving this problem by putting this code in my arduino-cli bash wrapper script:
PORT=$(echo /dev/ttyACM?)
arduino-cli upload --port $PORT etc.
That has worked reliably for me. But I wanted to try making a udev rule for a /dev/feather_m4_can
with a symlink, so I could just say:
PORT=/dev/feather_m4_can
arduino-cli upload --port $PORT etc.
without ambiguity, in my scripts. I have not been able to make this work reliably.
I know that when I run arduino-cli upload, the udev system does several bind/unbind and add/remove operations on the usb device, and its ID wiggles between a normal 239a:80cd and a bootloader 239a:00cd.
When I run lsusb (in a loop) during an arduino-cli upload, it shows this:
Bus 001 Device 026: ID 239a:80cd Adafruit Feather M4 CAN
Bus 001 Device 027: ID 239a:00cd Adafruit Feather M4 CAN Express
Bus 001 Device 028: ID 239a:80cd Adafruit Feather M4 CAN
I wrote a new local udev rule
/etc/udev/rules.d/99-myfeatherm4.rules
that looks like this:
SUBSYSTEM=="tty", ATTRS{idVendor}=="239a", ATTRS{idProduct}=="80cd", SYMLINK+="feather_m4_can"
SUBSYSTEM=="tty", ATTRS{idVendor}=="239a", ATTRS{idProduct}=="00cd", SYMLINK+="feather_m4_can"
It makes a good-looking symlnk, but arduino-cli doesn't work with it.
$ ls -l /dev/ttyA* /dev/feather*
lrwxrwxrwx 1 root root 7 Feb 24 13:28 /dev/feather_m4_can -> ttyACM0
crw-rw---- 1 root dialout 166, 0 Feb 24 13:28 /dev/ttyACM0
$ ~/bin/arduino-cli_1.2.0 upload --port /dev/feather_m4_can --fqbn adafruit:samd:adafruit_feather_m4_can mysketch.ino --input-dir /home/me/lib/ardbin/mysketchdir
No device found on feather_m4_can
Failed uploading: uploading error: exit status 1
I know I can use:
PORT=$(echo /dev/ttyACM?)
or even
PORT=$(readlink -f /dev/feather_m4_can)
but I'd like to just use:
PORT=/dev/feather_m4_can
if possible.
Is my problem with my udev rule?
Or is it a problem with the way arduino-cli is treating the symlink?
(why does it work with /dev/ttyACM0 but not with the symlink?)
Is there a best simple way to specify the port?
Describe the current behavior
When I use my udev rule device name with a symlink to my feather, it fails.
(I keep my bin/arduino-cli versions with version number in the name, then I symlink bin/arduino-cli to the version I want)
$ ~/bin/arduino-cli_1.2.0 upload --port /dev/feather_m4_can --fqbn adafruit:samd:adafruit_feather_m4_can mysketch.ino --input-dir /home/me/lib/ardbin/mysketchdir
No device found on feather_m4_can
Failed uploading: uploading error: exit status 1
Arduino CLI version
latest 1.2.0, also earlier versions
Operating system
Linux
Operating system version
6.8.0-53-generic ubuntu
Additional context
No response
Issue checklist
The text was updated successfully, but these errors were encountered: