LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-23-2017, 03:34 PM   #1
RogerByrum
LQ Newbie
 
Registered: Oct 2017
Location: Indiana
Posts: 4

Rep: Reputation: Disabled
Create a rule so that my USB device will have the same name each time my Raspberry Pi boots up.


BUS=="usb", KERNEL=="adutux[0-3]", SYSFS{manufacturer}=="www.ontrak.net", SYSFS{serial}=="A38165", SYMLINK="adutux4", MODE="0666"

Currently the device is identified as /dev/adutux0
I want to create /dev/adutux4 based on the serial number and manufacturer of the device. That way my code can always reference /dev/adutux4 no how many of the same device I have and plugged in and in any port.

Raspbian GNU/Linux9.1
 
Old 10-23-2017, 03:45 PM   #2
TheEzekielProject
Member
 
Registered: Dec 2016
Distribution: arch
Posts: 668

Rep: Reputation: 190Reputation: 190
I don't have an answer for your question, but why not just use the UUID or PARTUUID of the device in your code?
 
Old 10-23-2017, 03:55 PM   #3
RogerByrum
LQ Newbie
 
Registered: Oct 2017
Location: Indiana
Posts: 4

Original Poster
Rep: Reputation: Disabled
Sure. How do I find the UUID of my device?
 
Old 10-23-2017, 04:13 PM   #4
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
Depending on the class of device, it will often show up in a subdirectory of /dev/. For example, USB serial adapters go into /dev/serial. My machine currently has two USB serial adapters plugged in:
Code:
ls -l /dev/serial/by-id/
total 0
lrwxrwxrwx 1 root root 13 2017-10-05 10:10 usb-FTDI_FT230X_Basic_UART_DN020MNB-if00-port0 -> ../../ttyUSB0
lrwxrwxrwx 1 root root 13 2017-09-27 13:00 usb-FTDI_USB_Serial_Converter_FTGSITJ4-if00-port0 -> ../../ttyUSB1
These can be used as unique identifiers as well.

Last edited by suicidaleggroll; 10-23-2017 at 04:15 PM.
 
Old 10-23-2017, 04:14 PM   #5
TheEzekielProject
Member
 
Registered: Dec 2016
Distribution: arch
Posts: 668

Rep: Reputation: 190Reputation: 190
Quote:
Originally Posted by RogerByrum View Post
Sure. How do I find the UUID of my device?
Type
Code:
blkid
in a root terminal
 
Old 10-23-2017, 04:21 PM   #6
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,923
Blog Entries: 44

Rep: Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158
Member response

Hi,

Welcome to LQ!

Quote:
Originally Posted by RogerByrum View Post
Sure. How do I find the UUID of my device?
As root from cli you can use;
Code:
ls -al /dev/disk/by-uuid/
Hope this helps.
Have fun & enjoy!


EDIT: sorry for my input, I see now you want to id a USB Flash so 'blkid' would provide uuid for that filesystem device.

Last edited by onebuck; 10-23-2017 at 04:29 PM. Reason: add comment correction
 
Old 10-23-2017, 04:25 PM   #7
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,680

Rep: Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894
FYI this is a data acquisition device and not a USB drive...

http://ontrak.net/Default.htm
 
Old 10-23-2017, 04:39 PM   #8
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,923
Blog Entries: 44

Rep: Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158
Member response

Hi,

Thanks for the input. Did not realize device is DAS since OP omitted that and I did not research it further.

Sorry for any information that I provided.
 
Old 10-23-2017, 04:48 PM   #9
RogerByrum
LQ Newbie
 
Registered: Oct 2017
Location: Indiana
Posts: 4

Original Poster
Rep: Reputation: Disabled
I wish it were that easy. the Device is not listed in "/dev/serial/by-id"

It is only listed in "/dev" as adutux0

I tried "sudo blkid /dev" but got <blank>

Could it be in a different folder?
 
Old 10-25-2017, 12:56 PM   #10
RogerByrum
LQ Newbie
 
Registered: Oct 2017
Location: Indiana
Posts: 4

Original Poster
Rep: Reputation: Disabled
Thumbs up Solution

Original Rule:
BUS=="usb", KERNEL=="adutux[0-3]", SYSFS{manufacturer}=="www.ontrak.net", SYSFS{serial}=="A38165", SYMLINK="adutux4", MODE="0666"

New Rule:
KERNEL=="adutux[0-3]", SUBSYSTEMS=="usb", ATTRS{manufacturer}=="www.ontrak.net", ATTRS{serial}=="A38165", MODE="0666", SYMLINK+="adutux4"

Thanks to everyone who helped.
 
Old 10-25-2017, 01:22 PM   #11
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,680

Rep: Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894
Well done.
 
  


Reply



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
Peppermint CD boots off external USB CD drive, but is ignored if put in internal CD drive and selected as the boot device Ulysses_ Linux - Hardware 4 05-09-2016 05:22 PM
LXer: How to create a time lapse video with Raspberry Pi LXer Syndicated Linux News 0 08-07-2014 08:40 AM
How to create one device file per endpoint for usb ? Thejus Programming 0 06-22-2010 10:16 PM
How to create a serial device from the USB IR ravi.xolve Linux - Hardware 0 01-24-2010 01:21 AM
USB CDRW: sg won't create sg* device in /dev sugapablo Linux - Hardware 3 05-06-2005 08:07 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:22 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