File tree Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change 8888def driverInitialized ():
8989 """ Returns true if amdgpu is found in the list of initialized modules
9090 """
91- driverInitialized = ''
92- try :
93- driverInitialized = str (subprocess .check_output ("cat /sys/module/amdgpu/initstate |grep live" , shell = True ))
94- except subprocess .CalledProcessError :
95- pass
96- if len (driverInitialized ) > 0 :
97- return True
98- return False
91+ driverInitialized = False
92+ if os .path .exists ("/sys/module/amdgpu" ) :
93+ if os .path .exists ("/sys/module/amdgpu/initstate" ):
94+ # amdgpu is loadable module
95+ with open ("/sys/module/amdgpu/initstate" ) as initstate :
96+ if 'live' in initstate .read ():
97+ driverInitialized = True
98+ else :
99+ # amdgpu is built into the kernel
100+ driverInitialized = True
101+ return driverInitialized
99102
100103
101104def formatJson (device , log ):
You can’t perform that action at this time.
0 commit comments