XK0-004 · Question #268
A new IO card has been added to the security server to log the opening and closing of the main entrance. A switch is attached, so the interface card returns a 1 when the door is opened and a 0 when…
The correct answer is B. /dev/port. Linux exposes direct access to hardware I/O port address space through /dev/port, making it the appropriate device node for an add-in IO card that communicates via port-mapped I/O.
Question
A new IO card has been added to the security server to log the opening and closing of the main entrance. A switch is attached, so the interface card returns a 1 when the door is opened and a 0 when the door is closed. Which of the following describes the Linux device to which this switch is attached?
Options
- A/dev/tty0
- B/dev/port
- C/dev/gpio
- D/dev/sg0
How the community answered
(32 responses)- A3% (1)
- B84% (27)
- C3% (1)
- D9% (3)
Why each option
Linux exposes direct access to hardware I/O port address space through /dev/port, making it the appropriate device node for an add-in IO card that communicates via port-mapped I/O.
/dev/tty0 is the first virtual console terminal device and has nothing to do with hardware I/O ports or physical switch inputs.
/dev/port provides character-device access to the system's I/O port address space (x86 in/out instructions). An IO expansion card added to a server communicates with the CPU through I/O ports, so reading or writing /dev/port at the appropriate offset reflects the card's input signals - including the 1/0 switch state reported by the door sensor.
/dev/gpio is a sysfs/character interface for general-purpose I/O pins found on embedded platforms such as Raspberry Pi; it is not a standard device node present on general-purpose Linux servers for add-in IO cards.
/dev/sg0 is a SCSI generic device node used to send raw SCSI commands to storage devices, unrelated to parallel I/O port hardware.
Concept tested: Linux /dev/port hardware I/O port access
Source: https://www.kernel.org/doc/html/latest/admin-guide/devices.html
Topics
Community Discussion
No community discussion yet for this question.