EMILE/libemile/emile_second_get_output.c
2004-12-12 22:59:38 +00:00

48 lines
1.2 KiB
C

static __attribute__((used)) char* rcsid = "$CVSHeader$";
/*
*
* (c) 2004 Laurent Vivier <LaurentVivier@wanadoo.fr>
*
*/
#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
#include "libemile.h"
#include "emile.h"
#include "../second/head.h"
int emile_second_get_output(int fd, unsigned int *console_mask,
unsigned int *bitrate0, int *datasize0,
int *parity0, int *stopbits0,
unsigned int *bitrate1, int *datasize1,
int *parity1, int *stopbits1,
int *gestaltid)
{
emile_l2_header_t header;
int ret;
ret = read(fd, &header, sizeof(header));
if (ret != sizeof(header))
return EEMILE_CANNOT_READ_SECOND;
if (!EMILE_COMPAT(EMILE_03_SIGNATURE, read_long(&header.signature)))
return EEMILE_INVALID_SECOND;
*console_mask = read_long(&header.console_mask);
*bitrate0 = read_long(&header.serial0_bitrate);
*datasize0 = header.serial0_datasize;
*parity0 = header.serial0_parity;
*stopbits0 = header.serial0_stopbits;
*bitrate1 = read_long(&header.serial1_bitrate);
*datasize1 = header.serial1_datasize;
*parity1 = header.serial1_parity;
*stopbits1 = header.serial1_stopbits;
*gestaltid = read_long(&header.gestaltID);
return 0;
}