Change the port name and execution authority of the microcomputer connected to Ubuntu and LiDAR

Execution authority (permission) and port name (/ dev/ttyACM0, etc.) will be required when connecting the microcomputer and URG via USB for serial communication.

When there are multiple serial devices in this way, the port names are assigned in the order in which they are connected, so the serial setting must be changed each time multiple devices are connected. In addition, it is necessary to grant execution authority for serial communication.

Since it is troublesome to set each time when connecting a device, we will deal with it.

Setting method

Microcomputer: STM Nucleo F446RE LiDAR : Hokuyo UTM-30lx

First, check the device information of the microcomputer. Execute the following command.


dmesg

Then, the product name of the connected device will appear at the bottom of the log, so record the three [idVendor] [idProduct] [Serial Number] above that device name.

【URG】 Screenshot from 2021-01-09 18-42-51.png [Microcomputer] Screenshot from 2021-01-09 18-43-07.png

Next, create a configuration file. Execute the following command to open the text with root privileges.


sudo vim /etc/udev/rules.d/99-serial.rules

If the three numbers you checked earlier, the port name you want to set, and the execution authority are as follows

Set as follows and save.

KERNEL=="ttyACM*", ATTRS{idVendor}=="15d1", ATTRS{idProduct}=="0000", SYMLINK+="ttyACM_URG", MODE="0666"
SUBSYSTEM=="tty", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="374b", ATTRS{serial}=="**3**", SYMLINK+="ttyACM_STM", MODE="0666"

This completes the settings. There is a way to reload it, but please restart it for sure.

Verification

Connect the device and type the following command.


reo@reo-desktop:~$ ls -la /dev/ttyACM_STM 
lrwxrwxrwx 1 root root 7 January 9 18:36 /dev/ttyACM_STM -> ttyACM1

reo@reo-desktop:~$ ls -la /dev/ttyACM_URG 
lrwxrwxrwx 1 root root 7 January 9 18:36 /dev/ttyACM_URG -> ttyACM0

If it is output like this, the setting is successful.

Recommended Posts

Change the port name and execution authority of the microcomputer connected to Ubuntu and LiDAR
[Rails] How to change the column name of the table
Change the file name and output destination of the JavaVM error file
IP address and port restrictions to Ubuntu
How to change the timezone on Ubuntu
How to change the maximum and maximum number of POST data in Spark
[Rails] Change the label name of f.label
[Rails] Get the path name of the URL before the transition and change the link destination
Change the timezone of the https-portal container to JST
http: // localhost: How to change the port number
[Java] How to get the authority of the folder
Convert the array of errors.full_messages to characters and output
[Ruby on Rails] How to change the column name
I want to display the name of the poster of the comment
How to dynamically change the column name acquired by MyBatis
I tried to summarize the basics of kotlin and java
How to change the setting value of Springboot Hikari CP
How to change the contents of the jar file without decompressing
When you want to change the MySQL password of docker-compose
[Android] Change the app name and app icon for each Flavor
How to check the extension and size of uploaded files
How to change the file name with Xcode (Refactor Rename)
[Rails/CarrierWave/MiniMagick] Give the CSS class name for portrait and landscape to the img tag of the uploaded image.