* ioctl.h
@ 2005-03-04 19:15 michael young
2005-03-04 20:54 ` ioctl.h J.
2005-03-04 21:55 ` ioctl.h Rechberger Markus
0 siblings, 2 replies; 4+ messages in thread
From: michael young @ 2005-03-04 19:15 UTC (permalink / raw)
To: linux-c-programming
Hi,
how do you use the ioctl.h?
there seems to be little info on it
on the web or in print. If you know
of anything on the web please let me
know.
thank you,
Mike
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: ioctl.h
2005-03-04 19:15 ioctl.h michael young
@ 2005-03-04 20:54 ` J.
2005-03-04 21:55 ` ioctl.h Rechberger Markus
1 sibling, 0 replies; 4+ messages in thread
From: J. @ 2005-03-04 20:54 UTC (permalink / raw)
To: linux-c-programming
On Fri, 4 Mar 2005, michael young wrote:
> Hi,
> how do you use the ioctl.h?
> there seems to be little info on it
> on the web or in print. If you know
> of anything on the web please let me
> know.
>
> thank you,
> Mike
Friday, March 04
ioctl is used for specific hardware control, it's use differs with each
purpose. Could be rewinding tapes, opening your cd-rom player or set your
serialport prefs.. Bit more info on what you want to accomplish ?
That said.. Each GNU/Linux system should have a ioctl_list somewhere in
the manual page section. For example:
~: man -k ioctl
ioctl_list (2) - list of ioctl calls in Linux/i386 kernel
console ioctl (4) [console_ioctl] - ioctl's for console terminal and virtual consoles
console ioctl's (4) [console_ioctls] - ioctl's for console terminal and virtual consoles
console_ioctl (4) - ioctl's for console terminal and virtual consoles
.... etc..
~: man 2 ioctl_list
.......... BIG LIST .......
There should be enough IOCTL code on the www. search C and hardware
control should return the most code I guess...
if((fd = open(dev, O_RDONLY|O_NONBLOCK)) == -1)
return -1;
if(ioctl(fd, CDROMEJECT) == -1)
return -1;
close(fd);
etc......
GoodLuck.. J.
--
http://www.rdrs.net/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: ioctl.h
2005-03-04 19:15 ioctl.h michael young
2005-03-04 20:54 ` ioctl.h J.
@ 2005-03-04 21:55 ` Rechberger Markus
2005-03-07 14:45 ` ioctl.h michael young
1 sibling, 1 reply; 4+ messages in thread
From: Rechberger Markus @ 2005-03-04 21:55 UTC (permalink / raw)
To: michael young; +Cc: linux-c-programming
hey Michael,
here just an example:
this small tool opens the cd tray
#include <sys/types.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <linux/cdrom.h>
int main(){
int cdrom;
if ((cdrom = open("/dev/cdrom",O_RDONLY | O_NONBLOCK)) < 0) {
perror("open");
exit(1);
}
if (ioctl(cdrom,CDROMEJECT,0)<0) {
perror("ioctl");
exit(1);
}
close(cdrom);
return(0);
}
simply build it with gcc tray.c -o tray
look at cdrom.h for more defined operations, you will also find
CDROMEJECT in there, 0 is an argument see the manpage (man ioctl) for
more infos..
Markus
On Fri, 04 Mar 2005 14:15:04 -0500, michael young <mhyoung@valdosta.edu> wrote:
> Hi,
> how do you use the ioctl.h?
> there seems to be little info on it
> on the web or in print. If you know
> of anything on the web please let me
> know.
>
> thank you,
> Mike
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: ioctl.h
2005-03-04 21:55 ` ioctl.h Rechberger Markus
@ 2005-03-07 14:45 ` michael young
0 siblings, 0 replies; 4+ messages in thread
From: michael young @ 2005-03-07 14:45 UTC (permalink / raw)
To: Rechberger Markus; +Cc: linux-c-programming, mailing-lists
kool
thanks guys
i think can run with the info i have
Mike
Rechberger Markus wrote:
>hey Michael,
>
>here just an example:
>
>this small tool opens the cd tray
>
>#include <sys/types.h>
>#include <sys/ioctl.h>
>#include <fcntl.h>
>#include <linux/cdrom.h>
>
>int main(){
> int cdrom;
> if ((cdrom = open("/dev/cdrom",O_RDONLY | O_NONBLOCK)) < 0) {
> perror("open");
> exit(1);
> }
> if (ioctl(cdrom,CDROMEJECT,0)<0) {
> perror("ioctl");
> exit(1);
> }
> close(cdrom);
> return(0);
>}
>
>simply build it with gcc tray.c -o tray
>
>look at cdrom.h for more defined operations, you will also find
>CDROMEJECT in there, 0 is an argument see the manpage (man ioctl) for
>more infos..
>
>Markus
>
>On Fri, 04 Mar 2005 14:15:04 -0500, michael young <mhyoung@valdosta.edu> wrote:
>
>
>>Hi,
>>how do you use the ioctl.h?
>>there seems to be little info on it
>>on the web or in print. If you know
>>of anything on the web please let me
>>know.
>>
>>thank you,
>>Mike
>>
>>-
>>To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
>>the body of a message to majordomo@vger.kernel.org
>>More majordomo info at http://vger.kernel.org/majordomo-info.html
>>
>>
>>
>
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-03-07 14:45 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-04 19:15 ioctl.h michael young
2005-03-04 20:54 ` ioctl.h J.
2005-03-04 21:55 ` ioctl.h Rechberger Markus
2005-03-07 14:45 ` ioctl.h michael young
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).