IOCTL problems: Linux driver in T2080RDB

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

IOCTL problems: Linux driver in T2080RDB

跳至解决方案
1,115 次查看
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.

标签 (1)
0 项奖励
1 解答
831 次查看
misakamikoto
Contributor III

I think maybe u should implement the compat_ioctl function?

在原帖中查看解决方案

0 项奖励
3 回复数
832 次查看
misakamikoto
Contributor III

I think maybe u should implement the compat_ioctl function?

0 项奖励
831 次查看
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 项奖励
831 次查看
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 项奖励