* sample USB Driver / Probe not getting called
@ 2011-10-17 9:35 Abhijit Pawar
2011-10-17 10:38 ` selvamuthukumar v
0 siblings, 1 reply; 4+ messages in thread
From: Abhijit Pawar @ 2011-10-17 9:35 UTC (permalink / raw)
To: kernelnewbies
Hi All,
Is there any way to call a sample USB driver whenever a USB device is
attached to the system irrespective of the class and type of the device?
To do this, LDD3, chap 13 mention that for USB device table, we only
need to add the driver_info entry as 42.
However if I do this, my probe is never getting called.
Now, I give the vendor and product id of this Mouse to the device_id
table and load my driver again. Still the probe is not getting called.
Is it that USB core is getting the proper driver for this mouse before
my driver entry in the list?
Am I missing something?
Regards,
Abhijit Pawar
^ permalink raw reply [flat|nested] 4+ messages in thread
* sample USB Driver / Probe not getting called
2011-10-17 9:35 sample USB Driver / Probe not getting called Abhijit Pawar
@ 2011-10-17 10:38 ` selvamuthukumar v
2011-10-17 10:42 ` Abhijit Pawar
0 siblings, 1 reply; 4+ messages in thread
From: selvamuthukumar v @ 2011-10-17 10:38 UTC (permalink / raw)
To: kernelnewbies
On Mon, Oct 17, 2011 at 3:05 PM, Abhijit Pawar <apawar.linux@gmail.com> wrote:
> Hi All,
> Is there any way to call a sample USB driver whenever a USB device is
> attached to the system irrespective of the class and type of the device?
>
> To do this, LDD3, chap 13 mention that for USB device table, we only
> need to add the driver_info entry as 42.
>
> However if I do this, my probe is never getting called.
>
> Now, I give the vendor and product id of this Mouse to the device_id
> table and load my driver again. Still the probe is not getting called.
>
> Is it that USB core is getting the proper driver for this mouse before
> my driver entry in the list?
>
> Am I missing something?
>
probe function will get called only if no other driver is attached to
the device. Make sure the device does not have any other driver.
Please refer line 290 and 291.
drivers/base/dd.c:
270 static int __driver_attach(struct device *dev, void *data)
271 {
272 struct device_driver *drv = data;
273
274 /*
275 * Lock device and try to bind to it. We drop the error
276 * here and always return 0, because we need to keep trying
277 * to bind to devices and some drivers will return an error
278 * simply if it didn't support the device.
279 *
280 * driver_probe_device() will spit a warning if there
281 * is an error.
282 */
283
284 if (!driver_match_device(drv, dev))
285 return 0;
286
287 if (dev->parent) /* Needed for USB */
288 device_lock(dev->parent);
289 device_lock(dev);
290 if (!dev->driver)
291 driver_probe_device(drv, dev);
^ permalink raw reply [flat|nested] 4+ messages in thread
* sample USB Driver / Probe not getting called
2011-10-17 10:38 ` selvamuthukumar v
@ 2011-10-17 10:42 ` Abhijit Pawar
2011-10-17 11:01 ` selvamuthukumar v
0 siblings, 1 reply; 4+ messages in thread
From: Abhijit Pawar @ 2011-10-17 10:42 UTC (permalink / raw)
To: kernelnewbies
On 10/17/2011 04:08 PM, selvamuthukumar v wrote:
> On Mon, Oct 17, 2011 at 3:05 PM, Abhijit Pawar<apawar.linux@gmail.com> wrote:
>> Hi All,
>> Is there any way to call a sample USB driver whenever a USB device is
>> attached to the system irrespective of the class and type of the device?
>>
>> To do this, LDD3, chap 13 mention that for USB device table, we only
>> need to add the driver_info entry as 42.
>>
>> However if I do this, my probe is never getting called.
>>
>> Now, I give the vendor and product id of this Mouse to the device_id
>> table and load my driver again. Still the probe is not getting called.
>>
>> Is it that USB core is getting the proper driver for this mouse before
>> my driver entry in the list?
>>
>> Am I missing something?
>>
> probe function will get called only if no other driver is attached to
> the device. Make sure the device does not have any other driver.
> Please refer line 290 and 291.
>
> drivers/base/dd.c:
> 270 static int __driver_attach(struct device *dev, void *data)
> 271 {
> 272 struct device_driver *drv = data;
> 273
> 274 /*
> 275 * Lock device and try to bind to it. We drop the error
> 276 * here and always return 0, because we need to keep trying
> 277 * to bind to devices and some drivers will return an error
> 278 * simply if it didn't support the device.
> 279 *
> 280 * driver_probe_device() will spit a warning if there
> 281 * is an error.
> 282 */
> 283
> 284 if (!driver_match_device(drv, dev))
> 285 return 0;
> 286
> 287 if (dev->parent) /* Needed for USB */
> 288 device_lock(dev->parent);
> 289 device_lock(dev);
> 290 if (!dev->driver)
> 291 driver_probe_device(drv, dev);
Thanks for reference to this function. It seems that there isnt any way
to override the already attached driver to the device.
Is there any?
Regards,
Abhijit Pawar
^ permalink raw reply [flat|nested] 4+ messages in thread
* sample USB Driver / Probe not getting called
2011-10-17 10:42 ` Abhijit Pawar
@ 2011-10-17 11:01 ` selvamuthukumar v
0 siblings, 0 replies; 4+ messages in thread
From: selvamuthukumar v @ 2011-10-17 11:01 UTC (permalink / raw)
To: kernelnewbies
On Mon, Oct 17, 2011 at 4:12 PM, Abhijit Pawar <apawar.linux@gmail.com> wrote:
> On 10/17/2011 04:08 PM, selvamuthukumar v wrote:
>>
>> On Mon, Oct 17, 2011 at 3:05 PM, Abhijit Pawar<apawar.linux@gmail.com>
>> ?wrote:
>>>
>>> Hi All,
>>> Is there any way to call a sample USB driver whenever a USB device is
>>> attached to the system irrespective of the class and type of the device?
>>>
>>> To do this, LDD3, chap 13 mention that for USB device table, we only
>>> need to add the driver_info entry as 42.
>>>
>>> However if I do this, my probe is never getting called.
>>>
>>> Now, I give the vendor and product id of this Mouse to the device_id
>>> table and load my driver again. Still the probe is not getting called.
>>>
>>> Is it that USB core is getting the proper driver for this mouse before
>>> my driver entry in the list?
>>>
>>> Am I missing something?
>>>
>> probe function will get called only if no other driver is attached to
>> the device. Make sure the device does not have any other driver.
>> Please refer line 290 and 291.
>>
>> 290 ? ? ? ? if (!dev->driver)
>> 291 ? ? ? ? ? ? ? ? driver_probe_device(drv, dev);
>
> Thanks for reference to this function. It seems that there isnt any way to
> override the already attached driver to the device.
> Is there any?
>
If already bounded driver is compiled as module you can rmmod. But
overriding option is not given may be because, the current loaded
driver may be doing an important operation, interrupting it may leave
the device in undefined state.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-10-17 11:01 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-17 9:35 sample USB Driver / Probe not getting called Abhijit Pawar
2011-10-17 10:38 ` selvamuthukumar v
2011-10-17 10:42 ` Abhijit Pawar
2011-10-17 11:01 ` selvamuthukumar v
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.