I’m currently using dmidecode for everything else but I’ve yet to find good information on retrieving specifications for a video card on Linux (Mainly Fedora, Ubuntu, Debian, CentOS, RedHat)
What i was thinking of using was: lspci -v or HAL
What would be the most efficient way to parse lspci data, obtaining just VGA portion to then output json.
def get_graphic_card_properties():
import dbus
bus = dbus.SystemBus()
hal_manager_object = bus.get_object('org.freedesktop.Hal', '/org/freedesktop/Hal/Manager')
hal_manager_interface = dbus.Interface(hal_manager_object, 'org.freedesktop.Hal.Manager')
method = hal_manager_object.get_dbus_method('GetAllDevices', 'org.freedesktop.Hal.Manager')
print "\n".join(list(iter(method())))
That’s the only code I was able to come across as an example, doesn’t appear to work for me in Fedora 17 64bit, I think because there’s no /orc/freedesktop/Hal.Manager.
Any ideas on this?
here is the command sample of lspci here. so basically you would call subprocess to access the command from python.
OR