Reputation: 7466
I am working with an embedded platform. Typical software in this devices are Linux 2.6 + Busybox, so resources are limited.
I need to run an user space application every time a USB device is connected. I need to pass as parameter to this user space app the DeviceID and ProductID.
I don't really know which strategy should I follow to achieve this:
Which one should be the best way?
Thanks for your answer!
Upvotes: 1
Views: 1299
Reputation: 3385
If you want to remain in user space, then you can use libudev
.
You have an example here. You can extract product id and device id from this.
Upvotes: 2
Reputation: 158
To the best of my knowledge, there is a mechanism for USB hot plugging in the kernel. When a hot plug event happens, the user can be notified. Unfortunately, I am not very familiar with the details.
Maybe linux-3.3.5/samples/kobject/kset-example.c
will give you some ideas.
Upvotes: 0
Reputation: 9474
Even though other options like @aisbaa mentioned, modifying kernel is interesting and challenging one. I suggest you to modify the USB driver. Reason is, you need to send the arguments to the user space application(Product ID, Device ID).
These Ids will be obtained in driver. so calling user space app with these Ids are my choice.
For calling user space app nice explanation available here.
Upvotes: 0