Commit 06a66573 authored by julien.delange's avatar julien.delange

1. fix error with sockets drivers when a non-socket driver

   is present
2. implement the non blocking keyboard driver with curses library



git-svn-id: https://tecsw.estec.esa.int/svn/taste/trunk/po-hi-c@1385 129961e7-ef38-4bb5-a8f7-c9a525a55882
parent e0666627
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#ifdef __PO_HI_NEED_DRIVER_GENERIC_KEYBOARD #ifdef __PO_HI_NEED_DRIVER_GENERIC_KEYBOARD
void __po_hi_driver_generic_keyboard_poller (void); void __po_hi_driver_generic_keyboard_poller (int* key_pressed);
void __po_hi_driver_generic_keyboard_init (__po_hi_device_id id); void __po_hi_driver_generic_keyboard_init (__po_hi_device_id id);
......
...@@ -10,15 +10,44 @@ ...@@ -10,15 +10,44 @@
#ifdef __PO_HI_NEED_DRIVER_GENERIC_KEYBOARD #ifdef __PO_HI_NEED_DRIVER_GENERIC_KEYBOARD
#include <stdio.h>
#include <stdlib.h>
#include <curses.h>
#include <stdio.h> /* Standard input/output definitions */
#include <stdlib.h>
#include <stdint.h> /* Standard types */
#include <string.h> /* String function definitions */
#include <unistd.h> /* UNIX standard function definitions */
#include <fcntl.h> /* File control definitions */
#include <errno.h> /* Error number definitions */
#include <termios.h> /* POSIX terminal control definitions */
#include <sys/ioctl.h>
#include <getopt.h>
#include <po_hi_debug.h> #include <po_hi_debug.h>
void __po_hi_driver_generic_keyboard_poller (void)
void __po_hi_driver_generic_keyboard_poller (int* key_pressed)
{ {
int key;
__DEBUGMSG ("POLL THE KEYBOARD\n"); __DEBUGMSG ("POLL THE KEYBOARD\n");
key = getch ();
if (key != ERR)
{
*key_pressed = key;
}
else
{
*key_pressed = 0;
}
} }
void __po_hi_driver_generic_keyboard_init (__po_hi_device_id id) void __po_hi_driver_generic_keyboard_init (__po_hi_device_id id)
{ {
WINDOW* win = initscr();
keypad (stdscr, TRUE);
noecho ();
nodelay (win, TRUE);
__DEBUGMSG ("INIT KEYBOARD\n"); __DEBUGMSG ("INIT KEYBOARD\n");
} }
......
...@@ -272,9 +272,9 @@ void* __po_hi_sockets_poller (void) ...@@ -272,9 +272,9 @@ void* __po_hi_sockets_poller (void)
*/ */
for (dev = 0; dev < __PO_HI_NB_DEVICES ; dev++) for (dev = 0; dev < __PO_HI_NB_DEVICES ; dev++)
{ {
if (dev != socket_device_id) if ( (dev != socket_device_id) && (strstr (__po_hi_get_device_naming (dev), "ip") != NULL))
{ {
__DEBUGMSG ("[DRIVER SOCKETS] Poller wait for connection with device %d\n", dev); __DEBUGMSG ("[DRIVER SOCKETS] Poller waits for connection with device %d\n", dev);
/* /*
__PO_HI_SET_SOCKET_TIMEOUT(nodes[socket_device_id].socket,5); __PO_HI_SET_SOCKET_TIMEOUT(nodes[socket_device_id].socket,5);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment