<br><br><div class="gmail_quote">On Wed, Dec 28, 2011 at 8:22 PM, autif khan <span dir="ltr"><<a href="mailto:autif.mlist@gmail.com">autif.mlist@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>
<br>
I was wondering if switching to unlocked_ioctl() fixed the issue.<br>
<br>
I will be developing a hardware driver and would like to know how you<br>
made out. Please let me know if the 'cmd' is passed correctly.<br>
<br>
Thanks for sharing.<br>
<br>
Autif<br></blockquote><div> </div><div>Hi Autif, <br>Please go through the link:<br><a href="http://lwn.net/Articles/119652/" target="_blank">http://lwn.net/Articles/119652/</a> <br><br>Problem with my dummy driver was that i am using unlocked_ioctl, but defined the ioctl function with wrong syntax (i.e. with syntax of normal ioctl function.)<br>
<br>Thanks,<br>Chetan Nanda<br></div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div><div class="h5"><br>
On Tue, Dec 27, 2011 at 10:34 PM, Chetan Nanda <<a href="mailto:chetannanda@gmail.com">chetannanda@gmail.com</a>> wrote:<br>
><br>
><br>
> On Tue, Dec 27, 2011 at 11:25 PM, Dave Hylands <<a href="mailto:dhylands@gmail.com">dhylands@gmail.com</a>> wrote:<br>
>><br>
>> Hi Chetan,<br>
>><br>
>> On Tue, Dec 27, 2011 at 3:39 AM, Chetan Nanda <<a href="mailto:chetannanda@gmail.com">chetannanda@gmail.com</a>><br>
>> wrote:<br>
>> > Hi All,<br>
>> ><br>
>> > I am facing a strange issue with the ioctl commands, and not able to<br>
>> > 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>
>> 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>
>><br>
> Thanks Dave for pointing out 'unlocked_ioctl'<br>
> I come across this link:<br>
> <a href="http://lwn.net/Articles/119652/" target="_blank">http://lwn.net/Articles/119652/</a><br>
><br>
>> --<br>
>> Dave Hylands<br>
>> Shuswap, BC, Canada<br>
>> <a href="http://www.davehylands.com" target="_blank">http://www.davehylands.com</a><br>
><br>
><br>
> Thanks,<br>
> Chetan Nanda<br>
><br>
</div></div>> _______________________________________________<br>
> Kernelnewbies mailing list<br>
> <a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br>
> <a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
><br>
</blockquote></div><br>