Bind serial device address to specific usb portHow to ensure that I refer to the correct USB device?Udev...
Academic progression in Germany, what happens after a postdoc? What is the next step?
How does the barbarian bonus damage interact with two weapon fighting?
What is a Mono Word™?
How to get Planck length in meters to 6 decimal places
Can I shorten this filter, that finds disk sizes over 100G?
In the Schrödinger equation, can I have a Hamiltonian without a kinetic term?
What is the range of a Drunken Monk's Redirect attack?
Derivative is just speed of change?
How to calculate points under the curve?
Should I put my name first or last in the team members list?
How do I make my photos have more impact?
Should students have access to past exams or an exam bank?
Why don't short runways use ramps for takeoff?
Why do we need a voltage divider when we get the same voltage at the output as the input?
A conjectural trigonometric identity
Create two random teams from a list of players
Why does an inductor oppose the change in current (magnetic field)?
Rampant sharing of authorship among colleagues in the name of "collaboration". Is not taking part in it a death knell for a future in academia?
NULL value causes blank row in SELECT results for text concatenation
Was Donald Trump at ground zero helping out on 9-11?
Applying for mortgage when living together but only one will be on the mortgage
What Marvel character has this 'W' symbol?
What do the novel titles of The Expanse series refer to?
Avoiding Implicit Conversion in Constructor. Explicit keyword doesn't help here
Bind serial device address to specific usb port
How to ensure that I refer to the correct USB device?Udev rules for seemingly indistinguishable devicesFake serial number of USB deviceChange value of USB “max_sectors” for an entire family of devicesudev re-numbering when creating symlinksChange hidraw device from mouse to joystickAttributes from various parent devices in a udev ruleconfused about udevadm usagePersistent names for physical USB portsKERNELS path for USB device connected to HUBsystem call to peek next byte from serial portUdev Rules Not Running
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
My OS: Raspbian Stretch Lite
tl;dr;
- I have 2 identical USB device
- I want to make sure their address didn't get confused
- My thinking goes to bind the address to specific USB Port. I'm fine to "sacrifice" the port
- Since I'm new on linux, I don't know how to do it. As far as my knowledge goes, udev differentiate device by it's ID, not port (different manufacturer, models, etc)
- Is there any other recommended method?
Long version:
So, I have this UART-to-USB converter with the same manufacturer, so it have the same ID in udev and all. I want to make sure that the 2 device didn't get confused. For example, /dev/ttyUSB0 will always point to the specific hardware that I wanted (e.g.: inside. The 2 device will be separated by a door, so it's really important not to mess which is outside and inside).
I don't know how to accomplish this. My thinking goes to bind the specific port so that when the device is plugged to those specific port, it'll always give the address ttyUSB0 to that device. Is it even possible to do that? I'm new to linux and I know there's udev rule. But as far as I can find, it only bind device by it's id, not port. Or is there any other recommended way to do it using udev?
Here's my udevadm for the device:
looking at device '/devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/ttyUSB0/tty/ttyUSB0':
KERNEL=="ttyUSB0"
SUBSYSTEM=="tty"
DRIVER==""
looking at parent device '/devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/ttyUSB0':
KERNELS=="ttyUSB0"
SUBSYSTEMS=="usb-serial"
DRIVERS=="cp210x"
ATTRS{port_number}=="0"
looking at parent device '/devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0':
KERNELS=="3-2:1.0"
SUBSYSTEMS=="usb"
DRIVERS=="cp210x"
ATTRS{authorized}=="1"
ATTRS{bAlternateSetting}==" 0"
ATTRS{bInterfaceClass}=="ff"
ATTRS{bInterfaceNumber}=="00"
ATTRS{bInterfaceProtocol}=="00"
ATTRS{bInterfaceSubClass}=="00"
ATTRS{bNumEndpoints}=="02"
ATTRS{interface}=="CP2102 USB to UART Bridge Controller"
ATTRS{supports_autosuspend}=="1"
looking at parent device '/devices/pci0000:00/0000:00:14.0/usb3/3-2':
KERNELS=="3-2"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRS{authorized}=="1"
ATTRS{avoid_reset_quirk}=="0"
ATTRS{bConfigurationValue}=="1"
ATTRS{bDeviceClass}=="00"
ATTRS{bDeviceProtocol}=="00"
ATTRS{bDeviceSubClass}=="00"
ATTRS{bMaxPacketSize0}=="64"
ATTRS{bMaxPower}=="100mA"
ATTRS{bNumConfigurations}=="1"
ATTRS{bNumInterfaces}==" 1"
ATTRS{bcdDevice}=="0100"
ATTRS{bmAttributes}=="80"
ATTRS{busnum}=="3"
ATTRS{configuration}==""
ATTRS{devnum}=="57"
ATTRS{devpath}=="2"
ATTRS{idProduct}=="ea60"
ATTRS{idVendor}=="10c4"
ATTRS{ltm_capable}=="no"
ATTRS{manufacturer}=="Silicon Labs"
ATTRS{maxchild}=="0"
ATTRS{product}=="CP2102 USB to UART Bridge Controller"
ATTRS{quirks}=="0x0"
ATTRS{removable}=="removable"
ATTRS{serial}=="0001"
ATTRS{speed}=="12"
ATTRS{urbnum}=="1909"
ATTRS{version}==" 1.10"
Note: If binding a port to a specific serial address means I can't use the port for any other device, then it's fine to me
udev raspbian usb-device
add a comment |
My OS: Raspbian Stretch Lite
tl;dr;
- I have 2 identical USB device
- I want to make sure their address didn't get confused
- My thinking goes to bind the address to specific USB Port. I'm fine to "sacrifice" the port
- Since I'm new on linux, I don't know how to do it. As far as my knowledge goes, udev differentiate device by it's ID, not port (different manufacturer, models, etc)
- Is there any other recommended method?
Long version:
So, I have this UART-to-USB converter with the same manufacturer, so it have the same ID in udev and all. I want to make sure that the 2 device didn't get confused. For example, /dev/ttyUSB0 will always point to the specific hardware that I wanted (e.g.: inside. The 2 device will be separated by a door, so it's really important not to mess which is outside and inside).
I don't know how to accomplish this. My thinking goes to bind the specific port so that when the device is plugged to those specific port, it'll always give the address ttyUSB0 to that device. Is it even possible to do that? I'm new to linux and I know there's udev rule. But as far as I can find, it only bind device by it's id, not port. Or is there any other recommended way to do it using udev?
Here's my udevadm for the device:
looking at device '/devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/ttyUSB0/tty/ttyUSB0':
KERNEL=="ttyUSB0"
SUBSYSTEM=="tty"
DRIVER==""
looking at parent device '/devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/ttyUSB0':
KERNELS=="ttyUSB0"
SUBSYSTEMS=="usb-serial"
DRIVERS=="cp210x"
ATTRS{port_number}=="0"
looking at parent device '/devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0':
KERNELS=="3-2:1.0"
SUBSYSTEMS=="usb"
DRIVERS=="cp210x"
ATTRS{authorized}=="1"
ATTRS{bAlternateSetting}==" 0"
ATTRS{bInterfaceClass}=="ff"
ATTRS{bInterfaceNumber}=="00"
ATTRS{bInterfaceProtocol}=="00"
ATTRS{bInterfaceSubClass}=="00"
ATTRS{bNumEndpoints}=="02"
ATTRS{interface}=="CP2102 USB to UART Bridge Controller"
ATTRS{supports_autosuspend}=="1"
looking at parent device '/devices/pci0000:00/0000:00:14.0/usb3/3-2':
KERNELS=="3-2"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRS{authorized}=="1"
ATTRS{avoid_reset_quirk}=="0"
ATTRS{bConfigurationValue}=="1"
ATTRS{bDeviceClass}=="00"
ATTRS{bDeviceProtocol}=="00"
ATTRS{bDeviceSubClass}=="00"
ATTRS{bMaxPacketSize0}=="64"
ATTRS{bMaxPower}=="100mA"
ATTRS{bNumConfigurations}=="1"
ATTRS{bNumInterfaces}==" 1"
ATTRS{bcdDevice}=="0100"
ATTRS{bmAttributes}=="80"
ATTRS{busnum}=="3"
ATTRS{configuration}==""
ATTRS{devnum}=="57"
ATTRS{devpath}=="2"
ATTRS{idProduct}=="ea60"
ATTRS{idVendor}=="10c4"
ATTRS{ltm_capable}=="no"
ATTRS{manufacturer}=="Silicon Labs"
ATTRS{maxchild}=="0"
ATTRS{product}=="CP2102 USB to UART Bridge Controller"
ATTRS{quirks}=="0x0"
ATTRS{removable}=="removable"
ATTRS{serial}=="0001"
ATTRS{speed}=="12"
ATTRS{urbnum}=="1909"
ATTRS{version}==" 1.10"
Note: If binding a port to a specific serial address means I can't use the port for any other device, then it's fine to me
udev raspbian usb-device
1
Have a look at/dev/serial/by-id/and/dev/serial/by-path/. Use those entries instead of/dev/ttyUSB0
– Stephen Harris
Dec 17 '18 at 18:19
@StephenHarris Ahhh, thank you dear sir! Care to add it as an answer so I can accept it?
– Yandi Banyu Karima Waly
Dec 17 '18 at 18:26
@StephenHarris Quick question thought, will it randomly re-assign the port when I restart? For example, the "inside" is on port0, but after restart, it is assigned port1
– Yandi Banyu Karima Waly
Dec 17 '18 at 18:29
I tend to use theby-identries because that doesn't matter what port the device is plugged into.
– Stephen Harris
Dec 17 '18 at 18:31
@StephenHarris Thanks! So it means by-path is what I needed (I need the specific port)
– Yandi Banyu Karima Waly
Dec 17 '18 at 18:37
add a comment |
My OS: Raspbian Stretch Lite
tl;dr;
- I have 2 identical USB device
- I want to make sure their address didn't get confused
- My thinking goes to bind the address to specific USB Port. I'm fine to "sacrifice" the port
- Since I'm new on linux, I don't know how to do it. As far as my knowledge goes, udev differentiate device by it's ID, not port (different manufacturer, models, etc)
- Is there any other recommended method?
Long version:
So, I have this UART-to-USB converter with the same manufacturer, so it have the same ID in udev and all. I want to make sure that the 2 device didn't get confused. For example, /dev/ttyUSB0 will always point to the specific hardware that I wanted (e.g.: inside. The 2 device will be separated by a door, so it's really important not to mess which is outside and inside).
I don't know how to accomplish this. My thinking goes to bind the specific port so that when the device is plugged to those specific port, it'll always give the address ttyUSB0 to that device. Is it even possible to do that? I'm new to linux and I know there's udev rule. But as far as I can find, it only bind device by it's id, not port. Or is there any other recommended way to do it using udev?
Here's my udevadm for the device:
looking at device '/devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/ttyUSB0/tty/ttyUSB0':
KERNEL=="ttyUSB0"
SUBSYSTEM=="tty"
DRIVER==""
looking at parent device '/devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/ttyUSB0':
KERNELS=="ttyUSB0"
SUBSYSTEMS=="usb-serial"
DRIVERS=="cp210x"
ATTRS{port_number}=="0"
looking at parent device '/devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0':
KERNELS=="3-2:1.0"
SUBSYSTEMS=="usb"
DRIVERS=="cp210x"
ATTRS{authorized}=="1"
ATTRS{bAlternateSetting}==" 0"
ATTRS{bInterfaceClass}=="ff"
ATTRS{bInterfaceNumber}=="00"
ATTRS{bInterfaceProtocol}=="00"
ATTRS{bInterfaceSubClass}=="00"
ATTRS{bNumEndpoints}=="02"
ATTRS{interface}=="CP2102 USB to UART Bridge Controller"
ATTRS{supports_autosuspend}=="1"
looking at parent device '/devices/pci0000:00/0000:00:14.0/usb3/3-2':
KERNELS=="3-2"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRS{authorized}=="1"
ATTRS{avoid_reset_quirk}=="0"
ATTRS{bConfigurationValue}=="1"
ATTRS{bDeviceClass}=="00"
ATTRS{bDeviceProtocol}=="00"
ATTRS{bDeviceSubClass}=="00"
ATTRS{bMaxPacketSize0}=="64"
ATTRS{bMaxPower}=="100mA"
ATTRS{bNumConfigurations}=="1"
ATTRS{bNumInterfaces}==" 1"
ATTRS{bcdDevice}=="0100"
ATTRS{bmAttributes}=="80"
ATTRS{busnum}=="3"
ATTRS{configuration}==""
ATTRS{devnum}=="57"
ATTRS{devpath}=="2"
ATTRS{idProduct}=="ea60"
ATTRS{idVendor}=="10c4"
ATTRS{ltm_capable}=="no"
ATTRS{manufacturer}=="Silicon Labs"
ATTRS{maxchild}=="0"
ATTRS{product}=="CP2102 USB to UART Bridge Controller"
ATTRS{quirks}=="0x0"
ATTRS{removable}=="removable"
ATTRS{serial}=="0001"
ATTRS{speed}=="12"
ATTRS{urbnum}=="1909"
ATTRS{version}==" 1.10"
Note: If binding a port to a specific serial address means I can't use the port for any other device, then it's fine to me
udev raspbian usb-device
My OS: Raspbian Stretch Lite
tl;dr;
- I have 2 identical USB device
- I want to make sure their address didn't get confused
- My thinking goes to bind the address to specific USB Port. I'm fine to "sacrifice" the port
- Since I'm new on linux, I don't know how to do it. As far as my knowledge goes, udev differentiate device by it's ID, not port (different manufacturer, models, etc)
- Is there any other recommended method?
Long version:
So, I have this UART-to-USB converter with the same manufacturer, so it have the same ID in udev and all. I want to make sure that the 2 device didn't get confused. For example, /dev/ttyUSB0 will always point to the specific hardware that I wanted (e.g.: inside. The 2 device will be separated by a door, so it's really important not to mess which is outside and inside).
I don't know how to accomplish this. My thinking goes to bind the specific port so that when the device is plugged to those specific port, it'll always give the address ttyUSB0 to that device. Is it even possible to do that? I'm new to linux and I know there's udev rule. But as far as I can find, it only bind device by it's id, not port. Or is there any other recommended way to do it using udev?
Here's my udevadm for the device:
looking at device '/devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/ttyUSB0/tty/ttyUSB0':
KERNEL=="ttyUSB0"
SUBSYSTEM=="tty"
DRIVER==""
looking at parent device '/devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/ttyUSB0':
KERNELS=="ttyUSB0"
SUBSYSTEMS=="usb-serial"
DRIVERS=="cp210x"
ATTRS{port_number}=="0"
looking at parent device '/devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0':
KERNELS=="3-2:1.0"
SUBSYSTEMS=="usb"
DRIVERS=="cp210x"
ATTRS{authorized}=="1"
ATTRS{bAlternateSetting}==" 0"
ATTRS{bInterfaceClass}=="ff"
ATTRS{bInterfaceNumber}=="00"
ATTRS{bInterfaceProtocol}=="00"
ATTRS{bInterfaceSubClass}=="00"
ATTRS{bNumEndpoints}=="02"
ATTRS{interface}=="CP2102 USB to UART Bridge Controller"
ATTRS{supports_autosuspend}=="1"
looking at parent device '/devices/pci0000:00/0000:00:14.0/usb3/3-2':
KERNELS=="3-2"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRS{authorized}=="1"
ATTRS{avoid_reset_quirk}=="0"
ATTRS{bConfigurationValue}=="1"
ATTRS{bDeviceClass}=="00"
ATTRS{bDeviceProtocol}=="00"
ATTRS{bDeviceSubClass}=="00"
ATTRS{bMaxPacketSize0}=="64"
ATTRS{bMaxPower}=="100mA"
ATTRS{bNumConfigurations}=="1"
ATTRS{bNumInterfaces}==" 1"
ATTRS{bcdDevice}=="0100"
ATTRS{bmAttributes}=="80"
ATTRS{busnum}=="3"
ATTRS{configuration}==""
ATTRS{devnum}=="57"
ATTRS{devpath}=="2"
ATTRS{idProduct}=="ea60"
ATTRS{idVendor}=="10c4"
ATTRS{ltm_capable}=="no"
ATTRS{manufacturer}=="Silicon Labs"
ATTRS{maxchild}=="0"
ATTRS{product}=="CP2102 USB to UART Bridge Controller"
ATTRS{quirks}=="0x0"
ATTRS{removable}=="removable"
ATTRS{serial}=="0001"
ATTRS{speed}=="12"
ATTRS{urbnum}=="1909"
ATTRS{version}==" 1.10"
Note: If binding a port to a specific serial address means I can't use the port for any other device, then it's fine to me
udev raspbian usb-device
udev raspbian usb-device
asked Dec 17 '18 at 17:49
Yandi Banyu Karima WalyYandi Banyu Karima Waly
32 bronze badges
32 bronze badges
1
Have a look at/dev/serial/by-id/and/dev/serial/by-path/. Use those entries instead of/dev/ttyUSB0
– Stephen Harris
Dec 17 '18 at 18:19
@StephenHarris Ahhh, thank you dear sir! Care to add it as an answer so I can accept it?
– Yandi Banyu Karima Waly
Dec 17 '18 at 18:26
@StephenHarris Quick question thought, will it randomly re-assign the port when I restart? For example, the "inside" is on port0, but after restart, it is assigned port1
– Yandi Banyu Karima Waly
Dec 17 '18 at 18:29
I tend to use theby-identries because that doesn't matter what port the device is plugged into.
– Stephen Harris
Dec 17 '18 at 18:31
@StephenHarris Thanks! So it means by-path is what I needed (I need the specific port)
– Yandi Banyu Karima Waly
Dec 17 '18 at 18:37
add a comment |
1
Have a look at/dev/serial/by-id/and/dev/serial/by-path/. Use those entries instead of/dev/ttyUSB0
– Stephen Harris
Dec 17 '18 at 18:19
@StephenHarris Ahhh, thank you dear sir! Care to add it as an answer so I can accept it?
– Yandi Banyu Karima Waly
Dec 17 '18 at 18:26
@StephenHarris Quick question thought, will it randomly re-assign the port when I restart? For example, the "inside" is on port0, but after restart, it is assigned port1
– Yandi Banyu Karima Waly
Dec 17 '18 at 18:29
I tend to use theby-identries because that doesn't matter what port the device is plugged into.
– Stephen Harris
Dec 17 '18 at 18:31
@StephenHarris Thanks! So it means by-path is what I needed (I need the specific port)
– Yandi Banyu Karima Waly
Dec 17 '18 at 18:37
1
1
Have a look at
/dev/serial/by-id/ and /dev/serial/by-path/. Use those entries instead of /dev/ttyUSB0– Stephen Harris
Dec 17 '18 at 18:19
Have a look at
/dev/serial/by-id/ and /dev/serial/by-path/. Use those entries instead of /dev/ttyUSB0– Stephen Harris
Dec 17 '18 at 18:19
@StephenHarris Ahhh, thank you dear sir! Care to add it as an answer so I can accept it?
– Yandi Banyu Karima Waly
Dec 17 '18 at 18:26
@StephenHarris Ahhh, thank you dear sir! Care to add it as an answer so I can accept it?
– Yandi Banyu Karima Waly
Dec 17 '18 at 18:26
@StephenHarris Quick question thought, will it randomly re-assign the port when I restart? For example, the "inside" is on port0, but after restart, it is assigned port1
– Yandi Banyu Karima Waly
Dec 17 '18 at 18:29
@StephenHarris Quick question thought, will it randomly re-assign the port when I restart? For example, the "inside" is on port0, but after restart, it is assigned port1
– Yandi Banyu Karima Waly
Dec 17 '18 at 18:29
I tend to use the
by-id entries because that doesn't matter what port the device is plugged into.– Stephen Harris
Dec 17 '18 at 18:31
I tend to use the
by-id entries because that doesn't matter what port the device is plugged into.– Stephen Harris
Dec 17 '18 at 18:31
@StephenHarris Thanks! So it means by-path is what I needed (I need the specific port)
– Yandi Banyu Karima Waly
Dec 17 '18 at 18:37
@StephenHarris Thanks! So it means by-path is what I needed (I need the specific port)
– Yandi Banyu Karima Waly
Dec 17 '18 at 18:37
add a comment |
2 Answers
2
active
oldest
votes
Rather than trying to make udev fix pathnames based on path, you may be able to directly use the values stored in /dev/serial/by-path and /dev/serial/by-id
These are symlinks to the ttyUSB device and are updated whenever a device is discovered.
eg on my machine:
% ls -l /dev/serial/by-path/
total 0
lrwxrwxrwx 1 root root 13 Dec 12 19:23 pci-0000:00:1a.0-usb-0:1.5.1:1.0-port0 -> ../../ttyUSB0
lrwxrwxrwx 1 root root 13 Dec 12 19:23 pci-0000:00:1a.0-usb-0:1.5.1:1.1-port0 -> ../../ttyUSB1
lrwxrwxrwx 1 root root 13 Dec 9 10:56 pci-0000:00:1a.0-usb-0:1.5.2:1.0-port0 -> ../../ttyUSB4
lrwxrwxrwx 1 root root 13 Dec 12 19:23 pci-0000:00:1a.0-usb-0:1.5.4:1.0-port0 -> ../../ttyUSB2
lrwxrwxrwx 1 root root 13 Dec 12 19:23 pci-0000:00:1a.0-usb-0:1.5.4:1.1-port0 -> ../../ttyUSB3
lrwxrwxrwx 1 root root 13 Dec 12 19:24 pci-0000:00:1a.0-usb-0:1.6:1.0-port0 -> ../../ttyUSB5
% ls -l /dev/serial/by-id/
total 0
lrwxrwxrwx 1 root root 13 Dec 9 10:56 usb-1a86_USB2.0-Ser_-if00-port0 -> ../../ttyUSB4
lrwxrwxrwx 1 root root 13 Dec 12 19:24 usb-1a86_USB2.0-Serial-if00-port0 -> ../../ttyUSB5
lrwxrwxrwx 1 root root 13 Dec 12 19:23 usb-utek_USB__-__Serial_Cable_FTVW64JR-if00-port0 -> ../../ttyUSB0
lrwxrwxrwx 1 root root 13 Dec 12 19:23 usb-utek_USB__-__Serial_Cable_FTVW64JR-if01-port0 -> ../../ttyUSB1
lrwxrwxrwx 1 root root 13 Dec 12 19:23 usb-utek_USB__-__Serial_Cable_FTWKU6FP-if00-port0 -> ../../ttyUSB2
lrwxrwxrwx 1 root root 13 Dec 12 19:23 usb-utek_USB__-__Serial_Cable_FTWKU6FP-if01-port0 -> ../../ttyUSB3
add a comment |
Try https://unix.stackexchange.com/a/533464/202850. I had four identical cameras with no serial nos and thjey needed to be nailed down. I did it by USB port
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f489538%2fbind-serial-device-address-to-specific-usb-port%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Rather than trying to make udev fix pathnames based on path, you may be able to directly use the values stored in /dev/serial/by-path and /dev/serial/by-id
These are symlinks to the ttyUSB device and are updated whenever a device is discovered.
eg on my machine:
% ls -l /dev/serial/by-path/
total 0
lrwxrwxrwx 1 root root 13 Dec 12 19:23 pci-0000:00:1a.0-usb-0:1.5.1:1.0-port0 -> ../../ttyUSB0
lrwxrwxrwx 1 root root 13 Dec 12 19:23 pci-0000:00:1a.0-usb-0:1.5.1:1.1-port0 -> ../../ttyUSB1
lrwxrwxrwx 1 root root 13 Dec 9 10:56 pci-0000:00:1a.0-usb-0:1.5.2:1.0-port0 -> ../../ttyUSB4
lrwxrwxrwx 1 root root 13 Dec 12 19:23 pci-0000:00:1a.0-usb-0:1.5.4:1.0-port0 -> ../../ttyUSB2
lrwxrwxrwx 1 root root 13 Dec 12 19:23 pci-0000:00:1a.0-usb-0:1.5.4:1.1-port0 -> ../../ttyUSB3
lrwxrwxrwx 1 root root 13 Dec 12 19:24 pci-0000:00:1a.0-usb-0:1.6:1.0-port0 -> ../../ttyUSB5
% ls -l /dev/serial/by-id/
total 0
lrwxrwxrwx 1 root root 13 Dec 9 10:56 usb-1a86_USB2.0-Ser_-if00-port0 -> ../../ttyUSB4
lrwxrwxrwx 1 root root 13 Dec 12 19:24 usb-1a86_USB2.0-Serial-if00-port0 -> ../../ttyUSB5
lrwxrwxrwx 1 root root 13 Dec 12 19:23 usb-utek_USB__-__Serial_Cable_FTVW64JR-if00-port0 -> ../../ttyUSB0
lrwxrwxrwx 1 root root 13 Dec 12 19:23 usb-utek_USB__-__Serial_Cable_FTVW64JR-if01-port0 -> ../../ttyUSB1
lrwxrwxrwx 1 root root 13 Dec 12 19:23 usb-utek_USB__-__Serial_Cable_FTWKU6FP-if00-port0 -> ../../ttyUSB2
lrwxrwxrwx 1 root root 13 Dec 12 19:23 usb-utek_USB__-__Serial_Cable_FTWKU6FP-if01-port0 -> ../../ttyUSB3
add a comment |
Rather than trying to make udev fix pathnames based on path, you may be able to directly use the values stored in /dev/serial/by-path and /dev/serial/by-id
These are symlinks to the ttyUSB device and are updated whenever a device is discovered.
eg on my machine:
% ls -l /dev/serial/by-path/
total 0
lrwxrwxrwx 1 root root 13 Dec 12 19:23 pci-0000:00:1a.0-usb-0:1.5.1:1.0-port0 -> ../../ttyUSB0
lrwxrwxrwx 1 root root 13 Dec 12 19:23 pci-0000:00:1a.0-usb-0:1.5.1:1.1-port0 -> ../../ttyUSB1
lrwxrwxrwx 1 root root 13 Dec 9 10:56 pci-0000:00:1a.0-usb-0:1.5.2:1.0-port0 -> ../../ttyUSB4
lrwxrwxrwx 1 root root 13 Dec 12 19:23 pci-0000:00:1a.0-usb-0:1.5.4:1.0-port0 -> ../../ttyUSB2
lrwxrwxrwx 1 root root 13 Dec 12 19:23 pci-0000:00:1a.0-usb-0:1.5.4:1.1-port0 -> ../../ttyUSB3
lrwxrwxrwx 1 root root 13 Dec 12 19:24 pci-0000:00:1a.0-usb-0:1.6:1.0-port0 -> ../../ttyUSB5
% ls -l /dev/serial/by-id/
total 0
lrwxrwxrwx 1 root root 13 Dec 9 10:56 usb-1a86_USB2.0-Ser_-if00-port0 -> ../../ttyUSB4
lrwxrwxrwx 1 root root 13 Dec 12 19:24 usb-1a86_USB2.0-Serial-if00-port0 -> ../../ttyUSB5
lrwxrwxrwx 1 root root 13 Dec 12 19:23 usb-utek_USB__-__Serial_Cable_FTVW64JR-if00-port0 -> ../../ttyUSB0
lrwxrwxrwx 1 root root 13 Dec 12 19:23 usb-utek_USB__-__Serial_Cable_FTVW64JR-if01-port0 -> ../../ttyUSB1
lrwxrwxrwx 1 root root 13 Dec 12 19:23 usb-utek_USB__-__Serial_Cable_FTWKU6FP-if00-port0 -> ../../ttyUSB2
lrwxrwxrwx 1 root root 13 Dec 12 19:23 usb-utek_USB__-__Serial_Cable_FTWKU6FP-if01-port0 -> ../../ttyUSB3
add a comment |
Rather than trying to make udev fix pathnames based on path, you may be able to directly use the values stored in /dev/serial/by-path and /dev/serial/by-id
These are symlinks to the ttyUSB device and are updated whenever a device is discovered.
eg on my machine:
% ls -l /dev/serial/by-path/
total 0
lrwxrwxrwx 1 root root 13 Dec 12 19:23 pci-0000:00:1a.0-usb-0:1.5.1:1.0-port0 -> ../../ttyUSB0
lrwxrwxrwx 1 root root 13 Dec 12 19:23 pci-0000:00:1a.0-usb-0:1.5.1:1.1-port0 -> ../../ttyUSB1
lrwxrwxrwx 1 root root 13 Dec 9 10:56 pci-0000:00:1a.0-usb-0:1.5.2:1.0-port0 -> ../../ttyUSB4
lrwxrwxrwx 1 root root 13 Dec 12 19:23 pci-0000:00:1a.0-usb-0:1.5.4:1.0-port0 -> ../../ttyUSB2
lrwxrwxrwx 1 root root 13 Dec 12 19:23 pci-0000:00:1a.0-usb-0:1.5.4:1.1-port0 -> ../../ttyUSB3
lrwxrwxrwx 1 root root 13 Dec 12 19:24 pci-0000:00:1a.0-usb-0:1.6:1.0-port0 -> ../../ttyUSB5
% ls -l /dev/serial/by-id/
total 0
lrwxrwxrwx 1 root root 13 Dec 9 10:56 usb-1a86_USB2.0-Ser_-if00-port0 -> ../../ttyUSB4
lrwxrwxrwx 1 root root 13 Dec 12 19:24 usb-1a86_USB2.0-Serial-if00-port0 -> ../../ttyUSB5
lrwxrwxrwx 1 root root 13 Dec 12 19:23 usb-utek_USB__-__Serial_Cable_FTVW64JR-if00-port0 -> ../../ttyUSB0
lrwxrwxrwx 1 root root 13 Dec 12 19:23 usb-utek_USB__-__Serial_Cable_FTVW64JR-if01-port0 -> ../../ttyUSB1
lrwxrwxrwx 1 root root 13 Dec 12 19:23 usb-utek_USB__-__Serial_Cable_FTWKU6FP-if00-port0 -> ../../ttyUSB2
lrwxrwxrwx 1 root root 13 Dec 12 19:23 usb-utek_USB__-__Serial_Cable_FTWKU6FP-if01-port0 -> ../../ttyUSB3
Rather than trying to make udev fix pathnames based on path, you may be able to directly use the values stored in /dev/serial/by-path and /dev/serial/by-id
These are symlinks to the ttyUSB device and are updated whenever a device is discovered.
eg on my machine:
% ls -l /dev/serial/by-path/
total 0
lrwxrwxrwx 1 root root 13 Dec 12 19:23 pci-0000:00:1a.0-usb-0:1.5.1:1.0-port0 -> ../../ttyUSB0
lrwxrwxrwx 1 root root 13 Dec 12 19:23 pci-0000:00:1a.0-usb-0:1.5.1:1.1-port0 -> ../../ttyUSB1
lrwxrwxrwx 1 root root 13 Dec 9 10:56 pci-0000:00:1a.0-usb-0:1.5.2:1.0-port0 -> ../../ttyUSB4
lrwxrwxrwx 1 root root 13 Dec 12 19:23 pci-0000:00:1a.0-usb-0:1.5.4:1.0-port0 -> ../../ttyUSB2
lrwxrwxrwx 1 root root 13 Dec 12 19:23 pci-0000:00:1a.0-usb-0:1.5.4:1.1-port0 -> ../../ttyUSB3
lrwxrwxrwx 1 root root 13 Dec 12 19:24 pci-0000:00:1a.0-usb-0:1.6:1.0-port0 -> ../../ttyUSB5
% ls -l /dev/serial/by-id/
total 0
lrwxrwxrwx 1 root root 13 Dec 9 10:56 usb-1a86_USB2.0-Ser_-if00-port0 -> ../../ttyUSB4
lrwxrwxrwx 1 root root 13 Dec 12 19:24 usb-1a86_USB2.0-Serial-if00-port0 -> ../../ttyUSB5
lrwxrwxrwx 1 root root 13 Dec 12 19:23 usb-utek_USB__-__Serial_Cable_FTVW64JR-if00-port0 -> ../../ttyUSB0
lrwxrwxrwx 1 root root 13 Dec 12 19:23 usb-utek_USB__-__Serial_Cable_FTVW64JR-if01-port0 -> ../../ttyUSB1
lrwxrwxrwx 1 root root 13 Dec 12 19:23 usb-utek_USB__-__Serial_Cable_FTWKU6FP-if00-port0 -> ../../ttyUSB2
lrwxrwxrwx 1 root root 13 Dec 12 19:23 usb-utek_USB__-__Serial_Cable_FTWKU6FP-if01-port0 -> ../../ttyUSB3
answered Dec 17 '18 at 18:30
Stephen HarrisStephen Harris
28.9k3 gold badges57 silver badges85 bronze badges
28.9k3 gold badges57 silver badges85 bronze badges
add a comment |
add a comment |
Try https://unix.stackexchange.com/a/533464/202850. I had four identical cameras with no serial nos and thjey needed to be nailed down. I did it by USB port
add a comment |
Try https://unix.stackexchange.com/a/533464/202850. I had four identical cameras with no serial nos and thjey needed to be nailed down. I did it by USB port
add a comment |
Try https://unix.stackexchange.com/a/533464/202850. I had four identical cameras with no serial nos and thjey needed to be nailed down. I did it by USB port
Try https://unix.stackexchange.com/a/533464/202850. I had four identical cameras with no serial nos and thjey needed to be nailed down. I did it by USB port
answered 28 mins ago
Ian BoagIan Boag
821 silver badge3 bronze badges
821 silver badge3 bronze badges
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f489538%2fbind-serial-device-address-to-specific-usb-port%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Have a look at
/dev/serial/by-id/and/dev/serial/by-path/. Use those entries instead of/dev/ttyUSB0– Stephen Harris
Dec 17 '18 at 18:19
@StephenHarris Ahhh, thank you dear sir! Care to add it as an answer so I can accept it?
– Yandi Banyu Karima Waly
Dec 17 '18 at 18:26
@StephenHarris Quick question thought, will it randomly re-assign the port when I restart? For example, the "inside" is on port0, but after restart, it is assigned port1
– Yandi Banyu Karima Waly
Dec 17 '18 at 18:29
I tend to use the
by-identries because that doesn't matter what port the device is plugged into.– Stephen Harris
Dec 17 '18 at 18:31
@StephenHarris Thanks! So it means by-path is what I needed (I need the specific port)
– Yandi Banyu Karima Waly
Dec 17 '18 at 18:37