1

I have a RHEL6.9 server with 8 serial ports attached. RHEL has configured 4 of them /dev/ttyS0-3, they have addresses and IRQ's.

I've been using the mknod command to create the devices /dev/ttyS[0-3]. I know IRQ 5 and 7 are free (I'm not using any parallel ports)

I've been using something like

mknod -m 666 /dev/ttyS4 c 4 64

However, it seems to just duplicate /dev/ttyS0 with the same address and IRQ, however, when I change this 2 5 I just get "No such device or address" from

 setserial -g /dev/ttyS[0-9] 

The man page suggests the last 2 parameters (4 64) are versions. I naively assumed the 4 mapped to the IRQ.

Am I approaching this the right way, assuming I can just create new serial devices and assign an address and IRQ ?

If so (warning follow up question), can I get the addresses from somewhere on the running Linux system ?

Many thanks in advance

Jim
  • 53
  • 4

1 Answers1

3

You need to increment the second number in the mknod command but leave the first one alone. For example ...

mknod -m 666 /dev/ttyS4 c 4 68
mknod -m 666 /dev/ttyS5 c 4 69
mknod -m 666 /dev/ttyS6 c 4 70
mknod -m 666 /dev/ttyS7 c 4 71

The two numbers are the major and minor device numbers. Major device number will stay the same for devices of the same type. Minor device number will change for each instance.

As you're using RHEL 6.x you could equivalently use the MAKEDEV command which calculates the number for you ...

$ cd /dev
$ sudo MAKEDEV -vx ttyS4
create ttyS4                          c   4  68 root:uucp 660 system_u:object_r:tty_device_t:s0
$ ls -l ttyS4
crw-rw----. 1 root uucp 4, 68 Apr 26 12:02 ttyS4

NB you don't need the -v flag, that just makes things verbose but you do want the -x flag (for exact) otherwise MAKEDEV will create any devices matching the given string (so ttyS40, ttyS41 etc)

Paul Haldane
  • 4,517
  • 1
  • 21
  • 32