2011-02-03 01:22:19     ioctl problem in 2010R1-RC5

Document created by Aaronwu Employee on Aug 26, 2013
Version 1Show Document
  • View in full screen mode

2011-02-03 01:22:19     ioctl problem in 2010R1-RC5

ThangarJ P (INDIA)

Message: 97872   

 

Hi,

 

we are working in 2010R1-RC5 distribution and BF527 based custom board.

 

it seems the ioctl()  functions on character driver is not called proberly.

 

please find the code snippet below.

 

 

 

 

static int Ioctl_lcd(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg)

{

        printk("cmd = %x and arg = %d\n",cmd,(unsigned int)arg);

     

        switch (cmd) {

                case CMD_LCD_IMAGE_X_PARAM:

                        {

                                u32_X_Param = (unsigned int)arg;

                                break;

                        }

                case CMD_LCD_IMAGE_Y_PARAM:

                        {

                                u32_Y_Param =  (unsigned int)arg;

                                break;

                        }

                case CMD_LCD_IMAGE_WIDTH:

                        {

                                u32_Width = (unsigned int)arg*3;

                                break;

                        }

                case CMD_LCD_IMAGE_HEIGHT:

                        {

                                u32_Height = (unsigned int)arg;

                                break;

                        }

 

                default:

                        return -EINVAL;

        }

        return 0;

}

 

For all cmd values other than 2 control goes to Ioctl_lcd(). This is visible from the output below

 

cmd = 0 and arg = 5

cmd = 1 and arg = 5

 

"ioctl call is missing for cmd value 2."

 

cmd = 3 and arg = 5

 

 

 

we are not facing this problem in 2009R1.

 

what could be the reason behind the control not  moving to ioctl() call for the cmd value 2 alone?

 

 

 

Thank you,

 

Thangaraj

QuoteReplyEditDelete

 

 

2011-02-03 01:26:44     Re: ioctl problem in 2010R1-RC5

Mike Frysinger (UNITED STATES)

Message: 97873   

 

your code is incorrect.  your ioctl base must use a unique number like everyone else to avoid collisions with common code.

 

see how bfin_sport defines the ioctls in arch/blackfin/include/asm/bfin_sport.h

QuoteReplyEditDelete

 

 

2011-02-03 08:54:53     Re: ioctl problem in 2010R1-RC5

ThangarJ P (INDIA)

Message: 97901   

 

Dear Mike,

 

Thank you for yor suggestion.

 

This is our custom driver.

 

we are defining the same enum in application and kernel and matching the enum values while calling the ioctl().

 

we are using like that only in all the previous distributions.we are not facing any problem with that.

 

But  in the current distributin(2010R1-RC5) ,we are facing the problem for enum value 2 only.

 

please find the strace output for both distributions below.

 

2010R1-RC5:

 

open("/lib/libc.so.0", O_RDONLY)        = 3

fstat(3, {st_mode=S_IFREG|0755, st_size=247564, ...}) = 0

mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|0x4000000, -1, 0) = 0x2edc000

read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0j\0\1\0\0\0$\312\0\0004\0\0\0"..., 4096) = 4096

mmap2(NULL, 239348, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE|MAP_EXECUTABLE, 3, 0) = 0x2fc0000

mmap2(NULL, 17396, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2f78000

pread(3, "orted\0\0\0Temporary failure in nam"..., 8316, 237568) = 8316

close(3)                                = 0

munmap(0x2edc000, 4096)                 = 0

open("/lib/libc.so.0", O_RDONLY)        = 3

fstat(3, {st_mode=S_IFREG|0755, st_size=247564, ...}) = 0

close(3)                                = 0

open("/lib/libc.so.0", O_RDONLY)        = 3

fstat(3, {st_mode=S_IFREG|0755, st_size=247564, ...}) = 0

close(3)                                = 0

munmap(0x2eda000, 1210)                 = 0

stat("/lib/ld-uClibc.so.0", {st_mode=S_IFREG|0755, st_size=20396, ...}) = 0

ioctl(0, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B57600 opost isig icanon echo ...}) = 0

ioctl(1, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B57600 opost isig icanon echo ...}) = 0

getpid()                                = 302

sched_getaffinity(1, 4, {1})            = 4

rt_sigaction(SIGRTMIN, {0x2f71140, [], 0}, NULL, 8) = 0

rt_sigaction(SIGRT_1, {0x2f71148, [RTMIN], 0}, NULL, 8) = 0

rt_sigaction(SIGRT_2, {0x2f71058, [], 0}, NULL, 8) = 0

rt_sigprocmask(SIG_BLOCK, [RTMIN], NULL, 8) = 0

rt_sigprocmask(SIG_UNBLOCK, [RT_1], NULL, 8) = 0

mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS|0x4000000, 0, 0) = 0x2eda000

open("/dev/ili9322_lcd", O_WRONLY)      = 3

ioctl(3, 0x3, 0x5)                      = 0

ioctl(3, FIGETBSZ, 0x5)                 = -1 EFAULT (Bad address)

_exit(-1)                               = ?

 

 

 

 

 

2009R1-RC3:Strarce output for the same ioctl call:

 

 

 

open("/lib/libc.so.0", O_RDONLY)        = 3

fstat(3, {st_mode=S_IFREG|0755, st_size=239984, ...}) = 0

mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x59f000

read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0j\0\1\0\0\0(\275\0\0004\0\0\0\260"..., 4096) = 4096

mmap2(NULL, 232440, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE|MAP_EXECUTABLE, 3, 0) = 0x680000

mmap2(NULL, 17560, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x638000

pread(3, "str %d auth %d\n\0svc_run: - poll f"..., 9044, 229376) = 9044

close(3)                                = 0

munmap(0x59f000, 4096)                  = 0

open("/lib/libc.so.0", O_RDONLY)        = 3

fstat(3, {st_mode=S_IFREG|0755, st_size=239984, ...}) = 0

close(3)                                = 0

open("/lib/libc.so.0", O_RDONLY)        = 3

fstat(3, {st_mode=S_IFREG|0755, st_size=239984, ...}) = 0

close(3)                                = 0

munmap(0x59e000, 1153)                  = 0

stat("/lib/ld-uClibc.so.0", {st_mode=S_IFREG|0755, st_size=30360, ...}) = 0

ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {B57600 opost isig icanon echo ...}) = 0

ioctl(1, SNDCTL_TMR_TIMEBASE or TCGETS, {B57600 opost isig icanon echo ...}) = 0

getpid()                                = 321

sched_getaffinity(1, 4,  { 1 })         = 4

rt_sigaction(SIGRTMIN, {0x631080, [], 0}, NULL, 8) = 0

rt_sigaction(SIGRT_1, {0x630f20, [RTMIN], 0}, NULL, 8) = 0

rt_sigaction(SIGRT_2, {0x631020, [], 0}, NULL, 8) = 0

rt_sigprocmask(SIG_BLOCK, [RTMIN], NULL, 8) = 0

rt_sigprocmask(SIG_UNBLOCK, [RT_1], NULL, 8) = 0

mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS|0x4000000, 0, 0) = 0x59e000

open("/dev/ili9322_lcd", O_WRONLY)      = 3

ioctl(3, 0x3, 0x5)                      = 0

ioctl(3, FIGETBSZ, 0x5)                 = 0

_exit(0)

 

 

 

Please provide your suggestions.

 

 

 

Thank you,

 

Thangaraj.P

QuoteReplyEditDelete

 

 

2011-02-03 11:51:13     Re: ioctl problem in 2010R1-RC5

Mike Frysinger (UNITED STATES)

Message: 97904   

 

i already told you how to fix it -- stop using ioctl #'s that clash with common code.  the fact it worked on older releases doesnt really matter.

QuoteReplyEditDelete

 

 

2011-02-23 05:25:25     Re: ioctl problem in 2010R1-RC5

ThangarJ P (INDIA)

Message: 98371   

 

Hi Mike,

 

We tried to use the ioctl values other than common code in our driver development.

 

it worked for us. we started to use the ioctl values from 100. please let us know whether this will be ok.

 

Thank you.

Attachments

    Outcomes