25% developed

Human interfaces

From Wikibooks, open books for an open world
Jump to navigation Jump to search


Welcome to the first article of the book. The article is named after USB class and Linux facility Human Interface Devices (HID). HID facility in Linux supports keyboard, mouse and other input devices. Console, multimedia (or just media), sound (audio), video, graphics also are in the focus of this article. Security and debugging topics are very related to user and human interactions so are described here too.

human interfaces
text interfaces
security
debugging
multimedia subsystems
human interface devices, input devices
HI drivers

Text interfaces[editΒ | edit source]

Char devices[editΒ | edit source]

A character device file is an sequential access file like interface. This kind of devices is used in many facilities from keyboard input to default interface for a sophisticated new driver. You can find a list of registered char devices on the beginning the listing of /proc/devices. Input devices keyboard and mouse are examples of char devices.

Common key function cdev_add id adds a char device to the system.

Tip: Browse the cross-referencing site to explore nearby API and use cases

πŸ’Ύ Historical: It is one of the most simple, fundamental and oldest concepts derived from UNIX.

⚲ API:


βš™οΈ Internals:


πŸ“š References


πŸ’Ύ Historical

Text terminals and console[editΒ | edit source]

πŸ—οΈ Acronyms:

  • tty - πŸ’Ύ historically TeleTYpewriter, means just terminal
  • pty - pseudoterminal
  • pts - pseudoterminal slave
  • ptmx - pseudoterminal master


⚲ API:


βš™οΈ Internals:


πŸ“š References


πŸ’Ύ Historical

Security[editΒ | edit source]

The purpose of security is to restrict access across interfaces. One of the most frequently executed functions is may_open id. It rejects access of unauthorized users to open a file. It uses common function inode_permission id which checks for access rights to a given inode.


Authorization[editΒ | edit source]

πŸ”§ TODO


⚲ API:

Basic classic UNIX authorization is based on ownership and access mode.

Ownership is encoded by owning user id uid_t id and owning group id gid_t id.

umode_t id - just typedef used for encoding access mode. S_IRUSR id - minimal "read only by user" access mode. S_IALLUGO id - full access mode. Please read the source for details for other modes.

modes bits Read Write Execute
bit offset 2 1 0
Other 0-2 or ow ox
Group 3-5 gr gw gx
User 6-8 ur uw ux


Common authorization errors:


βš™οΈ Internals:

πŸ“š References:

Credentials[editΒ | edit source]

πŸ”§ TODO

⚲ API:

βš™οΈ Internals:

πŸ“š References:

Cryptography[editΒ | edit source]

πŸ”§ TODO


πŸ—οΈ Acronyms:


⚲ API:


βš™οΈ Internals:


πŸ“š References

Namespaces[editΒ | edit source]

Linux namespaces provide the way to make tasks work with different objects using the same id. For example same IPC id may refer to different objects or same pid may refer to different tasks when used in different namespaces.


πŸ”§ TODO


⚲ API:


βš™οΈ Internals:


πŸ“š References:

Control Groups[editΒ | edit source]

πŸ”§ TODO: cgroups


⚲ API:


βš™οΈ Internals:


πŸ“š References:


Audit[editΒ | edit source]



πŸ”§ TODO:


πŸ“š References:

Debugging[editΒ | edit source]

User space debug interfaces[editΒ | edit source]

⚲ Interfaces

  • dynamic doc debug
    • ⌨ Example:
    • echo "module atkbd +pfl" | sudo tee /sys/kernel/debug/dynamic_debug/control


βš™οΈ Internals


πŸ“š References

Printing to log[editΒ | edit source]

Most common functions

πŸ”§ TODO. πŸš€ advanced features


βš™οΈ Internals

kgdb and kdb[editΒ | edit source]

⚲ Interfaces


βš™οΈ Internals


πŸ“š References



πŸ“š References for debugging

Multimedia subsystems[editΒ | edit source]

Graphics[editΒ | edit source]

Old graphics (not to be confused with v4l):

⚲ API:

βš™οΈ Internals:

Direct Rendering Manager (DRM)[editΒ | edit source]

DRM is responsible for interfacing with GPUs of modern video cards. DRM exposes an API that user-space programs can use to send commands and data to the GPU and perform operations such as configuring the mode setting of the display. User-space programs can use the DRM API to command the GPU to do hardware-accelerated 3D rendering and video decoding, as well as GPGPU computing.


⚲ API:

Advanced Linux Sound Architecture (ALSA)[editΒ | edit source]

ALSA is a software framework and part of the Linux kernel that provides an API for sound card device drivers. Some of the goals of the ALSA project at its inception were automatic configuration of sound-card hardware and graceful handling of multiple sound devices in a system.

The sound servers PulseAudio, JACK (low-latency professional-grade audio editing and mixing) and PipeWire, the higher-level abstraction APIs OpenAL, SDL audio, etc. work on top of ALSA and implemented sound card device drivers. On Linux systems, ALSA succeeded the older Open Sound System (OSS).


⚲ API:


βš™οΈ Internals:


πŸ“š References:

Video4Linux (V4L2)[editΒ | edit source]

V4L is a collection of device drivers and an API for supporting realtime video capture on Linux systems. It supports many USB webcams, TV tuners, and related devices, standardizing their output, so programmers can easily add video support to their applications. MythTV, tvtime and Tvheadend are typical applications that use the V4L framework.


⚲ API:


πŸ“š References

HID[editΒ | edit source]

Generic human interface devices. Don't confuse with hiddev.

Input devices[editΒ | edit source]

Input device files are kind of char devices with id INPUT_MAJOR id. Classic input devices are keyboard and mouse.


⚲ API:


πŸ‘ Examples:


⌨ Hands on:

sudo hexdump /dev/input/mice # dump your mouse movements events from your kernel


βš™οΈ Internals:


πŸ“š References

HID devices[editΒ | edit source]

πŸ”§ TODO


⚲ API:


Camera[editΒ | edit source]

πŸ”§ TODO


⚲ API:

πŸ“š References

HI device drivers[editΒ | edit source]

This section is about low level drivers to human interface peripheral devices.


⚲ HID API:


βš™οΈ Internals


USB HID

⚲ HID API:


βš™οΈ Internals:


πŸ“š References

Graphics[editΒ | edit source]

πŸ”§ TODO


πŸ—οΈ Acronyms:


⚲ API:


βš™οΈ Internals

πŸ‘ Examples:


πŸ“š References:

Sound SoC - ASoC[editΒ | edit source]

ALSA System on Chip (ASoC) layer for or πŸ€– embedded systems.


⚲ API:


βš™οΈ Internals:

πŸ“š References:



βš™οΈ Internals: