ioctl

Matt Cheselka cheselka at tucana.noao.edu
Tue Jan 11 13:33:04 EST 2000


Hello all again,

I'm now attempting to use ioctl to talk to a piece of hardware that I'm working with and have again gotten stuck.  Here's how I'm doing it:

	>>> import fcntl
	>>> fd = open ("/dev/random", "rb")	// the random number generator
	>>> RNDGETENTCNT = -2147200512		// get entropy count
	>>> val = fcntl.ioctl (fd.fileno(), RNDGETENTCNT, xxx)
	Traceback (innermost last):
	  File "<stdin>", line 1, in ?
	NameError: xxx

so I try this:

	>>> xxx = 0
	>>> val = fcntl.ioctl (fd.fileno(), RNDGETENTCNT, xxx)
	Traceback (innermost last):
	  File "<stdin>", line 1, in ?
	IOError: (14, 'Bad address')

So it appears as though I'm not passing the correct value of 'xxx' since it
looks like fcntl.ioctl is interpreting 'xxx=0' to be the address of where to
place the result, which is in the ROM and not legal.

So I've got two questions:

	1. is this essientially the correct way to do ioctl stuff or is there
	   a better way?
	2. how do I pass this method the correct address?

TIA,

Matt Cheselka
cheselka at noao.edu



More information about the Python-list mailing list