Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trouble writing i2c messages #79

Open
jjshoe opened this issue May 3, 2022 · 1 comment
Open

Trouble writing i2c messages #79

jjshoe opened this issue May 3, 2022 · 1 comment

Comments

@jjshoe
Copy link

jjshoe commented May 3, 2022

Trying to switch monitor inputs. I can accomplish this using ddccontrol or ddcutil on ubuntu linux.

For example: ddccontrol -r 0x60 -w 18 dev:/dev/i2c-4

This will change my monitor's input.

I have the following python code:

from smbus2 import SMBus, i2c_msg

with SMBus(4) as bus:
  message = i2c_msg.write(0x60, [0x12])
  bus.i2c_rdwr(message)

But I receive the following error:

Traceback (most recent call last):
  File "/home/jjshoe/buttons!/switch.py", line 5, in <module>
    bus.i2c_rdwr(message)
  File "/usr/local/lib/python3.10/dist-packages/smbus2/smbus2.py", line 658, in i2c_rdwr
    ioctl(self.fd, I2C_RDWR, ioctl_data)
OSError: [Errno 5] Input/output error

Thoughts on what I'm doing wrong?

@kplindegaard
Copy link
Owner

Skimming quickly through the decontrol source, I can't see what's wrong with your approach. Sorry :/
But since it's been so long since you asked, I hope you have figured it out already? If you have it would be cool to hear what the issue was.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants