IOCTL problems: Linux driver in T2080RDB

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

IOCTL problems: Linux driver in T2080RDB

Jump to solution
1,474 Views
manoloruiz
Contributor III

Hi,

I am implementing a char device driver that should be use few special control using IOCTL. In the device driver I have created an ioctl function: int my_ioctl(struct inode *inode, struct file *file, unsigned int ioctl_num, unsigned long ioctl_param)

I have added the function to the top structure and register the device. Within the function I have switch-case the ioctl_num. The device is register correctly and the open and write functions work as expected but IOCTL doesn't. When I call IOCTL from user space with parameter 0 the my_ioctl function called with ioctl_num = 0 but when I use any other values the my_ioctl kernel function is not being called.

I have tried in a laptop with Ubuntu and works properly(intel architecture). However, in the T2080RDB(powerPc architecture) does not work. It showed up the next message:
Ioctl error: _DEV_GET_Variable1, erroneo

Any idea about what is going on? Same program run properly in a laptop with x86 and does not in PPC in T2080RDB.

Labels (1)
0 Kudos
Reply
1 Solution
1,190 Views
misakamikoto
Contributor III

I think maybe u should implement the compat_ioctl function?

View solution in original post

0 Kudos
Reply
3 Replies
1,191 Views
misakamikoto
Contributor III

I think maybe u should implement the compat_ioctl function?

0 Kudos
Reply
1,190 Views
Pavel
NXP Employee
NXP Employee

Look at the following page about IOCTL using:

http://www.tldp.org/LDP/lkmpg/2.4/html/x856.html

See also the kernel source tree at Documentation/ioctl-number.txt.


Have a great day,
Pavel Chubakov

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply
1,190 Views
manoloruiz
Contributor III

I attach my driver.It doesn´t need any extra hardware. it may help in order to find the solution.

Driver code: Ejemplo3.c

User program: uam_ioctl.c

When the user run the progam call uam_ioctl, it needs add the name of the driver "chardev" and the option (form 1 to 5). For example ./uam_ioctl /dev/chardev 1

0 Kudos
Reply