Commit 309da100 authored by Matthieu Cattin's avatar Matthieu Cattin

cp210x: Move cp2103 gpio set mask trick out of kernel module.

The used kernel cp210x module was probablly a hacked version.
Now using the official source from Silicon Labs.
The kernel module sources are in the usb-relay-box1 project.
parent 3bac64d4
......@@ -10,11 +10,13 @@ class CCP210x:
self.fd = open(device, 'wb')
def gpio_set(self, mask):
fcntl.ioctl(self.fd.fileno(), 0x8001, mask)
f = array.array('I', [mask])
f[0] = (f[0] << 8) | 0xFF
fcntl.ioctl(self.fd.fileno(), 0x8001, f, 1)
def gpio_get(self):
f = array.array('I', [0])
ret = fcntl.ioctl(self.fd.fileno(), 0x8000, f, 1)
fcntl.ioctl(self.fd.fileno(), 0x8000, f, 1)
return f[0]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment