Which hardware?

Here you can discuss every aspect of Debian. Note: not for support requests!
Post Reply
Munty Scruntfundle
Posts: 54
Joined: 2018-11-27 16:53

Which hardware?

#1 Post by Munty Scruntfundle »

Hi folks.

I'm playing around with a raspberry pi and a Tinker board. While essentially the same thing the OSs (Raspbian and Debian) have many differences, as do the libraries for GPIO etc.

In Bash, how can I check the hardware? ie.. If 'command'="Raspberry' DoRaspberry Or a case for a Raspberry pi, Banana pi, Cheesecake, and other boards?

I realise that as the OSs are different and may have to rely on commands failing, or not existing on certain systems. I suppose the easiest way would be for me to drop a file in /dev that each bash could check. Maybe I've just answered my own question!

Even if I have, I'd be interested to know how people would do this if I hadn't just had the genius idea above!!
Many thanks.

User avatar
Posts: 13450
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Which hardware?

#2 Post by Head_on_a_Stick »

Munty Scruntfundle wrote:how can I check the hardware?

Code: Select all

lspci -k
^ That will show all of the PCI devices along with the kernel module that has been loaded for them, no loaded kernel module would indicate a lack of support for that hardware.

Is that what you mean? I'm not sure I understand your post.
Black Lives Matter

Debian buster-backports ISO image: for new hardware support

User avatar
Posts: 3786
Joined: 2011-05-09 06:02

Re: Which hardware?

#3 Post by bw123 »

I don't think a robust script should depend on hardware. Instead, I would probably check os and branch from that if necessary.

You're trying to write like a one-size-fits-all script for several gnu/linux distros? Why would they need different commands, is it like a network script that depends on a certain iface, or what? GPIO? can you give an example?

why would you "drop a file in /dev" you could drop a file anywhere, like /tmp I guess, but yeah it's not clear what you're trying to do.

Post Reply