Skip to content

Instantly share code, notes, and snippets.

@athoik
Created November 21, 2017 21:07
Show Gist options
  • Save athoik/4d4bca6d952b66337cc21abd0950b26e to your computer and use it in GitHub Desktop.
Save athoik/4d4bca6d952b66337cc21abd0950b26e to your computer and use it in GitHub Desktop.
test ci ioctl
import os
import ctypes
libc = ctypes.cdll.LoadLibrary('libc.so.6')
ioctl = libc.ioctl
buffer = ctypes.c_char_p("\0"*256)
fd = os.open("/dev/ci0", os.O_RDWR | os.O_NONBLOCK)
ioctl(fd, 1, buffer)
print "len=", len(buffer.value), "buffer=", buffer.value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment