Get_driver_for_device not showing driver names

2 days back, this was in the updates…
I thought, after this, driver names should be shown
Under the “Devices”, for my network card, driver is listed as 'unknown"

Is my understanding of this get_driver_for_device wrong?
When can I know what driver is being used for my network cards?

You can check the output of the listimage command.

This is only used by the command drive_info.

Indeed, B_GET_DRIVER_FOR_DEVICE was implemented. However, the Devices app still needs to be programmed to make use of this new feature.

Are you aware if the Devices app will be programmed to make use of this new feature? Somebody working on it?

As a matter of fact, I’m working on integrating this functionality myself. I’ll need some patience though. :slight_smile:

1 Like

Some time ago I added node attributes (device/driver, etc.) that show device and driver module names.

3 Likes

Thank you very much

But then, was it not integrated into the nightly builds?

It is already applied: device_manager: add path and module name attributes · haiku/haiku@a0c6f02 · GitHub.

2 Likes

In that commit, you added attributes specifying the path to the device in devfs, along with the name of the module used by the device. You didn’t add the path to the module image which is the driver file that contains one or more modules. You aren’t the first one to be confused by the difference between a module name, a module image, and a device path. :slight_smile:

So, here’s an explanation just to clarify for everybody else too:

  • Image file: A generic executable file, shared library file, or an add-on

  • Module image file: A shared library/add-on that exports multiple loadable Modules. (You can think of this as the actual driver file.)

  • Module: Usually a module image will export two modules. (However, there is no limit to how many modules can be exported by a module image.) One module exports a more generic interface to a compatible device through devfs. The other module is meant to handle specialized communication with the device that is then used by the first module, or other modules for reuse.

So to clarify, in Haiku, what one may call a “driver file”, is actually a “module image file”.

Example:

This mean that drivers/disk/scsi/scsi_disk/driver_v1 (interface driver_module_info) is used as node driver and drivers/disk/scsi/scsi_disk/device_v1 (interface device_module_info) is used as /dev/disk/0/4/0/raw devfs file handling driver.

Thing like drivers/disk/scsi/scsi_disk/driver_v1 is a “module path” that is passed to get_module() API. Module is a bit bad naming, it actually means an interface exported by kernel module add-on, add-on can export multiple “modules” (interfaces).

Module path consists of 2 parts: path to kernel module add-on and a suffix identifying one of possibly multiple interfaces that add-on export. In this case drivers/disk/scsi/scsi/disk is a add-on path and driver_v1 is a suffix specifying one of add-on interfaces. Add-on path is relative to <prefix>/add-ons/kernel, where “<prefix>” is one of:

  1. /boot/home/config/non-packaged
  2. /boot/home/config
  3. /boot/system/non-packaged
  4. /boot/system

In this case full add-on path is /boot/system/add-ons/kernel/drivers/disk/scsi/scsi_disk.

Add-on path and interface suffix are separated by walking path until some file is found (supposed to be kernel add-on), the rest is interface suffix.

Kernel add-on exports interfaces by modules global variable, for example:

#define SCSI_DISK_DRIVER_MODULE_NAME "drivers/disk/scsi/scsi_disk/driver_v1"
#define SCSI_DISK_DEVICE_MODULE_NAME "drivers/disk/scsi/scsi_disk/device_v1"


struct device_module_info sSCSIDiskDevice = {
	{
		SCSI_DISK_DEVICE_MODULE_NAME,
		0,
		NULL
	},
// ...
};

struct driver_module_info sSCSIDiskDriver = {
	{
		SCSI_DISK_DRIVER_MODULE_NAME,
		0,
		NULL
	},
// ...
};

module_info* modules[] = {
	(module_info*)&sSCSIDiskDriver,
	(module_info*)&sSCSIDiskDevice,
	NULL
};
3 Likes

Off-topic: wasn’t there a topic named “how to write a video driver” somewhere in the documentation section in the main site? i can’t seem to find it, anyone knows where it is located? i hope i’m not just imagining this?

This ? Writing Video Card Drivers In BeOS | Haiku Project

2 Likes

Aah yes, thanks alot, so i’m not crazy :smile: