Subject: Re: system call ioctl() problem

From: Anatolij Gustschin <[email-masked]>
Date: Wed, 26 Mar 2008 13:04:41 +0100

Hello,

??? wrote:
> hi,all
>   Here is a question I didn't make out, i wonder if anybody can figure 
> it out. My platform is mpc8540 with graphics chip Fujitsu MB86296, my 
> kernel version is 2.6.12.6 <http://2.6.12.6>. I'm about to write a 
> gfxdriver so DirectFB can call this gfxdriver to make MB86296 do some 
> drawing things. I wrote a program to test if the MB86296 drawing 
> registers can be read and written. here is some part of the pragram:

[snip]

> ioctl(3, 0x20004d2f, 0x7fe47914)        = -1 EINVAL (Invalid argument)
> write(1, "ioctlReadRes[0]=484,ioctlReadRes"...,
> 45ioctlReadRes[0]=484,ioctlReadRes[1]=30026f58
> ) = 45
> munmap(0x32028000, 4096)                = 0
> exit_group(45)                          = ?
> 
> 
> from above, I think the problem is in ioctl call, which shows "EINVAL 
> (Invalid argument)", so I added printk() to xx_ioctl() in fb driver, and 
> it showed xx_ioctl() was not called .Then I checked xx_ioctl() was 
> right.  where is my problem? how to call ioctl() right??

probably, your problem is missing mb86290-driver specific ioctl
hook in the "mb86290fb_ops" structure definition in
drivers/video/mb86290/mb86290fb.c.

Ensure that this structure definition contains something like this:

.fb_ioctl = mb86290fb_ioctl,

Without this assignment only generic framebuffer ioctl will be called,
maybe therefore you can not see driver specific ioctl call. Generic
ioctl "doesn't understand" FBIO_MB86290_READ_DRAW_REG argument and
simply returns -EINVAL.

Best regards,
Anatolij

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: [email-masked]