<div dir="ltr">I am learning char drivers.But i didn't understand write
operation of char device driver properly. the below is my write
operation<br>
<pre><code>static ssize_t dev_write(struct file *fil,const char __user *buff,size_t len,loff_t *off)
{
pr_info("user input string %s\n",buff);
pr_info("user input string len %d\n",len);
return len;
}<br><br></code>my doubt is if i write into my device like <br><code>echo "hello" > /dev/myDev<br></code></pre><pre><code>it is giving different behaviour like below is the dmesg<br></code><code>[20596.975355] user input string hello
[20596.975355] 77b9e4
[20596.975355] insmod insmod
[20596.975355] n/zeitgeist-daemon
[20596.975355] atives
[20596.975355]
[20596.975355] vars "${upargs[@]}"
[20596.975355] cur cword words=();
[20596.975355] local upargs=() upvars=() vcur vcword vprev vwords;
[20596.975355] while getopts "c:i:n:p:w:" flag "$@"; do
[20596.975355] case $flag in
[20596.975355] c)
[20596.975355] vcur=$OPTARG
[20596.975355] ;;
[20596.975355] i)
[20596.975355] vcword=$OPTARG
[20596.975355] ;;
[20596.975355] n)
[20596.975355] exclude=$OPTARG
[20596.975355] ;;
[20596.975355] p)
[20596.975355] vprev=$OPTARG
[20596.975355] ;;
[20596.975355] w)
[20596.975355] vwords=$OPTARG
[20596.975355] ;;
[20596.975358] user input string len 6
[20596.975361] Device closed<br><br></code>so i didn't understand what is happening inside .Can any one please explain what is happening?<br></pre><pre>Thanks & Regards<br>Prasad<br></pre></div>