modified for wheezy - without sound.c
This commit is contained in:
parent
ecce799bb7
commit
87f8437b87
6
Makefile
6
Makefile
@ -1,7 +1,7 @@
|
|||||||
SRC = irmc.c sound.c
|
SRC = irmc.c
|
||||||
OBJ = ${SRC:.c=.o}
|
OBJ = ${SRC:.c=.o}
|
||||||
LDFLAGS = -lm -lossaudio
|
LDFLAGS = -L/usr/local/lib -lm -lmorse
|
||||||
CFLAGS = -Wall
|
CFLAGS = -I/usr/local/include -Wall
|
||||||
INSTALLDIR = ${HOME}/bin
|
INSTALLDIR = ${HOME}/bin
|
||||||
|
|
||||||
all: options irmc
|
all: options irmc
|
||||||
|
26
irmc.c
26
irmc.c
@ -11,13 +11,14 @@
|
|||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#ifdef __MACH__
|
|
||||||
#include <morse/beep.h>
|
#include <morse/beep.h>
|
||||||
|
#ifdef __MACH__
|
||||||
#define LIBOSS_INTERNAL
|
#define LIBOSS_INTERNAL
|
||||||
#include <liboss/soundcard.h> //will not be used for audio any more
|
#include <liboss/soundcard.h> //will not be used for audio any more
|
||||||
#else
|
#else
|
||||||
#include <soundcard.h>
|
#include <linux/ioctl.h>
|
||||||
#include "sound.h"
|
#include <asm-generic/ioctl.h>
|
||||||
|
#include <asm-generic/termios.h>
|
||||||
#endif
|
#endif
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
@ -252,15 +253,10 @@ commandmode(void)
|
|||||||
|
|
||||||
if((strncmp(cmd, "aon", 3)) == 0){
|
if((strncmp(cmd, "aon", 3)) == 0){
|
||||||
audio_status = 1;
|
audio_status = 1;
|
||||||
#ifdef __MACH__
|
|
||||||
#else
|
|
||||||
fd_speaker = open_audio_device(soundcard, O_WRONLY);
|
|
||||||
#endif
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if((strncmp(cmd, "aoff", 3)) == 0){
|
if((strncmp(cmd, "aoff", 3)) == 0){
|
||||||
audio_status = 0;
|
audio_status = 0;
|
||||||
close(fd_speaker);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
printf("?\n");
|
printf("?\n");
|
||||||
@ -387,11 +383,7 @@ int main(int argc, char *argv[])
|
|||||||
inet_ntop(p->ai_family, get_in_addr((struct sockaddr *)p->ai_addr),
|
inet_ntop(p->ai_family, get_in_addr((struct sockaddr *)p->ai_addr),
|
||||||
s, sizeof s);
|
s, sizeof s);
|
||||||
printf("irmc: connected to %s\n", s);
|
printf("irmc: connected to %s\n", s);
|
||||||
#ifdef __MACH__
|
|
||||||
beep_init();
|
beep_init();
|
||||||
#else
|
|
||||||
fd_speaker = open_audio_device(soundcard, O_WRONLY);
|
|
||||||
#endif
|
|
||||||
fd_serial = open(serialport, O_RDWR | O_NOCTTY | O_NDELAY);
|
fd_serial = open(serialport, O_RDWR | O_NOCTTY | O_NDELAY);
|
||||||
if(fd_serial == -1) {
|
if(fd_serial == -1) {
|
||||||
printf("irmc: unable to open serial port.\n");
|
printf("irmc: unable to open serial port.\n");
|
||||||
@ -399,9 +391,6 @@ int main(int argc, char *argv[])
|
|||||||
freeaddrinfo(servinfo); /* all done with this structure */
|
freeaddrinfo(servinfo); /* all done with this structure */
|
||||||
|
|
||||||
key_release_t1 = fastclock();
|
key_release_t1 = fastclock();
|
||||||
#ifndef __MACH__
|
|
||||||
init_sound(); // TODO rename to init sinus!
|
|
||||||
#endif
|
|
||||||
identifyclient();
|
identifyclient();
|
||||||
|
|
||||||
/* Main Loop */
|
/* Main Loop */
|
||||||
@ -438,7 +427,6 @@ int main(int argc, char *argv[])
|
|||||||
default:
|
default:
|
||||||
if(audio_status == 1)
|
if(audio_status == 1)
|
||||||
{
|
{
|
||||||
#ifdef __MACH__
|
|
||||||
|
|
||||||
int length = rx_data_packet.code[i];
|
int length = rx_data_packet.code[i];
|
||||||
if(length == 0 || abs(length) > 2000) {
|
if(length == 0 || abs(length) > 2000) {
|
||||||
@ -453,9 +441,6 @@ else
|
|||||||
beep(1000.0, length/1000.);
|
beep(1000.0, length/1000.);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
play_code_element (rx_data_packet.code[i]);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -500,9 +485,6 @@ beep(1000.0, length/1000.);
|
|||||||
|
|
||||||
send(fd_socket, &disconnect_packet, sizeof(disconnect_packet), 0);
|
send(fd_socket, &disconnect_packet, sizeof(disconnect_packet), 0);
|
||||||
close(fd_socket);
|
close(fd_socket);
|
||||||
close(fd_speaker);
|
|
||||||
#ifdef __MACH__
|
|
||||||
#endif
|
|
||||||
close(fd_serial);
|
close(fd_serial);
|
||||||
|
|
||||||
exit(0);
|
exit(0);
|
||||||
|
Loading…
Reference in New Issue
Block a user