Unix Programming - ioctl commands in linux

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > November 2004 > ioctl commands in linux





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author ioctl commands in linux
Russell Shaw

2004-11-26, 7:50 am

Hi,
I'm using debian with kernel 2.6.8.1 on a pc.

I want to use

#include <sys/ioctl.h>
int ioctl(int d, int request, ...);

to monitor lines on a pc serial port.

In /usr/include/asm/ioctls.h, there's a list of requests. How do
i find out what they do and what data they operate on? I've been
looking thru the kernel sources, but nothing is obvious.
DINH Viet Hoa

2004-11-26, 7:50 am

Russell Shaw wrote :

> to monitor lines on a pc serial port.


what do you want to do basically ?

I do you mean by "monitor lines" ?

--
DINH V. Hoa,

"Ma tuxitude me beastifie" -- sunZ

Russell Shaw

2004-11-26, 7:50 am

DINH Viet Hoa wrote:
> Russell Shaw wrote :
>
>
>
>
> what do you want to do basically ?
>
> I do you mean by "monitor lines" ?


I want to make a daemon that does something when the data-carrier detect (DCD)
line changes.
DINH Viet Hoa

2004-11-26, 7:50 am

Russell Shaw wrote :

>
> I want to make a daemon that does something when the data-carrier detect (DCD)
> line changes.


http://www.tldp.org/HOWTO/Serial-HOWTO-12.html#ss12.1

(found with google)

--
DINH V. Hoa,

"Ma tuxitude me beastifie" -- sunZ

Floyd L. Davidson

2004-11-26, 5:50 pm

Russell Shaw <rjshawN_o@s_pam.netspace.net.au> wrote:
>DINH Viet Hoa wrote:
>
>I want to make a daemon that does something when the data-carrier detect (DCD)
>line changes.


Here is a demo program which demonstrates how to monitor individual
control lines on a serial port:

http://web.newsguy.com/floyd_davids...rialreport.html

--
Floyd L. Davidson <http://web.newsguy.com/floyd_davidson>
Ukpeagvik (Barrow, Alaska) floyd@barrow.com
Juha Laiho

2004-11-26, 5:50 pm

Russell Shaw <rjshawN_o@s_pam.netspace.net.au> said:
>Hi,
>I'm using debian with kernel 2.6.8.1 on a pc.
>
>I want to use
>
> #include <sys/ioctl.h>
> int ioctl(int d, int request, ...);
>
>to monitor lines on a pc serial port.


I trust you're not that concerned of how you monitor them, but just
that you're able to monitor them. My RedHat seems to have a program
called statserial; perhaps it's available in Debian, too. And sources
should be available at the very least, so it should contain what you
need to write your own implementation.
--
Wolf a.k.a. Juha Laiho Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)
Trent Buck

2004-11-26, 5:50 pm

Up spake Juha Laiho:
> My RedHat seems to have a program
> called statserial; perhaps it's available in Debian, too.


FWIW, yes it does. http://packages.debian.org/unstable/utils/statserial

--
-trent
I will wait until the hacker is in my computer, then disconnect and trap
him inside.
Russell Shaw

2004-11-27, 2:47 am

DINH Viet Hoa wrote:
> Russell Shaw wrote :
>
>
>
>
> http://www.tldp.org/HOWTO/Serial-HOWTO-12.html#ss12.1
>
> (found with google)
>


Hi,
I've read the serial howtos on tldp.org. None of them say how to
control the serial-port status lines individually.

I'm more interested in the general problem of how do you find
out what all the ioctl() commands do.
Russell Shaw

2004-11-27, 2:47 am

Floyd L. Davidson wrote:
> Russell Shaw <rjshawN_o@s_pam.netspace.net.au> wrote:
>
>
>
> Here is a demo program which demonstrates how to monitor individual
> control lines on a serial port:
>
> http://web.newsguy.com/floyd_davids...rialreport.html


Hi,
I looked at that last night, and it has the right stuff i was looking for.

It shows some of the ioctl() commands for controlling the serial port, but
i've always had the irritating problem of not knowing how to find out what
the rest of the ioctl() commands do. Is there a systematic method of finding
this somewhere in the kernel sources? (and a bit easier than reading actual
C code and guessing what it's doing)
DINH Viet Hoa

2004-11-27, 7:46 am

Russell Shaw wrote :

>
> I've read the serial howtos on tldp.org. None of them say how to
> control the serial-port status lines individually.
>
> I'm more interested in the general problem of how do you find
> out what all the ioctl() commands do.


on this page, you can find some names of program that do similar things
and I think that source of these programs are available on the internet.

--
DINH V. Hoa,

"Il y a anguille sous roche"

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com