Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
388 views
in Technique[技术] by (71.8m points)

Linux Kernel API: meaning and stability of nodes under `/sys/devices/pci...` tree in sysfs

The essence of my question is almost painfully simple:

  • Given my current hardware, would the design of Linux sysfs allow me to expect that the device at /sys/devices/pci0000:00/0000:00:14.0/usb1/1-6 will always be the same device at that same location every time that I boot?

I'm 99% certain that the answer is "yes", but getting an expert to quickly weigh in seems prudent, to make sure I don't do anything stupid.

The inverse way to ask my question would be:

  • Is there any non-determinism in how the kernel enumerates pci and usb hardware at boot? (Assume the hardware is always fixed in advance of the boot.)

Supporting details:

Kernel in use on this hardware is 5.4.0-58-generic

This PCI and USB connection is all inside of the custom device enclosure, and is part of the "permanent" hardware design. There is no possibility of "hot-plugging" or unplugging or any end-user intervention with regard to changing/reconfiguring these connections.

The actual device that I care about, located at usb1/1-6, is an stm32f103 microcontroller, in case that matters. (I suspect it does not matter.)

The hardware design is fixed, and made by someone other than myself. I am writing software (mostly high-level GUI software) that runs on this device. As you can probably guess, my kernel knowledge is a bit weak.

As I said, I'm fairly convinced that the structure of the path /sys/devices/pci0000:00/0000:00:14.0/usb1/1-6 is derived entirely from the real-world structure of the hardware, but am looking for confirmation.

I've been reading about sysfs (such as here: https://www.kernel.org/doc/html/latest/admin-guide/sysfs-rules.html), but I still feel a lack of stumbling into any single unambiguous sentence which would resolve my uncertainty.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...