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

Re: How to access correctly serial port inside module?



Hi,

Well, first of all  I wanna say that I know nearly nothing of kernel 
programming (That's why I'm on this list ;). But after reading your mail I 
guessed I if you really need to write a kernel for a device that is connected 
to the serial port. Let me explain it: The serial port has its own driver, so 
why not to write an userland kernel (maybe 'GemtekUtils' or something like 
that) that communicates to the device via the serial driver (that's 
/dev/ttyS*, isnt it?) instead ?

Or maybe I didn't understand you ;D

Cheers
Pedro

On Monday 19 February 2001 12:45, Tiziano Fagni wrote:
> Hi,
> I am writing a radio card driver for the Gemtek "Wizard Radio". This radio
> device is connected to computer through serial port so int the driver I
> need to access serial port to send command to radio device. Few days ago,
> Anil (aprasad@in.ibm.com) give me a code to access a file from within the
> kernel:
>
> struct file *filp;
> mm_segment_t old_fs;
> filp = filp_open(name,flags,mode);
> old_fs= getfs();
> set_fs(KERNEL_DS);
> filp->f_op->read(filp,buffer,count,&filp->f_pos);
>
> This code was declared dangerous so what is the correct way to access
> serial port within the kernel?
>
> Thanks to all.
>
> Tiziano
> -
> Kernelnewbies: Help each other learn about the Linux kernel.
> Archive:       http://mail.nl.linux.org/
> IRC Channel:   irc.openprojects.net / #kernelnewbies
> Web Page:      http://www.surriel.com/kernelnewbies.shtml
-
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/
IRC Channel:   irc.openprojects.net / #kernelnewbies
Web Page:      http://www.surriel.com/kernelnewbies.shtml