Skip to content

Commit

Permalink
Merge pull request #336 from canonical/nvidia32
Browse files Browse the repository at this point in the history
fix: nvidia32 cases where driver version isn't found
  • Loading branch information
ZoopOTheGoop authored Nov 27, 2023
2 parents 409b6e7 + e41a466 commit b00a833
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/nvidia32
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ def nvidia_version():
Returns a tuple of the full NVIDIA version triplet and NVIDIA major version.
"""
modinfo = os.popen(
"modinfo /usr/lib/modules/$(uname -r)/updates/dkms/nvidia.ko 2> /dev/null"
"modinfo /usr/lib/modules/$(uname -r)/updates/dkms/nvidia.ko* 2> /dev/null"
" | grep -m 1 '^version:'"
" | sed 's/version:\s*//'"
).read().splitlines()
modinfo = modinfo or os.popen(
"modinfo /usr/lib/modules/$(uname -r)/kernel/nvidia*/nvidia.ko 2> /dev/null"
"modinfo /usr/lib/modules/$(uname -r)/kernel/nvidia*/nvidia.ko* 2> /dev/null"
" | grep -m 1 '^version:'"
" | sed 's/version:\s*//'"
).read().splitlines()
Expand Down Expand Up @@ -113,7 +113,9 @@ class NvidiaWindow(Gtk.Window):
right_margin=10,
left_margin=10
)
self.textview.get_buffer().set_text(COMMAND.format(self.nvidia_version[1]))
command_text = COMMAND.format("<your driver version>")
if self.nvidia_version: command_text = COMMAND.format(self.nvidia_version[1])
self.textview.get_buffer().set_text(command_text)
self.grid.attach_next_to(self.textview, self.run_label, Gtk.PositionType.BOTTOM, 2, 1)

# Do not show again button
Expand Down

0 comments on commit b00a833

Please sign in to comment.