Skip to main content
1 of 2
Lizardx
  • 3.1k
  • 20
  • 19

As with lspci and lsusb, what these tools receive are short numbers, often hex numbers, that are then mapped to strings. Monitor EDID also sends a very short binary block that contains many such short numbers which are then translated to strings using matching tables of some sort.

https://pci-ids.ucw.cz/v2.2/pci.ids - this is the physical matching list that lspci uses, and other tools that turn the vendor 4 hex number id and the product 4 hex number id into string values. When an item is not in that matching table, it will just show the product and vendor ID.

Smartctl is significantly more complicated, but a large amount of the fields require such matching tables to create the string values, and also the other types of values and ranges, which are otherwise just random characters and numbers which the tool reads.

I don't know how big the block the drive can send to smartctl is, but I know more is mapped than other nix disk tools usually get access to, which is almost certainly at least in part due to those matching tables, some binary value mapped to a specific string value.

What hardware actually tells the system is quite different from what these tools report to you as an end user, in human readable string form. I've made at least one of these tools, I can't remember how many binary bits were used, in very clever ways, to highly compress these unique identifiers, and sometimes also string values, but this is why you need matching tables, to complete the raw binary or hex data the device sends.

Roughly speaking, anyway. I don't know exactly how smartctl does it, but anytime you see one of these tools using a matching table, aka, a db, this is why.

For example, it's quite unlikely the drive sent a string: Samsung Electronics Corporation, but it's quite likely it sent: CE00h as the hex 4 character id, which was then mapped to Samsung's string ID. Of course, smartctl has a lot more features than just that, but that's the rough idea. Other values the drive sends via smart don't mean anything alone, and have to be mapped to a specific vendor, and sometimes a specific product, to then know what they refer to, like units written, where units is not a constant, and depends on the vendor and drive.

Lizardx
  • 3.1k
  • 20
  • 19