LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   Is it possible to rearrange dev/ttyS numbers? (https://www.linuxquestions.org/questions/linux-hardware-18/is-it-possible-to-rearrange-dev-ttys-numbers-4175588605/)

spitlermike 09-02-2016 07:37 PM

Is it possible to rearrange dev/ttyS numbers?
 
Hello, I recently installed a serial port addon card for the purpose of programming picaxe microcontrollers. I could not find linux drivers but it appears Ubuntu 16.04 recognizes it right out of the box. Using lspci shows the following:

Code:

05:00.0 Serial controller: Oxford Semiconductor Ltd OXPCIe952 Dual 16C950 UART (prog-if 02 [16550])
        Subsystem: Oxford Semiconductor Ltd OXPCIe952 Dual 16C950 UART
        Flags: bus master, fast devsel, latency 0, IRQ 19
        Memory at f7600000 (32-bit, non-prefetchable) [size=16K]
        Memory at f7400000 (32-bit, non-prefetchable) [size=2M]
        Memory at f7200000 (32-bit, non-prefetchable) [size=2M]
        Capabilities: <access denied>
        Kernel driver in use: serial

Ok, so Ubuntu sees the card. When I use setserial to list all the ttyS* ports, I get the following for the card:

Code:

dev/ttyS0: No such device
dev/ttyS1, UART: unknown, Port: 0x02f8, IRQ: 3
dev/ttyS10, UART: unknown, Port: 0x0000, IRQ: 0
dev/ttyS11, UART: unknown, Port: 0x0000, IRQ: 0
dev/ttyS12, UART: unknown, Port: 0x0000, IRQ: 0
dev/ttyS13, UART: unknown, Port: 0x0000, IRQ: 0
dev/ttyS14, UART: unknown, Port: 0x0000, IRQ: 0
dev/ttyS15, UART: unknown, Port: 0x0000, IRQ: 0
dev/ttyS16, UART: unknown, Port: 0x0000, IRQ: 0
dev/ttyS17, UART: unknown, Port: 0x0000, IRQ: 0
dev/ttyS18, UART: unknown, Port: 0x0000, IRQ: 0
dev/ttyS19, UART: unknown, Port: 0x0000, IRQ: 0
dev/ttyS2, UART: unknown, Port: 0x03e8, IRQ: 4
dev/ttyS20, UART: unknown, Port: 0x0000, IRQ: 0
dev/ttyS21, UART: unknown, Port: 0x0000, IRQ: 0
dev/ttyS22, UART: unknown, Port: 0x0000, IRQ: 0
dev/ttyS23, UART: unknown, Port: 0x0000, IRQ: 0
dev/ttyS24, UART: unknown, Port: 0x0000, IRQ: 0
dev/ttyS25, UART: unknown, Port: 0x0000, IRQ: 0
dev/ttyS26, UART: unknown, Port: 0x0000, IRQ: 0
dev/ttyS27, UART: unknown, Port: 0x0000, IRQ: 0
dev/ttyS28, UART: unknown, Port: 0x0000, IRQ: 0
dev/ttyS29, UART: unknown, Port: 0x0000, IRQ: 0
dev/ttyS3, UART: unknown, Port: 0x02e8, IRQ: 3
dev/ttyS30, UART: unknown, Port: 0x0000, IRQ: 0
dev/ttyS31, UART: unknown, Port: 0x0000, IRQ: 0
dev/ttyS4, UART: 16950/954, Port: 0x0000, IRQ: 19
dev/ttyS5, UART: 16950/954, Port: 0x0000, IRQ: 19

dev/ttyS6, UART: unknown, Port: 0x0000, IRQ: 0
dev/ttyS7, UART: unknown, Port: 0x0000, IRQ: 0
dev/ttyS8, UART: unknown, Port: 0x0000, IRQ: 0
dev/ttyS9, UART: unknown, Port: 0x0000, IRQ: 0

I've highlighted the ports I believe to be for my card. When I use minicom and a serial loopback tester on ttyS4 I get all my typed in characters echoed back on the screen. Removing the loopback tester stops this, so I think I got that working right. However, the programming software I use for picaxe doesn't allow me to select ttyS4 from the options dropdown menu, it only lets me use ttyS0 thru ttyS3.

So, is there a way to reconfigure my ttyS numbers so that instead of ttyS4 and ttyS5 my serial ports correspond to ttyS0 and ttyS1?

jefro 09-02-2016 07:45 PM

http://www.tldp.org/HOWTO/Serial-HOWTO-10.html

If that doesn't work then there may be other ways around it but from notes you may have some issues if onboard isa serial ports exist.

IsaacKuo 09-02-2016 07:54 PM

This may sound like a stupid idea, but a quick and dirty possible fix might be to try and delete /dev/ttyS0 and create a symlink to ttyS4.
Code:

rm -vi /dev/ttyS0
ln -s /dev/ttyS4 /dev/ttyS0

Even if that works, though, a more correct way to solve the problem might be to modify udev persistent naming rules, or mknod

http://www.tldp.org/HOWTO/Serial-HOW...tml#create_dev

spitlermike 09-02-2016 10:34 PM

Ok, thanks for getting back to me. I'm still reading through the documentation you guys linked to, I want to have some idea of what I'm doing before I start executing commands in terminal. I did try adding a line to the udev rules file to rename ttyS4 as ttyS0 at startup but that failed to change anything. I read a bit about the mknod command online and sort of understand it, but the MAJOR and MINOR arguments were kind of cryptic to me at first. I found the section about them on tldp.org and using ls gave me the following:

Code:

michael@michael-All-Series:~$ ls -l /dev/ttyS[0,1,2,3,4,5]
crw-rw---- 1 root dialout 4, 64 Sep  2 22:46 /dev/ttyS0
crw-rw---- 1 root dialout 4, 65 Sep  2 22:46 /dev/ttyS1
crw-rw---- 1 root dialout 4, 66 Sep  2 22:46 /dev/ttyS2
crw-rw---- 1 root dialout 4, 67 Sep  2 22:46 /dev/ttyS3
crw-rw---- 1 root dialout 4, 68 Sep  2 22:47 /dev/ttyS4
crw-rw---- 1 root dialout 4, 69 Sep  2 22:47 /dev/ttyS5

I'm rather baffled that given setserial states that there is no such device at ttyS0, it would have info about it from ls be so similar to the other devices listed.

Jefro, I read your remark about onboard ISA ports causing issues and I think I may just have such an issue. Here is the relevant lspci output I found:

Code:

00:1f.0 ISA bridge: Intel Corporation Z87 Express LPC Controller (rev 05)
        Subsystem: ASUSTeK Computer Inc. Z87 Express LPC Controller
        Flags: bus master, medium devsel, latency 0
        Capabilities: <access denied>
        Kernel driver in use: lpc_ich
        Kernel modules: lpc_ich

I'm gonna knock off for the day, I'll take a look at this again and try out mknod sometime tomorrow.

jefro 09-03-2016 04:35 PM

As I recall in dos you had to move the lower comm and then swap the higher comm but may not apply here.

jpollard 09-03-2016 05:39 PM

You might check the BIOS/UFI configuration. sometimes you can disable the internal serial device (com0-3), and that would allow the addin card to become 0/1.

You may even be able to re-order the list.

I think what is causing this is the BIOS provided device list.


All times are GMT -5. The time now is 11:24 PM.