Linux defines three common types of devices:
Internally Linux identifies devices by using two numbers called the major device number and the minor device number. The major device number identifies the device driver to handle the request and the device driver is free to use the minor number as it wants to. As an example the serial driver has a major number of 4 and minor numbers from 64 onwards identifies which serial port.
The Axis device driver uses a major number of 231 and various minor numbers to identify specific hardware elements.
| Minor Number | Hardware |
|---|---|
0 |
First SRAM Partition |
1 |
Second SRAM Partition |
2 |
Third SRAM Partition |
16 |
Inputs |
32 |
DIP switches |
48 |
Outputs |
96 |
SPI channel 0 (door monitoring PIC) |
97 |
SPI channel 1 |
98 |
SPI channel 2 |
99 |
SPI channel 3 |
128 |
Cryptographic hardware |
144 |
Smart Card interface |
To open the Axis device and to request the functionality associated with a specific hardware element the application needs to open a character special file whose major number matches the Axis device major number and whose minor number matches the desired hardware. It is conventional for these special character device files to live in the /dev directory.
For convenience the examples in the documentation assume existence of a set of special files in the:
/dev/axis_0 directory
To create one of these special files needs the mknod command.
The command:
mknod -m666 /dev/axis_0/inputs c 231 16
creates a suitable special file called inputs in /dev/axis_0 (which must exist) and associates it with the Axis device driver and the Axis inputs subsystem.
For more details on mknod on most Linux systems use the command:
man mknod
Once this has been done the inputs can be read like a normal (if rather short) file.