[Tutor] Controlling a device with ioctl's?

Alan Gauld alan.gauld at btinternet.com
Wed Aug 25 02:02:01 CEST 2010


"Joe Veldhuis" <electroblog at gmail.com> wrote

>  control a piece of hardware using ioctl's on its device node. 

I've never tried this from Python but....

> #include <linux/dvb/frontend.h>
> 
> fd = open("/dev/dvb/adapter1/frontend0", O_RDWR)

Notice the fd - that means file descriptor not file pointer.
So ioctl takes a file descriptor in C and I assume the same 
in Python.

> So, I wrote the following in Python:
> 
> 
> fd = open("/dev/dvb/adapter1/frontend0", "wb")

So I suspect this might need to be

import os
fd = os.open(.....)

But as I say I've never actually used ioctl in Python...

Alan G.




More information about the Tutor mailing list