On Sat, Sep 25, 2010 at 11:50 PM, Bond <jamesbond.2...@gmail.com> wrote:
> > > On Sun, Sep 26, 2010 at 12:10 PM, Venkatram Tummala < > venkatram...@gmail.com> wrote: > > >> Yes, it is possible to pass in 0 for register_chrdev. Please be clear what >> you want to achieve, from your subject line & the post. The subject line & >> the first few lines of the post indicates that >> > That is not my fault if you do not read the thread for one character even I > was able to make it. > Read my post first. And see for yourself as to who cannot make out . These were the steps I told you to do. 1) insmod <MODULE.ko> 2) cat /proc/devices |grep <DEVICENAME> This will fetch you a number. Use it in step 3 3) mknod /dev/<DEVICENAME> c <Number from step 2> 0 4) echo -n "whatever" > /dev/<DEVICENAME> 5) cat /dev/<DEVICENAME> Are these 5 steps so difficult for you to even reproduce. I think even a 1st grader can do this better than you. > >> you need something which prints only the last character. And you go on >> creating a rucus around here. >> > Who is creating rucus me or people giving me non sensical lecture to read > malloc they hide their incompetency by giving lecture to Google. > > >> I have updated the code & attached it. This can only read & write 10 >> characters. Now, please dont tell us that it is not you wanted or it doesn't >> work. Please spare us. >> > > Your code is giving me some error > I did > Step 1) mknod /dev/bond c 0 0 > Why & how the hell did you do this step before inserting the module. Do a cat /proc/devices|grep <DEVICENAME>. This will get you the number. Then do "mknod /dev/bond" c <NUMBER in /proc/devices> 0 . zero in register_chrdev(..) is not the device number. It indicates a dynamic number. Step 2) chmod 666 /dev/bond > I didn't tell you to do this step. > > Step 3) insmod bond.ko > > Step 4) r...@bond:~# lsmod | grep bond > bond 2031 0 > > Step5) echo -n abcde > /dev/bond > > gives me error > *bash: /dev/bond: No such device or address > > *Step 6) where* *as I can see ls -l /dev/bond* > > *crw-rw-rw- 1 root root 0, 0 2010-09-26 12:14 /dev/bond > > in your code you have done in memory_read > *f_pos = *f_pos + count; > > why have you done this? > What purpose it serves? > It updates the file pointer.