mirror of
https://github.com/ipmitool/ipmitool.git
synced 2025-05-10 10:37:22 +00:00
lib/ipmi_tsol.c - make code formatting saner
This commit is contained in:
parent
6d25903a0b
commit
aefd287222
157
lib/ipmi_tsol.c
157
lib/ipmi_tsol.c
@ -76,7 +76,8 @@ static int _altterm = 0;
|
|||||||
extern int verbose;
|
extern int verbose;
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ipmi_tsol_command(struct ipmi_intf * intf, char *recvip, int port, unsigned char cmd)
|
ipmi_tsol_command(struct ipmi_intf *intf, char *recvip, int port,
|
||||||
|
unsigned char cmd)
|
||||||
{
|
{
|
||||||
struct ipmi_rs *rsp;
|
struct ipmi_rs *rsp;
|
||||||
struct ipmi_rq req;
|
struct ipmi_rq req;
|
||||||
@ -85,9 +86,8 @@ ipmi_tsol_command(struct ipmi_intf * intf, char *recvip, int port, unsigned char
|
|||||||
|
|
||||||
if (sscanf(recvip, "%d.%d.%d.%d", &ip1, &ip2, &ip3, &ip4) != 4) {
|
if (sscanf(recvip, "%d.%d.%d.%d", &ip1, &ip2, &ip3, &ip4) != 4) {
|
||||||
lprintf(LOG_ERR, "Invalid IP address: %s", recvip);
|
lprintf(LOG_ERR, "Invalid IP address: %s", recvip);
|
||||||
return -1;
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(&req, 0, sizeof(struct ipmi_rq));
|
memset(&req, 0, sizeof(struct ipmi_rq));
|
||||||
req.msg.netfn = IPMI_NETFN_TSOL;
|
req.msg.netfn = IPMI_NETFN_TSOL;
|
||||||
req.msg.cmd = cmd;
|
req.msg.cmd = cmd;
|
||||||
@ -105,14 +105,13 @@ ipmi_tsol_command(struct ipmi_intf * intf, char *recvip, int port, unsigned char
|
|||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if (rsp == NULL) {
|
if (rsp == NULL) {
|
||||||
lprintf(LOG_ERR, "Unable to perform TSOL command");
|
lprintf(LOG_ERR, "Unable to perform TSOL command");
|
||||||
return -1;
|
return (-1);
|
||||||
}
|
}
|
||||||
if (rsp->ccode > 0) {
|
if (rsp->ccode > 0) {
|
||||||
lprintf(LOG_ERR, "Unable to perform TSOL command: %s",
|
lprintf(LOG_ERR, "Unable to perform TSOL command: %s",
|
||||||
val2str(rsp->ccode, completion_code_vals));
|
val2str(rsp->ccode, completion_code_vals));
|
||||||
return -1;
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -159,7 +158,6 @@ ipmi_tsol_send_keystroke(struct ipmi_intf * intf, char *buff, int length)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,16 +165,12 @@ static int
|
|||||||
tsol_keepalive(struct ipmi_intf *intf)
|
tsol_keepalive(struct ipmi_intf *intf)
|
||||||
{
|
{
|
||||||
struct timeval end;
|
struct timeval end;
|
||||||
|
|
||||||
gettimeofday(&end, 0);
|
gettimeofday(&end, 0);
|
||||||
|
if (end.tv_sec - _start_keepalive.tv_sec <= 30) {
|
||||||
if (end.tv_sec - _start_keepalive.tv_sec <= 30)
|
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
intf->keepalive(intf);
|
intf->keepalive(intf);
|
||||||
|
|
||||||
gettimeofday(&_start_keepalive, 0);
|
gettimeofday(&_start_keepalive, 0);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,15 +195,15 @@ print_escape_seq(struct ipmi_intf *intf)
|
|||||||
static int
|
static int
|
||||||
leave_raw_mode(void)
|
leave_raw_mode(void)
|
||||||
{
|
{
|
||||||
if (!_in_raw_mode)
|
if (!_in_raw_mode) {
|
||||||
return -1;
|
return -1;
|
||||||
else if (tcsetattr(fileno(stdin), TCSADRAIN, &_saved_tio) == -1)
|
} else if (tcsetattr(fileno(stdin), TCSADRAIN, &_saved_tio) == -1) {
|
||||||
lperror(LOG_ERR, "tcsetattr(stdin)");
|
lperror(LOG_ERR, "tcsetattr(stdin)");
|
||||||
else if (tcsetattr(fileno(stdout), TCSADRAIN, &_saved_tio) == -1)
|
} else if (tcsetattr(fileno(stdout), TCSADRAIN, &_saved_tio) == -1) {
|
||||||
lperror(LOG_ERR, "tcsetattr(stdout)");
|
lperror(LOG_ERR, "tcsetattr(stdout)");
|
||||||
else
|
} else {
|
||||||
_in_raw_mode = 0;
|
_in_raw_mode = 0;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -217,14 +211,12 @@ static int
|
|||||||
enter_raw_mode(void)
|
enter_raw_mode(void)
|
||||||
{
|
{
|
||||||
struct termios tio;
|
struct termios tio;
|
||||||
|
|
||||||
if (tcgetattr(fileno(stdout), &_saved_tio) < 0) {
|
if (tcgetattr(fileno(stdout), &_saved_tio) < 0) {
|
||||||
lperror(LOG_ERR, "tcgetattr failed");
|
lperror(LOG_ERR, "tcgetattr failed");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
tio = _saved_tio;
|
tio = _saved_tio;
|
||||||
|
|
||||||
if (_altterm) {
|
if (_altterm) {
|
||||||
tio.c_iflag &= (ISTRIP | IGNBRK);
|
tio.c_iflag &= (ISTRIP | IGNBRK);
|
||||||
tio.c_cflag &= ~(CSIZE | PARENB | IXON | IXOFF | IXANY);
|
tio.c_cflag &= ~(CSIZE | PARENB | IXON | IXOFF | IXANY);
|
||||||
@ -241,13 +233,13 @@ enter_raw_mode(void)
|
|||||||
tio.c_cc[VTIME] = 0;
|
tio.c_cc[VTIME] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tcsetattr(fileno(stdin), TCSADRAIN, &tio) < 0)
|
if (tcsetattr(fileno(stdin), TCSADRAIN, &tio) < 0) {
|
||||||
lperror(LOG_ERR, "tcsetattr(stdin)");
|
lperror(LOG_ERR, "tcsetattr(stdin)");
|
||||||
else if (tcsetattr(fileno(stdout), TCSADRAIN, &tio) < 0)
|
} else if (tcsetattr(fileno(stdout), TCSADRAIN, &tio) < 0) {
|
||||||
lperror(LOG_ERR, "tcsetattr(stdout)");
|
lperror(LOG_ERR, "tcsetattr(stdout)");
|
||||||
else
|
} else {
|
||||||
_in_raw_mode = 1;
|
_in_raw_mode = 1;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -255,12 +247,11 @@ static void
|
|||||||
suspend_self(int restore_tty)
|
suspend_self(int restore_tty)
|
||||||
{
|
{
|
||||||
leave_raw_mode();
|
leave_raw_mode();
|
||||||
|
|
||||||
kill(getpid(), SIGTSTP);
|
kill(getpid(), SIGTSTP);
|
||||||
|
if (restore_tty) {
|
||||||
if (restore_tty)
|
|
||||||
enter_raw_mode();
|
enter_raw_mode();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
do_inbuf_actions(struct ipmi_intf *intf, char *in_buff, int len)
|
do_inbuf_actions(struct ipmi_intf *intf, char *in_buff, int len)
|
||||||
@ -291,19 +282,18 @@ do_inbuf_actions(struct ipmi_intf *intf, char *in_buff, int len)
|
|||||||
printf("%c. [terminated ipmitool]\n",
|
printf("%c. [terminated ipmitool]\n",
|
||||||
intf->session->sol_escape_char);
|
intf->session->sol_escape_char);
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
case 'Z' - 64:
|
case 'Z' - 64:
|
||||||
printf("%c^Z [suspend ipmitool]\n",
|
printf("%c^Z [suspend ipmitool]\n",
|
||||||
intf->session->sol_escape_char);
|
intf->session->sol_escape_char);
|
||||||
suspend_self(1); /* Restore tty back to raw */
|
/* Restore tty back to raw */
|
||||||
|
suspend_self(1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'X' - 64:
|
case 'X' - 64:
|
||||||
printf("%c^X [suspend ipmitool]\n",
|
printf("%c^X [suspend ipmitool]\n",
|
||||||
intf->session->sol_escape_char);
|
intf->session->sol_escape_char);
|
||||||
suspend_self(0); /* Don't restore to raw mode */
|
/* Don't restore to raw mode */
|
||||||
|
suspend_self(0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '?':
|
case '?':
|
||||||
printf("%c? [ipmitool help]\n",
|
printf("%c? [ipmitool help]\n",
|
||||||
intf->session->sol_escape_char);
|
intf->session->sol_escape_char);
|
||||||
@ -311,18 +301,14 @@ do_inbuf_actions(struct ipmi_intf *intf, char *in_buff, int len)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
memmove(in_buff, in_buff + 1, len - i - 1);
|
memmove(in_buff, (in_buff + 1), (len - i - 1));
|
||||||
len--;
|
len--;
|
||||||
in_esc = 0;
|
in_esc = 0;
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
last_was_cr = (in_buff[i] == '\r' || in_buff[i] == '\n');
|
last_was_cr = (in_buff[i] == '\r' || in_buff[i] == '\n');
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -330,27 +316,25 @@ do_inbuf_actions(struct ipmi_intf *intf, char *in_buff, int len)
|
|||||||
static void
|
static void
|
||||||
do_terminal_cleanup(void)
|
do_terminal_cleanup(void)
|
||||||
{
|
{
|
||||||
if (_saved_winsize.ws_row > 0 && _saved_winsize.ws_col > 0)
|
if (_saved_winsize.ws_row > 0 && _saved_winsize.ws_col > 0) {
|
||||||
ioctl(fileno(stdout), TIOCSWINSZ, &_saved_winsize);
|
ioctl(fileno(stdout), TIOCSWINSZ, &_saved_winsize);
|
||||||
|
}
|
||||||
leave_raw_mode();
|
leave_raw_mode();
|
||||||
|
if (errno) {
|
||||||
if (errno)
|
|
||||||
lprintf(LOG_ERR, "Exiting due to error %d -> %s",
|
lprintf(LOG_ERR, "Exiting due to error %d -> %s",
|
||||||
errno, strerror(errno));
|
errno, strerror(errno));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_terminal_size(int rows, int cols)
|
set_terminal_size(int rows, int cols)
|
||||||
{
|
{
|
||||||
struct winsize winsize;
|
struct winsize winsize;
|
||||||
|
if (rows <= 0 || cols <= 0) {
|
||||||
if (rows <= 0 || cols <= 0)
|
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
/* save initial winsize */
|
/* save initial winsize */
|
||||||
ioctl(fileno(stdout), TIOCGWINSZ, &_saved_winsize);
|
ioctl(fileno(stdout), TIOCGWINSZ, &_saved_winsize);
|
||||||
|
|
||||||
/* set new winsize */
|
/* set new winsize */
|
||||||
winsize.ws_row = rows;
|
winsize.ws_row = rows;
|
||||||
winsize.ws_col = cols;
|
winsize.ws_col = cols;
|
||||||
@ -361,20 +345,24 @@ static void
|
|||||||
print_tsol_usage(void)
|
print_tsol_usage(void)
|
||||||
{
|
{
|
||||||
struct winsize winsize;
|
struct winsize winsize;
|
||||||
|
lprintf(LOG_NOTICE,
|
||||||
lprintf(LOG_NOTICE, "Usage: tsol [recvip] [port=NUM] [ro|rw] [rows=NUM] [cols=NUM] [altterm]");
|
"Usage: tsol [recvip] [port=NUM] [ro|rw] [rows=NUM] [cols=NUM] [altterm]");
|
||||||
lprintf(LOG_NOTICE, " recvip Receiver IP Address [default=local]");
|
lprintf(LOG_NOTICE,
|
||||||
lprintf(LOG_NOTICE, " port=NUM Receiver UDP Port [default=%d]",
|
" recvip Receiver IP Address [default=local]");
|
||||||
|
lprintf(LOG_NOTICE,
|
||||||
|
" port=NUM Receiver UDP Port [default=%d]",
|
||||||
IPMI_TSOL_DEF_PORT);
|
IPMI_TSOL_DEF_PORT);
|
||||||
lprintf(LOG_NOTICE, " ro|rw Set Read-Only or Read-Write [default=rw]");
|
lprintf(LOG_NOTICE,
|
||||||
|
" ro|rw Set Read-Only or Read-Write [default=rw]");
|
||||||
ioctl(fileno(stdout), TIOCGWINSZ, &winsize);
|
ioctl(fileno(stdout), TIOCGWINSZ, &winsize);
|
||||||
lprintf(LOG_NOTICE, " rows=NUM Set terminal rows [default=%d]",
|
lprintf(LOG_NOTICE,
|
||||||
|
" rows=NUM Set terminal rows [default=%d]",
|
||||||
winsize.ws_row);
|
winsize.ws_row);
|
||||||
lprintf(LOG_NOTICE, " cols=NUM Set terminal columns [default=%d]",
|
lprintf(LOG_NOTICE,
|
||||||
|
" cols=NUM Set terminal columns [default=%d]",
|
||||||
winsize.ws_col);
|
winsize.ws_col);
|
||||||
|
lprintf(LOG_NOTICE,
|
||||||
lprintf(LOG_NOTICE, " altterm Alternate terminal setup [default=off]");
|
" altterm Alternate terminal setup [default=off]");
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -394,7 +382,7 @@ ipmi_tsol_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
|
|
||||||
if (strlen(intf->name) < 3 || strncmp(intf->name, "lan", 3) != 0) {
|
if (strlen(intf->name) < 3 || strncmp(intf->name, "lan", 3) != 0) {
|
||||||
lprintf(LOG_ERR, "Error: Tyan SOL is only available over lan interface");
|
lprintf(LOG_ERR, "Error: Tyan SOL is only available over lan interface");
|
||||||
return -1;
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i<argc; i++) {
|
for (i = 0; i<argc; i++) {
|
||||||
@ -402,24 +390,26 @@ ipmi_tsol_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
/* not free'd ...*/
|
/* not free'd ...*/
|
||||||
/* recvip = strdup(argv[i]); */
|
/* recvip = strdup(argv[i]); */
|
||||||
recvip = argv[i];
|
recvip = argv[i];
|
||||||
}
|
} else if (sscanf(argv[i], "port=%d", &ip1) == 1) {
|
||||||
else if (sscanf(argv[i], "port=%d", &ip1) == 1)
|
|
||||||
port = ip1;
|
port = ip1;
|
||||||
else if (sscanf(argv[i], "rows=%d", &ip1) == 1)
|
} else if (sscanf(argv[i], "rows=%d", &ip1) == 1) {
|
||||||
rows = ip1;
|
rows = ip1;
|
||||||
else if (sscanf(argv[i], "cols=%d", &ip1) == 1)
|
} else if (sscanf(argv[i], "cols=%d", &ip1) == 1) {
|
||||||
cols = ip1;
|
cols = ip1;
|
||||||
else if (strlen(argv[i]) == 2 && strncmp(argv[i], "ro", 2) == 0)
|
} else if (strlen(argv[i]) == 2
|
||||||
|
&& strncmp(argv[i], "ro", 2) == 0) {
|
||||||
read_only = 1;
|
read_only = 1;
|
||||||
else if (strlen(argv[i]) == 2 && strncmp(argv[i], "rw", 2) == 0)
|
} else if (strlen(argv[i]) == 2
|
||||||
|
&& strncmp(argv[i], "rw", 2) == 0) {
|
||||||
read_only = 0;
|
read_only = 0;
|
||||||
else if (strlen(argv[i]) == 7 && strncmp(argv[i], "altterm", 7) == 0)
|
} else if (strlen(argv[i]) == 7
|
||||||
|
&& strncmp(argv[i], "altterm", 7) == 0) {
|
||||||
_altterm = 1;
|
_altterm = 1;
|
||||||
else if (strlen(argv[i]) == 4 && strncmp(argv[i], "help", 4) == 0) {
|
} else if (strlen(argv[i]) == 4
|
||||||
|
&& strncmp(argv[i], "help", 4) == 0) {
|
||||||
print_tsol_usage();
|
print_tsol_usage();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
print_tsol_usage();
|
print_tsol_usage();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -457,7 +447,7 @@ ipmi_tsol_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
lprintf(LOG_ERR, "Can't open port %d", port);
|
lprintf(LOG_ERR, "Can't open port %d", port);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (-1 == bind(fd_socket, (struct sockaddr *)&sin, sizeof(sin))) {
|
if (bind(fd_socket, (struct sockaddr *)&sin, sizeof(sin)) == (-1)) {
|
||||||
lprintf(LOG_ERR, "Failed to bind socket.");
|
lprintf(LOG_ERR, "Failed to bind socket.");
|
||||||
close(fd_socket);
|
close(fd_socket);
|
||||||
return -1;
|
return -1;
|
||||||
@ -467,7 +457,8 @@ ipmi_tsol_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
* retrieve local IP address if not supplied on command line
|
* retrieve local IP address if not supplied on command line
|
||||||
*/
|
*/
|
||||||
if (recvip == NULL) {
|
if (recvip == NULL) {
|
||||||
result = intf->open(intf); /* must connect first */
|
/* must connect first */
|
||||||
|
result = intf->open(intf);
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
close(fd_socket);
|
close(fd_socket);
|
||||||
return -1;
|
return -1;
|
||||||
@ -502,7 +493,7 @@ ipmi_tsol_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
lprintf(LOG_ERR, "Error starting SOL");
|
lprintf(LOG_ERR, "Error starting SOL");
|
||||||
close(fd_socket);
|
close(fd_socket);
|
||||||
return -1;
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("[SOL Session operational. Use %c? for help]\n",
|
printf("[SOL Session operational. Use %c? for help]\n",
|
||||||
@ -536,18 +527,22 @@ ipmi_tsol_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
result = poll(fds, 3, 15 * 1000);
|
result = poll(fds, 3, 15 * 1000);
|
||||||
if (result < 0)
|
if (result < 0) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/* send keepalive packet */
|
/* send keepalive packet */
|
||||||
tsol_keepalive(intf);
|
tsol_keepalive(intf);
|
||||||
|
|
||||||
if ((fds[0].revents & POLLIN) && (sizeof(out_buff) > out_buff_fill)) {
|
if ((fds[0].revents & POLLIN) && (sizeof(out_buff) > out_buff_fill)) {
|
||||||
socklen_t sin_len = sizeof(sin);
|
socklen_t sin_len = sizeof(sin);
|
||||||
result = recvfrom(fd_socket, buff, sizeof(out_buff) - out_buff_fill + 4, 0,
|
/* Note - buffer over-flow here */
|
||||||
|
result = recvfrom(fd_socket, buff,
|
||||||
|
sizeof(out_buff) - out_buff_fill + 4, 0,
|
||||||
(struct sockaddr *)&sin, &sin_len);
|
(struct sockaddr *)&sin, &sin_len);
|
||||||
|
/* read the data from udp socket,
|
||||||
/* read the data from udp socket, skip some bytes in the head */
|
* skip some bytes in the head
|
||||||
|
*/
|
||||||
if ((result - 4) > 0) {
|
if ((result - 4) > 0) {
|
||||||
int length = result - 4;
|
int length = result - 4;
|
||||||
#if 1
|
#if 1
|
||||||
@ -562,23 +557,27 @@ ipmi_tsol_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((fds[1].revents & POLLIN) && (sizeof(in_buff) > in_buff_fill)) {
|
if ((fds[1].revents & POLLIN) && (sizeof(in_buff) > in_buff_fill)) {
|
||||||
|
/* Read from keyboard */
|
||||||
result = read(fileno(stdin), in_buff + in_buff_fill,
|
result = read(fileno(stdin), in_buff + in_buff_fill,
|
||||||
sizeof(in_buff) - in_buff_fill); // read from keyboard
|
sizeof(in_buff) - in_buff_fill);
|
||||||
if (result > 0) {
|
if (result > 0) {
|
||||||
int bytes;
|
int bytes;
|
||||||
bytes = do_inbuf_actions(intf, in_buff + in_buff_fill, result);
|
bytes = do_inbuf_actions(intf,
|
||||||
|
in_buff + in_buff_fill, result);
|
||||||
if (bytes < 0) {
|
if (bytes < 0) {
|
||||||
result = ipmi_tsol_stop(intf, recvip, port);
|
result = ipmi_tsol_stop(intf, recvip, port);
|
||||||
do_terminal_cleanup();
|
do_terminal_cleanup();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (read_only)
|
if (read_only) {
|
||||||
bytes = 0;
|
bytes = 0;
|
||||||
|
}
|
||||||
in_buff_fill += bytes;
|
in_buff_fill += bytes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((fds[2].revents & POLLOUT) && out_buff_fill) {
|
if ((fds[2].revents & POLLOUT) && out_buff_fill) {
|
||||||
result = write(fileno(stdout), out_buff, out_buff_fill); // to screen
|
/* To screen */
|
||||||
|
result = write(fileno(stdout), out_buff, out_buff_fill);
|
||||||
if (result > 0) {
|
if (result > 0) {
|
||||||
out_buff_fill -= result;
|
out_buff_fill -= result;
|
||||||
if (out_buff_fill) {
|
if (out_buff_fill) {
|
||||||
@ -591,7 +590,8 @@ ipmi_tsol_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
* translate key and send that to SMDC using IPMI
|
* translate key and send that to SMDC using IPMI
|
||||||
* ipmitool -I lan -H 192.168.168.227 -U Administrator raw 0x30 0x03 0x04 0x1B 0x5B 0x43
|
* ipmitool -I lan -H 192.168.168.227 -U Administrator raw 0x30 0x03 0x04 0x1B 0x5B 0x43
|
||||||
*/
|
*/
|
||||||
result = ipmi_tsol_send_keystroke(intf, in_buff, __min(in_buff_fill,14));
|
result = ipmi_tsol_send_keystroke(intf,
|
||||||
|
in_buff, __min(in_buff_fill, 14));
|
||||||
if (result > 0) {
|
if (result > 0) {
|
||||||
gettimeofday(&_start_keepalive, 0);
|
gettimeofday(&_start_keepalive, 0);
|
||||||
in_buff_fill -= result;
|
in_buff_fill -= result;
|
||||||
@ -603,6 +603,5 @@ ipmi_tsol_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
fds = (in_buff_fill || out_buff_fill )?
|
fds = (in_buff_fill || out_buff_fill )?
|
||||||
fds_data_wait : fds_wait;
|
fds_data_wait : fds_wait;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user