LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Password
Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.

Notices


Reply
  Search this Thread
Old 01-06-2019, 02:21 AM   #1
CollieJim
Member
 
Registered: Mar 2005
Distribution: Gentoo, Kubuntu
Posts: 582

Rep: Reputation: 28
Single name in /dev for Arduino Leonardo needed


When I connect an Arduino UNO (ATmega328p) via USB I get /dev/ttyUSB0 or /dev/ttyUSB1. With the Leonardo (ATmega32U4), it's /dev/ttyACM0 or /dev/ttyACM1.

The names alternate, which is annoying since I have to open the Tools menu and change a setting each time I unplug to test and replug to make changes.

Is there a way to force a single name? I tried a udev rule with SYMLINK+=ttyUSB_LEO, but it did not work.
Code:
SUBSYSTEMS=="usb", ATTRS{idVendor}=="2341", ATTRS{idProduct}=="8036", MODE:="0666", SYMLINK+=ttyUSB_LEO
KERNEL=="ttyACM*", ATTRS{idVendor}=="2341", ATTRS{idProduct}=="8036", MODE:="0666"
 
Old 01-06-2019, 03:12 AM   #2
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
udev is certainly the right way to create a persistent name.

Did you try putting the symbolic link name in quotes?

What do you see when running udevadm monitor, then replugging the Arduino?
 
Old 01-06-2019, 03:52 AM   #3
CollieJim
Member
 
Registered: Mar 2005
Distribution: Gentoo, Kubuntu
Posts: 582

Original Poster
Rep: Reputation: 28
Code:
~$ udevadm monitor
monitor will print the received events for:
UDEV - the event which udev sends out after rule processing
KERNEL - the kernel uevent

KERNEL[7760.688539] add      /devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3.4 (usb)
KERNEL[7760.688708] add      /devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3.4/1-3.4:1.0 (usb)
KERNEL[7760.689178] add      /devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3.4/1-3.4:1.0/tty/ttyACM0 (tty)
KERNEL[7760.689336] add      /devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3.4/1-3.4:1.1 (usb)
UDEV  [7760.694272] add      /devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3.4 (usb)
UDEV  [7760.696934] add      /devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3.4/1-3.4:1.0 (usb)
UDEV  [7760.697580] add      /devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3.4/1-3.4:1.1 (usb)
UDEV  [7760.700994] add      /devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3.4/1-3.4:1.0/tty/ttyACM0 (tty)
Revised Rule:
Code:
ATTRS{idVendor}=="2341", ATTRS{idProduct}=="8036", ENV{ID_MM_DEVICE_IGNORE}="1"
ATTRS{idVendor}=="2341", ATTRS{idProduct}=="8036", ENV{MTP_NO_PROBE}="1"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="2341", ATTRS{idProduct}=="8036", MODE:="0666"
KERNEL=="ttyACM*", ATTRS{idVendor}=="2341", ATTRS{idProduct}=="8036", MODE:="0666", SYMLINK+="ttyUSB_LEO"
I now see /dev/ttyUSB_LEO, but it is not offered as an alternative port by the Arduino IDE.
The first time I plugged in the Leonardo I got the above 8 lines, followed a few seconds later by another set with 'add' replaced by 'deleted', and another 'add' set. All with the same data. Other times I just get a single 'add' set.
 
Old 01-06-2019, 05:27 AM   #4
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Well, it looks like the IDE only cares for true device files. Rather than adding a symlink, then, try renaming the device file, either with a script or perhaps udev includes renaming as a built-in action?

Or find out how the IDE decides which devices to present.

I don’t know what the add/delete/add cycle means, but I guess it’s not really important.

Last edited by berndbausch; 01-06-2019 at 05:28 AM.
 
Old 01-06-2019, 07:00 AM   #5
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,920
Blog Entries: 44

Rep: Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158
Moderator Response

Moved: This thread is more suitable in <Linux - Embedded & Single-board computer> and has been moved accordingly to help your thread/question get the exposure it deserves.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: 32-bit Arduino Leonardo clone maker offers preview LXer Syndicated Linux News 0 07-27-2016 08:43 PM
LXer: Arduino Leonardo Touch Board makes any project interactive LXer Syndicated Linux News 0 11-01-2013 01:42 AM
Ubuntu 12.10 Attempted Installation of Arduino IDE with arduino-1.0.5-linux32.tar.gz mahnac72 Linux - Newbie 2 06-21-2013 05:26 PM
LXer: Arduino Leonardo finally available LXer Syndicated Linux News 0 07-25-2012 05:00 AM
[SOLVED] Arduino MEGA 2560 REV3, Arduino IDE working software versions jamesf Slackware 1 05-02-2012 01:56 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer

All times are GMT -5. The time now is 07:14 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration