Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better device identification #1757

Closed
ashthespy opened this issue May 16, 2019 · 8 comments
Closed

Better device identification #1757

ashthespy opened this issue May 16, 2019 · 8 comments

Comments

@ashthespy
Copy link
Collaborator

ashthespy commented May 16, 2019

Currently devices are identified via the Hardware tab of /proc/cpuinfo which is a bit ambiguous. Wouldn't it be better to use /proc/device-tree/model instead?

@volumio
Copy link
Owner

volumio commented May 17, 2019

Not a bad idea at all! We need however to test with all the devices we do support...

@ashthespy
Copy link
Collaborator Author

An alternative would be to just add the device info during build time. We could sneak it into os-info for example.

@gkkpch
Copy link
Contributor

gkkpch commented Dec 14, 2019

I agree, cpuinfo is not very reliable because it depends on what board developers/ suppliers have put in the device tree source.
But there is already a build option in the kernel command line parameters which I have used for different devices. The parameter is "hwdevice=".
So, read "/proc/cmdline" and parse "hwdevice"

@ashthespy
Copy link
Collaborator Author

ashthespy commented Feb 3, 2020

Was just revisiting this, a quick grep shows that only a few boards currently use hwdevice, and is again set manually for each board.

scripts\odroidn2config.sh
hwdevice=Odroid-N2 

scripts\odroidxu4config.sh
hwdevice=OdroidXU4 

scripts\rock64config.sh
hwdevice=Rock64

scripts\boards\odroidn2config.sh
hwdevice=Odroid-N2 

scripts\boards\odroidxu4config.sh
hwdevice=OdroidXU4

scripts\boards\rock64config.sh
hwdevice=Rock64

Do you recommend that we define our own naming convention viz /proc/device-tree/model which normally is more comprehensive? Could also complement it with /device-tree/compatible

@gkkpch
Copy link
Contributor

gkkpch commented Feb 4, 2020 via email

@ashthespy
Copy link
Collaborator Author

@gkkpch Fair enough!
Then what would be the way forward? Should we then define a list of hwdevice's in a central location (maybe over at volumio/build) and add them to the system plugin folder during build time?

@ashthespy
Copy link
Collaborator Author

ashthespy commented Oct 6, 2021

Checking back in about this.

We now have a defined list of boards and a way to identify them -- /volumio/Build/devices

Some options to refactor ControllerSystem.prototype.deviceDetect for 3.x:

  1. Read VOLUMIO_DEVICENAME from /etc/os-release
    -- Pro: in our control, can be set to anything desired.
    -- Con: Need to maintain two databases of devices, one in Build, one here.
    -- Con: Non standard, etc/os-release is mutable, and could be changed arbitrarily..

  2. Read /proc/device-tree/model and/or /proc/device-tree/compatible. /proc/device-tree/serial-number
    -- Pro: Give us manufacture, device, and other model details
    -- Con: Can change, but we test on kernel bumps anyway, so don't see this as a big issue.
    -- Con: Might have edge cases on various variants of models..

Essentially: this device list can then go from

  {"name":"Raspberry PI", "cpuid":"BCM2835"},
  {"name":"Raspberry PI", "cpuid":"BCM2836"},
  {"name":"Raspberry PI", "cpuid":"BCM2837"},
  {"name":"Raspberry PI", "cpuid":"BCM2709"},
  {"name":"Raspberry PI", "cpuid":"BCM2708"},
  {"name":"Raspberry PI", "cpuid":"BCM2711"},
  {"name":"Odroid-C", "cpuid":"ODROIDC"},
  {"name":"Odroid-C2", "cpuid":"ODROID-C2"},
  {"name":"Sparky", "cpuid":"gs705a"},
  {"name":"Pine64", "cpuid":"sun50iw1p1"},
  {"name":"BBB", "cpuid":"GenericAM33XX(FlattenedDeviceTree)"},
  {"name":"Tinkerboard", "cpuid":"Rockchip(DeviceTree)"},
  {"name":"NanoPi NEO2", "cpuid":"Allwinnersun50iw2Family"},
  {"name":"Amlogic", "cpuid":"Amlogic"}

To

{"name": "Cubox Pulse", "ID": "cuboxp"},
{"name": "Khadas VIM1", "ID": "kvim1"},
{"name": "Khadas VIM2", "ID": "kvim2"},
{"name": "Khadas VIM3", "ID": "kvim3"},
{"name": "Volumio MP1", "ID": "mp1"},
{"name": "NanoPi Neo2", "ID": "nanopineo2"},
{"name": "Nanopi Neo3", "ID": "nanopineo3"},
{"name": "Odroid-C1", "ID": "odroidc1"},
{"name": "Odroid-C2", "ID": "odroidc2"},
{"name": "Odroid-C4", "ID": "odroidc4"},
{"name": "Odroid-N2", "ID": "odroidn2"},
{"name": "Odroid-XU4", "ID": "odroidxu4"},
{"name": "Orange Pi Lite", "ID": "orangepilite"},
{"name": "Orange Pi One", "ID": "orangepione"},
{"name": "Orange Pi PC", "ID": "orangepipc"},
{"name": "Pine64", "ID": "pine64base"},
{"name": "Pine64+", "ID": "pine64plus"},
{"name": "soPine64-Pine64LTS", "ID": "pine64solts"},
{"name": "Raspberry Pi", "ID": "pi"},
{"name": "Rock64", "ID": "rock64"},
{"name": "ROCK Pi S", "ID": "rockpis"},
{"name": "Asus Tinkerboard", "ID": "tinkerboard"},
{"name": "Voltastream Zero", "ID": "vszero"},
{"name": "x86_64", "ID": "x86_amd64"},
{"name": "x86", "ID": "x86_i386"}

@ashthespy
Copy link
Collaborator Author

Repo (but not old issues) has been moved over to https://github.com/volumio/volumio3-backend

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants