views:

61

answers:

1

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

A: 

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).

Andreas Magnusson
Thanks for the comment. Hm, the problem is that the two cameras share the data bus. Moreover, the I2C address is already hardwired in the driver. So, it is not possible to open two devices. Meanwhile, my hack works by changing the I2C address on the fly, but this not yet the "clean" solution I would like to have.
stefangachter