Which hardware?

Here you can discuss every aspect of Debian. Note: not for support requests!

Which hardware?

Postby Munty Scruntfundle » 2019-02-10 12:18

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.
Munty Scruntfundle
Posts: 17
Joined: 2018-11-27 16:53

Re: Which hardware?

Postby Head_on_a_Stick » 2019-02-10 12:27

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.
User avatar
Posts: 8900
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Which hardware?

Postby bw123 » 2019-02-10 16:04

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.
User avatar
Posts: 3787
Joined: 2011-05-09 06:02

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 3 guests