Page 1 of 1

Which hardware?

PostPosted: 2019-02-10 12:18
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.

Re: Which hardware?

PostPosted: 2019-02-10 12:27
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.

Re: Which hardware?

PostPosted: 2019-02-10 16:04
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.