122 return get_param(
"/proc/driver/nvidia/params",
"DeviceFileMode") == 438;
153 const uint32_t NUM_TESTS = 6;
155 const std::string test_names[] = {
157 "Device Major Number Identifier Null",
158 "Device Major Number Identifier",
159 "DeviceFileMode Nvidia Check",
160 "Open /dev/nvidiactl File",
161 "Open /dev/nvidia0 File"
163 const std::string test_details[] = {
164 "The device \"tty\" and \"/dev/tty\" do not exist on the system.",
165 "The device major \"invalid-gvm\" is not equal to -1.",
166 "The device major \"mem\" is not equal to 1.",
167 "The Nvidia Device File Mode is not equal to 438.",
168 "Could not open nvidiactl file, try using sudo to run this test.",
169 "Could not open nvidia0 file, try using sudo to run this test."
172 bool (*tests[])(void) = {
177 uint32_t failures = 0;
179 for (uint32_t i = 0; i < NUM_TESTS; ++i) {
180 bool test_result = tests[i]() == 1;
188 <<
": " << test_details[i]
#define RED_COLOR
Red color.
#define GREEN_COLOR
Green color.
#define RESET_COLOR
Reset color.
int nv_open_dev(uint16_t minor)
Opens a traditional NVIDIA device.
uint8_t device_exists(const char *device_name)
Does a device file exist?
int32_t get_major(const char *device)
Gets the device major id from /proc/devices.
int32_t get_param(const char *filename, const char *parameter)
Gets a parameter from a driver param file.