I can verify that the udev rule is working on the host system:
$ user@host:~ ls -al /dev/ARD1
lrwxrwxrwx 1 root root 7 Jan 22 23:41 /dev/ARD1 -> ttyACM0
So the udev rule is obviously working.
When I try and upload using arduino-cli, everything works if I use the underlying tty file descriptor:
$ user@host:~ arduino-cli upload -p /dev/ttyACM0 --fbqn arduino:samd:mkr1000 my_file.in
Atmel SMART device 0x10010005 found
Device : ATSAMD21G18A
Chip ID : 10010005
Version : v2.0 [Arduino:XYZ] Dec 20 2016 15:36:43
Address : 8192
Pages : 3968
Page Size : 64 bytes
Total Size : 248KB
Planes : 1
Lock Regions : 16
Locked : none
Security : false
Boot Flash : true
BOD : true
BOR : true
Arduino : FAST_CHIP_ERASE
Arduino : FAST_MULTI_PAGE_WRITE
Arduino : CAN_CHECKSUM_MEMORY_BUFFER
Erase flash
done in 0.868 seconds
Write 12384 bytes to flash (194 pages)
[==============================] 100% (194/194 pages)
done in 0.070 seconds
Verify 12384 bytes of flash with checksum.
Verify successful
done in 0.011 seconds
CPU reset.
However, the same command using the udev symlink does not work:
$ user@host:~ arduino-cli upload -p /dev/ARD1 --fbqn arduino:samd:mkr1000 my_file.ino
No device found on ARD1
Error during Upload: uploading error: uploading error: exit status 1
Is this a bug in arduino-cli or am I doing something incorrect with the udev rules?
That issue is only about arduino-cli board attach and specifically says that arduino-cli upload is working, however they are using the Uno. The situation is a bit different with the MKR 1000 because Arduino CLI actually interacts with the board in order to activate the bootloader and find the bootloader's port (details here if you're curious).
Please post the output you get from running the upload command in verbose mode by adding the -v flag to the command:
Thanks for the response. The -v option was not very telling, so I followed the cli code and found what seems to be the issue. In commands/upload.go, it's finding available serial ports using the a third-party package that has an aggressive regular expression rule that doesn't seem to like symlinks, or at least symlinks that break from their narrow list of allowable file descriptors.
The underlying function call is from the bugst/go-serial package. In [nativeGetPortsList()](https://github.com/bugst/go-serial/blob/00e63fcc18cc62eed600c46205e64625d0e6304c/serial_unix.go#L216) the code queries the port against the following regex:
Unfortunately, the go-serial code also throws no errors and just returns a slice of empty ports, so custom udev symlinks like /dev/ttyARD1 or /dev/MKR1000 fail silently as if there were no device plugged in at all.
When I changed the udev rule to symlink to anything passing that regex check, it uploads with no problem. So I guess my short term solution is to symlink this MKR1000 to ttyACM99 for now, which will at the very least give me a static file descriptor to code against. I will also bring up the issue on the arduino-cli github page -- surely I'm not the only person who has run into this problem.