<br><br><div class="gmail_quote">On Tue, Dec 27, 2011 at 11:25 PM, Dave Hylands <span dir="ltr"><<a href="mailto:dhylands@gmail.com">dhylands@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Chetan,<br>
<div class="im"><br>
On Tue, Dec 27, 2011 at 3:39 AM, Chetan Nanda <<a href="mailto:chetannanda@gmail.com">chetannanda@gmail.com</a>> wrote:<br>
> Hi All,<br>
><br>
> I am facing a strange issue with the ioctl commands, and not able to find<br>
> what wrong I am doing.<br>
> I am trying with a dummy kernel driver and implemented ioctl command as<br>
> follow:<br>
><br>
> in my_ioctl.h<br>
> #define READHWREG_MAGIC_NUMBER 0x15<br>
> #define READHWREG_CAM_READPE _IOR(READHWREG_MAGIC_NUMBER, 1, int*)<br>
><br>
> But the value of 'READHWREG_CAM_READPE' is comes out to be different in<br>
> userspace (in the application) and kernel space (in the driver).<br>
><br>
> In userspace I used ioctl as<br>
> ...<br>
> printf("\ncommand %x \n",READHWREG_CAM_READPE); <-- command 80041501<br>
> error = ioctl(g_DevFileId, READHWREG_CAM_READPE);<br>
> ..<br>
><br>
> In kernel space<br>
><br>
> int readHwReg_ioctl(struct inode *node, struct file *filp, unsigned int<br>
> cmd, unsigned long arg)<br>
> {<br>
> ...<br>
> printk("\n%d %s cmd = %x\n",__LINE__,__FUNCTION__,cmd); <--- cmd =<br>
> bee6a9d4<br>
<br>
</div>Back in 2.6.36, the ioctl member of the struct file_operations<br>
structure (which took 4 arguments) was finally deprecated, replaced<br>
with unlocked_ioctl (which only takes 3 arguments).<br>
<br>
If you just renamed and ignored the compiler warnings, then that<br>
explains your problem.<br>
<span class="HOEnZb"><font color="#888888"><br></font></span></blockquote><div>Thanks Dave for pointing out 'unlocked_ioctl'<br>I come across this link:<br><a href="http://lwn.net/Articles/119652/">http://lwn.net/Articles/119652/</a><br>
<br></div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="HOEnZb"><font color="#888888">
--<br>
Dave Hylands<br>
Shuswap, BC, Canada<br>
<a href="http://www.davehylands.com" target="_blank">http://www.davehylands.com</a><br>
</font></span></blockquote></div><br>Thanks,<br>Chetan Nanda<br>