views:

125

answers:

2

hello, im writing a Usb driver and i have an issue. when i insmod the driver with the device already plugged in before, the probe function is not called. it is only called after i disconnect the device and plug it again. i wanna make it work when i start my pc with the device plugged in. could someone please help me? best regards, jacob.

A: 

From Documentation/driver-model/binding.txt:

When a new device is added, the bus's list of drivers is iterated over to find one that supports it. In order to determine that, the device ID of the device must match one of the device IDs that the driver supports. The format and semantics for comparing IDs is bus-specific.

From the same source:

The process is almost identical for when a new driver is added. The bus's list of devices is iterated over to find a match. Devices that already have a driver are skipped. All the devices are iterated over, to bind as many devices as possible to the driver.

So it looks like you have a problem in the ID matching, that is in your case specific to the USB bus, see the usb_device_match function in drivers/usb/core/driver.c.

Or it may be that your device already is bound to a device that is unloaded when the device is unplugged (you can check that by controlling if there is a symlink to a driver in the corresponding /sys/bus/usb/xxxxx directory)

Longfield
A: 

"Or it may be that your device already is bound to a device that is unloaded when the device is unplugged (you can check that by controlling if there is a symlink to a driver in the corresponding /sys/bus/usb/xxxxx directory)"

And if there is a symlink?

pvinis