
Read PCI Configuration Space With lspci and setpci
Read and decode PCI configuration space on Linux 6.12 with lspci and setpci from pciutils 3.13, from vendor IDs and BARs to capability lists and link status.
Tag
82 posts

Read and decode PCI configuration space on Linux 6.12 with lspci and setpci from pciutils 3.13, from vendor IDs and BARs to capability lists and link status.

Decide between libusb in user space and a Linux 6.12 kernel USB driver by latency, device class, security, deployment and what else needs to see the device.

Use lsusb -t on Linux 6.12 to see the USB topology, the speed of each port and the kernel driver bound to every interface, plus the sysfs files behind it.

Find and remove leftover System V and POSIX IPC objects with ipcs and ipcrm: read the tables, spot orphans by nattch, delete by id or key and clean /dev/shm.

Detect a missing system call by trying it once, treating ENOSYS and seccomp EPERM as absent, caching the answer and falling back, shown with close_range.

glibc wrappers are not thin pass-throughs. See how open becomes openat, exit becomes exit_group, fork becomes clone, and which calls never reach the kernel.

Compare Linux IPC options for beginners: pipes, FIFOs, Unix sockets, shared memory, message queues, semaphores and signals, and which fits which job.

The kernel returns -errno in the result register, and the C library turns values from -4095 to -1 into errno and a return of -1. See the raw path and the rules.

Run a program under strace, read each line as name, arguments and result, then filter, follow child processes and write the trace to a file to find real faults.

Turn on the Raspberry Pi I2C and SPI buses with dtparam lines in config.txt or raspi-config, confirm the device nodes appear, and change bus speeds.

Expose an SPI device as /dev/spidevB.C, set mode, speed and word size with ioctl, and run full-duplex transfers with SPI_IOC_MESSAGE in a small C program.

Load i2c-dev, scan a bus with i2cdetect, read and write registers with i2cget and i2cset, and do the same in C through /dev/i2c-N and ioctl on Linux.