<div dir="ltr">So, My <span style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:13px">misc_drv_read returns 0, and it's ok. So why the command head didn't get the string ?</span></div><div class="gmail_extra">
<br clear="all"><div><div dir="ltr"><div>--</div>Lucas Tanure <br>+55 (19) 988176559<br></div></div>
<br><br><div class="gmail_quote">On Tue, May 27, 2014 at 9:59 AM, Bjørn Mork <span dir="ltr"><<a href="mailto:bjorn@mork.no" target="_blank">bjorn@mork.no</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="">Lucas Tanure <<a href="mailto:tanure@linux.com">tanure@linux.com</a>> writes:<br>
<br>
>> What is worg with my read operation?<br>
><br>
> static ssize_t<br>
> misc_drv_read(struct file *filp, char __user * buf, size_t count, loff_t *<br>
> offp){<br>
> int nbytes;<br>
> char * string = "hello World";<br>
> nbytes = copy_to_user(buf, string, 12);<br>
> return nbytes;<br>
> }<br>
<br>
</div>copy_to_user returns the number of bytes which could *not* be copied.<br>
So it will return 0 on success, making your read return 0.<br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
Bjørn<br>
</font></span></blockquote></div><br></div>