in reply to Re: Help using ioctl to write a PCI device
in thread Help using ioctl to write a PCI device

Got it!

The PCICARD_SET_REGISTER() sub is computing a wrong value (-2147471359) while the working C code is computing -2147201279. The 'int' must be wrong. Never mind, for my purpose it's better to hardcode the number anyway.

But in case anybody would like to answer the bonus question: What is the corresponding third argument to u8 in C?

Peace!
Sven
  • Comment on Re^2: Help using ioctl to write a PCI device

Replies are listed 'Best First'.
Re^3: Help using ioctl to write a PCI device
by tachyon (Chancellor) on Nov 02, 2004 at 22:53 UTC
    [root@devel3 root]# grep "#define _IOR" `locate ioctl.h` /usr/include/asm/ioctl.h:#define _IOR(type,nr,size) _IOC(_IOC_READ +,(type),(nr),sizeof(size)) /usr/src/linux-2.4.18-3/include/asm-i386/ioctl.h:#define _IOR(type,nr, +size) _IOC(_IOC_READ,(type),(nr),sizeof(size)) /usr/src/linux-2.4.18-27.7.x/include/asm-i386/ioctl.h:#define _IOR(typ +e,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size)) /usr/i386-glibc21-linux/include/asm/ioctl.h:#define _IOR(type,nr,size) + _IOC(_IOC_READ,(type),(nr),sizeof(size)) [root@devel3 root]#

    So the third argument is supposed to be a u8 which has a sizeof 1. You are passing it 'int' which has a sizeof 4 (probably). s/int/char/ might possibly fix it.

    cheers

    tachyon