Serial / IOCTL
Hello,
Hmm I've got a programm showing the status of my Raid-5 with a small device attached to the serial port. Though serial support is in my kernel (when copying "garbage" to /dev/ttyS0" it "works") my program stopped working. I'm using the RTS and DTR Lines (high and low) to signal the status of the raid with 2.4 and pre it worked without any problems but now :Pengy: Maybe someone can help me how to set the RTS/DTR lines high and low with 2.6 Thnx :-) FGordon This is my code doing the line switching and that worked with all kernels pre 2.6 int Ioctl(int fd, int flag, int *state) { int ret; if ((ret=ioctl(fd, flag, state)) < 0) err_sys("ioctl() error"); return (ret); } /* Switch the LEDs on or off */ int setled(enum led whichled, int fd, int onoff, int *ledstate) { int bitpat; int state; int dummy; if (whichled == green) { bitpat=TIOCM_RTS; } else if (whichled == red) { bitpat=TIOCM_DTR; } else bitpat=(TIOCM_RTS | TIOCM_DTR); if (onoff) *ledstate |= bitpat; else *ledstate &= ~bitpat; dummy = Ioctl(fd, TIOCMSET, ledstate); dummy = Ioctl(fd, TIOCMGET, &state); return (*ledstate); } |
This is what works for me.
Works fine on 2.4 as well as 2.6 kernels. Code:
/* Copyright (C) 2003 Heiko Noordhof <heikyAusers.sf.net> |
Many Thanks :-)) :-)) this does work finally :-)
|
All times are GMT -5. The time now is 04:33 AM. |