1 #ifdef HAVE_DREAMBOX_HARDWARE
8 fd_rc
=open(RC_DEVICE
, O_RDONLY
);
14 fcntl(fd_rc
, F_SETFL
, O_NONBLOCK
);
15 read( fd_rc
, buf
, 32 );
17 pthread_join(thrRc
,NULL
);
18 if (pthread_create (&thrRc
, NULL
, ThreadRc
, (void *) fd_rc
) != 0 )
19 perror("[RcInput] pthread_created error");
22 fd_bu
=open(BUTTON_DEVICE
, O_RDONLY
);
25 perror(BUTTON_DEVICE
);
28 pthread_join(thrBu
,NULL
);
29 if (pthread_create (&thrBu
, NULL
, ThreadBu
, (void *) fd_bu
) != 0 )
30 perror("[ButtonInput] pthread_created error");
33 void* RcInput::ThreadBu(void * fd_bu
)
35 printf("[ButtonInput] available\n");
36 static unsigned short bucode
=0;
37 unsigned short rccode
=0;
40 if (read((int)fd_bu
, &bucode
, 2)==2)
41 if(bucode
!= BUTTON_BREAK
)
45 case BUTTON_EXIT
: rccode
= RC_EXIT
; break;
46 case BUTTON_UP
: rccode
= RC_UP
; break;
47 case BUTTON_DOWN
: rccode
= RC_DOWN
; break;
49 RcInput::getInstance()->selected(rccode
);
52 usleep(10000);//repeattimer
59 void* RcInput::ThreadRc(void * fd_rc
)
61 printf("[RCInput] available\n");
62 static unsigned short rccode
=0;
65 if (read((int)fd_rc
, &rccode
, 2)==2)
66 if (rccode
!= RC_BREAK
&& rccode
< 0x8000)
67 RcInput::getInstance()->selected(rccode
);
69 usleep(10000);//repeattimer
78 if (fd_rc
>= 0) close(fd_rc
);
79 if (fd_bu
>= 0) close(fd_bu
);
82 RcInput
* RcInput::getInstance()
84 static RcInput
* rcinput
= NULL
;
85 if(rcinput
== NULL
) { rcinput
= new RcInput(); }