comparison lirc_mp.c @ 1973:5216f108cb4f

all error/warn/info messages moved to help_mp-en.h for translation
author arpi
date Wed, 26 Sep 2001 21:35:14 +0000
parents 37d6e98cb645
children 7858bc1b360d
comparison
equal deleted inserted replaced
1972:78924572fddf 1973:5216f108cb4f
35 void lirc_mp_setup(void){ 35 void lirc_mp_setup(void){
36 36
37 int lirc_flags; 37 int lirc_flags;
38 int lirc_sock; 38 int lirc_sock;
39 39
40 printf("Setting up lirc support...\n"); 40 mp_msg(MSGT_LIRC,MSGL_INFO,MSGTR_SettingUpLIRC);
41 if((lirc_sock=lirc_init("mplayer_lirc",1))==-1){ 41 if((lirc_sock=lirc_init("mplayer_lirc",1))==-1){
42 printf("Failed opening lirc support!\n"); 42 mp_msg(MSGT_LIRC,MSGL_ERR,MSGTR_LIRCopenfailed MSGTR_LIRCdisabled);
43 printf("You won't be able to use your remote control\n");
44 return; 43 return;
45 } 44 }
46 45
47 fcntl(lirc_sock,F_SETOWN,getpid()); 46 fcntl(lirc_sock,F_SETOWN,getpid());
48 lirc_flags=fcntl(lirc_sock,F_GETFL,0); 47 lirc_flags=fcntl(lirc_sock,F_GETFL,0);
49 if(lirc_flags!=-1) 48 if(lirc_flags!=-1)
50 { 49 {
51 fcntl(lirc_sock,F_SETFL,lirc_flags|O_NONBLOCK); 50 fcntl(lirc_sock,F_SETFL,lirc_flags|O_NONBLOCK);
52 }else{ 51 }else{
53 lirc_deinit(); 52 lirc_deinit();
54 printf("Something's wrong with the lirc socket: %s\n", 53 mp_msg(MSGT_LIRC,MSGL_ERR,MSGTR_LIRCsocketerr MSGTR_LIRCdisabled,strerror(errno));
55 strerror(errno));
56 printf("You won't be able to use your remote control\n");
57 return; 54 return;
58 } 55 }
59 56
60 57
61 if(lirc_readconfig( lirc_configfile,&lirc_config,NULL )!=0 ){ 58 if(lirc_readconfig( lirc_configfile,&lirc_config,NULL )!=0 ){
62 printf("Failed to read config file %s !\n", 59 mp_msg(MSGT_LIRC,MSGL_ERR,MSGTR_LIRCcfgerr MSGTR_LIRCdisabled,
63 lirc_configfile == NULL ? "~/.lircrc" : lirc_configfile); 60 lirc_configfile == NULL ? "~/.lircrc" : lirc_configfile);
64 printf("You won't be able to use your remote control\n");
65 lirc_deinit(); 61 lirc_deinit();
66 return; 62 return;
67 } 63 }
68 printf("LIRC init was successful.\n"); 64 mp_msg(MSGT_LIRC,MSGL_V,"LIRC init was successful.\n");
69 lirc_is_setup = 1; 65 lirc_is_setup = 1;
70 } 66 }
71 67
72 // cleanup routine ------------------------------------------- 68 // cleanup routine -------------------------------------------
73 69
74 void lirc_mp_cleanup(void){ 70 void lirc_mp_cleanup(void){
75 if(lirc_is_setup != 0){ 71 if(lirc_is_setup != 0){
76 printf("Cleaning up lirc stuff.\n"); 72 mp_msg(MSGT_LIRC,MSGL_V,"Cleaning up lirc stuff.\n");
77 lirc_mp_getinput(NULL); 73 lirc_mp_getinput(NULL);
78 lirc_freeconfig(lirc_config); 74 lirc_freeconfig(lirc_config);
79 lirc_deinit(); 75 lirc_deinit();
80 lirc_is_setup = 0; 76 lirc_is_setup = 0;
81 } 77 }
135 131
136 } 132 }
137 } 133 }
138 free(code); 134 free(code);
139 if(ret==-1){ 135 if(ret==-1){
140 printf("LIRC: lirc_code2char() returned an error!\n"); 136 mp_msg(MSGT_LIRC,MSGL_V,"LIRC: lirc_code2char() returned an error!\n");
141 } 137 }
142 } 138 }
143 } 139 }
144 } 140 }
145 return retval; 141 return retval;