dimanche 4 mai 2014

Changer l'I2C adresse-la volée d'un pilote de périphérique de linux - Stack Overflow


I have two cameras attached to my linux system. The cameras are controlled via I2C. The device driver for a single camera is based on the i2c-core device driver. I want to switch between the two cameras. Therefore, I want to change the I2C address on the fly to control one or the other camera.


Is this reasonable? If yes, is there a function, which does that or is it necessary to detach and attach the client with i2c_detach_client and i2c_attach_client, respsectively?


Thanks for any advice, Stefan




If I understand your question correctly you should get a device for each camera under /dev/, why not open both devices instead of trying to do something that will require you to rewrite large parts of the driver?


I suggest you take a look at the documentation found here: http://www.mjmwired.net/kernel/Documentation/i2c (please note the different topics on the left hand side).




The solution listed in your comment should work. I've written a generic I2C driver before with an ioctl interface that just sets the client->addr entry and it allowed me to test the bus.


Note that i2c_detach_client and i2c_attach_client functions have been removed in the more recent kernels.



I have two cameras attached to my linux system. The cameras are controlled via I2C. The device driver for a single camera is based on the i2c-core device driver. I want to switch between the two cameras. Therefore, I want to change the I2C address on the fly to control one or the other camera.


Is this reasonable? If yes, is there a function, which does that or is it necessary to detach and attach the client with i2c_detach_client and i2c_attach_client, respsectively?


Thanks for any advice, Stefan



If I understand your question correctly you should get a device for each camera under /dev/, why not open both devices instead of trying to do something that will require you to rewrite large parts of the driver?


I suggest you take a look at the documentation found here: http://www.mjmwired.net/kernel/Documentation/i2c (please note the different topics on the left hand side).



The solution listed in your comment should work. I've written a generic I2C driver before with an ioctl interface that just sets the client->addr entry and it allowed me to test the bus.


Note that i2c_detach_client and i2c_attach_client functions have been removed in the more recent kernels.


0 commentaires:

Enregistrer un commentaire