[uClinux-dev] ioctl not passing parameter

Phil Wilshire philwil at earthlink.net
Wed Jun 11 07:02:30 EDT 2003


Hi Steve,
This may have already been answered.

use fd= open("/dev/dds",O_RDWR ) not fopen.

regards
  Phil


"Merrifield, Steven (IndSys, GE Interlogix)" wrote:
> 
> Hi,
> 
> I am having trouble getting ioctl() to work in a module. I have a custom driver that
> works fine using write() but I'm trying to convert it to use ioctl() instead.
> Major 42, minor 0, magic number 'k', module name 'dds'.
> 
> Environment: uCsimm, m68k-elf-tools-20030314.sh, uClinux-dist-20030522.tar.gz
> 
> The problem is that the cmd parameter does not seem to be passed correctly from user
> space into the kernel. When I call ioctl(fd,COMMAND,data); from user space, and print
> the value of COMMAND in the kernel, it is always 5401 regardless of the value of COMMAND.
> 
> Now 5401 corresponds to TCGETS. Why is it using this value instead of the value I passed?
> Everything I have read seems to indicate that the cmd parameter is simply passed as is.
> 
> In addition, ioctl() is setting errno to 9 (Bad file descriptor). I call fopen() and check
> for NULL before issuing the ioctl(). This is strange, since I can simply "echo X > /dev/dds"
> and it works as expected.
> 
> Any ideas would be welcomed,
> 
> Thanks,
> steve
> 
> _______________________________________________
> uClinux-dev mailing list
> uClinux-dev at uclinux.org
> http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
> This message was resent by uclinux-dev at uclinux.org

-- 
SDCS -- System Design & Consulting Services LLC, http://www.sysdcs.com
** Embedded Linux Training **  email me for details  
630 Springhouse Sq., Leesburg VA 20175 t: 703 669 9766 f: 703 669 9768



More information about the uClinux-dev mailing list