Hi, thanks for the reply. > > One can even have this script executed automatically through a > > ".rules" file. So far so good. My question is: can I write a driver > > that will perform the same thing? > > Yes, but why? We pushed most of this logic out to userspace as it is > easier to handle there. Why do you want a kernel driver for this? Here's my (perhaps incorrect thought) as to why doing this in a driver would be desirable. In the case of the Python script executed through a .rules file, the script can't know which device this is in response to. It is only launched because "some" device with product ID "0580" has been connected. Then, it just searches the system for "a" device with product ID "0580" and talks to *the first one it finds*. In the case where two devices would be plugged in to the computer at roughly the same time, I think this mechanism would break because there's a chance both scripts would attempt to talk to the same device and fail to update it. You end up with a device in a bad state and a second "0580" device that wouldn't even be spoken to ever. Contrast with a driver where if two devices are connected at the same time, two separate instances of the driver code would be executed for each specific device. There would be no chance of both probe() functions talking to the same device because the probe() function would be invoked for a specific device. > Did your problem function return an error (saying the driver is not in > control of the device), or 0, saying it is? I recommend sending an > error, that should free up the reference counting properly. I'll keep hacking at it but I agree with you that regardless of anything else, the probe() function ought to return an error code. > Are you sure you sent the proper data to the device? I'm sure in so far as I straight copy pasted the code from a user-executed program that did the exact same thing successfully. Thanks for your help! Regards _______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies