Home > OS >  Ask next device and driver, my Linux laptop with a new device will automatically insmod a device fil
Ask next device and driver, my Linux laptop with a new device will automatically insmod a device fil

Time:09-28

Learning to drive development recently, learned if install a driver on a board, need to load a device. The ko and driver. Ko file, if the name of the device and driver id_table array of members of the match, will perform the probe function, in the new equipment under/dev.
I have a doubt, I like to write drivers are manually loading device. Ko file and driver. Ko file, if I suddenly thrust on Linux computer a new equipment, don't give me computer automatically load a device. The ko file and driver. Ko file?

CodePudding user response:

Simple understanding for add a ko or remove an ok sure won't have this kind of action
Hotplug devices have their own special driven architecture,
Such as USB hot plug, it has its own daemon and for hardware interrupt to logo for interface state, and then according to the specific interface hardware information to match a specific device structure, and then load drive
Didn't you say what insmod ko, ko is refers to the kernel loaded dynamically driven a window that is derived from the kernel compilation way and the driver is loaded, have to drive not have absolute influence
But for device_register inside of these interfaces call and call or some device_unregister

CodePudding user response:

Remind: Linux is open source,

CodePudding user response:

refer to the second floor zhao4zhong1 response:
remind: Linux is open source,

Excuse me is to prompt the source? I don't know from which look, do not know how to start.

CodePudding user response:

reference lizh1009 reply: 3/f
Quote: refer to the second floor zhao4zhong1 response:

Remind: Linux is open source,

Excuse me is to prompt the source? I don't know from which look, do not know how to start.

Actually I also haven't seen the Linux source code,
But I don't believe the Linux implementation plug-and-play corresponding source code related features nobody research and write blog before or paper what the papers or books,

CodePudding user response:

Ko is loaded good for hot drawing equipment, general driver has a similar check threads, some may interrupt trigger, some may have a fixed time intervals to wake up to check the current equipment, when the new device into, can read some information, and then make some initialization, establishing device node,

CodePudding user response:

Drive the probe function

CodePudding user response:

The building Lord, how are you, will create a device device file this depends on the specific driver is how to implement, a lot of more phyletic, the kernel driver also has a lot of framework, such as: USB driver, MMC driver, hot-swappable disk driver, etc., these belong to the hotplug devices, hotplug devices is whether can be based on the current equipment has been detected by the system to insert the probe function and perform bus and it can dynamically create equipment structure and register (drivers is itself a lot, and have already registered on the bus), so the new a terrace equipment register to the bus, the probe function will be dynamic execution, this is the hotplug devices, and other drivers, such as temperature detection module, PWM module, ADC module of the drive, the need to manually to achieve, can appear device file depends on the probe function have also create device files, all in all, what is to see your device type equipment, don't know the answer satisfactory

CodePudding user response:

Device drivers are preloaded ok, you manually loading can also be automatically boot loading,
How to understand your so-called new equipment:
1, Linux, no driver, this is the equipment cannot be used, will see the bus level, but also can't use,
2, Linux drivers, but before the equipment did not insert, inside the Linux kernel device driver is now quite a lot, this kind of equipment depends generally can be used directly (hot plug), or restart the use (does not support hot plug)

CodePudding user response:

Common is hot-swappable USB and PCIE bai,

CodePudding user response:

Common is hot-swappable USB and PCIE bai,
Such as USB, the first is the USB HUB will monitor the change of their downward port (plug)
After the detected device inserted, try enumeration, is reading device (in short VID PID)

Corresponding to the USB device driver matching generally is matched according to VID PID,

The execution time, the probe match any device or driver loaded, will try to match,

Hotplug foundation, is the driver has been loaded,
If a USB device, the corresponding driver is loaded, then the insert, the enumeration of this step is allowed, but the driver does not match, the manual Insmod corresponding driver should also can work normally
  • Related