rust-embedded / rust-i2cdev

Rust library for interfacing with i2c devices under Linux
Apache License 2.0
205 stars 53 forks source link

Option to force-open a device #59

Closed michael-p closed 2 years ago

michael-p commented 4 years ago

Dear all,

it would be great if this library would optionally allow one to force-open an I2c device (I guess, using I2C_SLAVE_FORCE) similar to what the i2cget and i2cset tools do with the -f option. I know this is very dangerous but there are situations where one does not have many other options, so it would be great to be able to do this!

Best, Michael

Background: what I would use this for: Basically, a dirty hack.. I want to change the exposure of the camera of the device I'm working with (custom ARM board using an NXP iMX8M Mini SoC). Normally, one would do this using the Video4Linux2 API (basically an ioctl call). However, even though the camera driver supports this (I wrote it:) NXP's low-level V4L2 stack seems to not forward the ioctl calls correctly. This is a known problem and NXP refuses to do anything about it. As a dirty work-around, I just directly write to the camera's registers using i2cset and would now like to transfer this to our Rust application. Since the camera's I2c address is already associated with the camera driver in the device tree I need to force-open it from userspace.

iamkroot commented 2 years ago

Any reason why this hasn't been implemented yet? I'd also like to use this, and looking at the source, the changes seem minimal enough.

eldruin commented 2 years ago

This is supported as of version 0.5.1. Thank you everybody!