Mam LEDa podłączonego do rs232 do lini DTR. Po podłączeniu do portu dioda świeci, jak wyłączyć tę diodę, próbowałem tym, ale nie działa. OS to BSD.

#include <stdio.h>  
#include <string.h> 
#include <unistd.h> 
#include <fcntl.h>  
#include <errno.h>  
#include <termios.h>
#include <sys/ioctl.h>

int main()
{
    int fd;
    fd = open("/dev/ttyd0", O_RDWR | O_NOCTTY | O_NDELAY);
    if (fd == -1)
    {
        perror("Unable to open /dev/ttyd0");
    }
    else
    {
        struct termios options;
        fcntl(fd, F_SETFL, 0);
        int status;
        ioctl(fd, TIOCMGET, &status);        
        status &= ~TIOCM_DTR;                    
        ioctl(fd, TIOCMSET, &status);
        sleep(2);
        printf("done...\n");
        close(fd);
    }
    return 0;
}