ghw icon indicating copy to clipboard operation
ghw copied to clipboard

Discover hardware driver / kernel modules

Open pwFoo opened this issue 7 years ago • 3 comments
trafficstars

Hi, I searching for a way to discover needed kernel modules for all the hardware / nic / disk.

Is there a way to discover driver which needed to use the hardware device(s)?

pwFoo avatar Oct 28 '18 11:10 pwFoo

Hi @pwFoo!

I've only really investigated getting the GPU driver information for the graphics cards module, just because that's the only time I've needed the driver information to interact with anything in hardware -- because hardware vendors for graphics cards can't seem to produce software that is sane and well-documented :/

Everything else has been well-abstracted through standard interfaces and kernel/system APIs so that the driver information doesn't tend to be all that useful...

That said, I don't have any issue producing driver information for other parts of the hardware. It's something that's been in the back of my mind to get done. So, yeah, I'll try to add this to a 0.3 or 0.4 milestone. I'm planning on adding support for discovering things about RAID setups/capabilities and hardware RAID controllers is another area where driver information can be helpful (again, because hardware vendors can't seem to write sane, standardized software interfaces to their stuff!)

jaypipes avatar Oct 28 '18 12:10 jaypipes

I play with a Go based system and need some basic init tasks (most important NIC and HDD) to set up Internet connection and mount a hdd partition.

It was an easy task with shell / bash with much examples. Haven't found Go examples and commands not support needed flags.

I'm new with Go and so it would be great to have a tool which do that stuff! 😑

pwFoo avatar Oct 28 '18 13:10 pwFoo

The shell / bash way to discover (all) needed drivers.

grep -h MODALIAS /sys/bus/*/devices/*/uevent | cut -d= -f2 | xargs /sbin/modprobe -abq 2> /dev/null

Sometimes it needs to be run twice because of dependencies.

But I don't know how to filter / optimize for NIC or HDD only.

pwFoo avatar Oct 29 '18 04:10 pwFoo