Re: char driver module prob.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 
> On Tue, 2005-03-29 at 06:01 -0500, Gopu Bhaskar wrote:
> > > > hi all,
> > > > I had written a small character driver under kernel 2.4.20.
> > > For starters I had implemented it's read method only. This
> > > would put a constant string "hello" into the user-space
> > > buffer. The problem I'm seeing is that when i "cat" my device
> > > it does not print anything on the console (i.e cat and not the
> >
> > This can be because whatever is printed on the console is 
> > overwritten by the shell prompt when the cat command returns.
> > Something similar happens if you run the following prog
> >
> > int main() {
> >   printf("hello");
> > }
> the o/p's not over-written, instead the prompt is displayed
> right after the string terminates.

Then perhaps the problem might be because of printing the char \0
Like Erik suggested, try replacing sizeof with strlen.
Also try redirectnig the output of cat to a file and doing an od
on the file to see the contents.

> 
> >
> > -Gopu
> 
> --
> Kernelnewbies: Help each other learn about the Linux kernel.
> Archive:       http://mail.nl.linux.org/kernelnewbies/
> FAQ:           http://kernelnewbies.org/faq/

-- 
___________________________________________________________
Sign-up for Ads Free at Mail.com
http://promo.mail.com/adsfreejump.htm


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux