running = 1;
#ifdef __APPLE__
- cw_event=sem_open("CW", O_CREAT, 0700, 0);
+ sem_unlink("CW");
+ cw_event=sem_open("CW", O_CREAT | O_EXCL), 0700, 0);
rc = (cw_event == SEM_FAILED);
#else
rc = sem_init(&cw_event, 0, 0);
if(sendto(discovery_socket,buffer,60,0,(struct sockaddr*)&to_addr,sizeof(to_addr))<0) {
perror("new_discover: sendto socket failed for discovery_socket\n");
- exit(-1);
+ return;
}
// wait for receive thread to complete
interface_addr.sin_port = htons(0); // system assigned port
if(bind(discovery_socket,(struct sockaddr*)&interface_addr,sizeof(interface_addr))<0) {
perror("discover: bind socket failed for discovery_socket:");
- exit(-1);
+ return;
}
fprintf(stderr,"discover: bound to %s\n",interface_name);
if(sendto(discovery_socket,buffer,len,0,(struct sockaddr*)&to_addr,sizeof(to_addr))<0) {
perror("discover: sendto socket failed for discovery_socket:");
- exit(-1);
+ return;
}
// wait for receive thread to complete
// the feedback signal is routed automatically/internally
// If feedback is to the second ADC, leave RX1 ANT settings untouched
//
- if (isTransmitting() && transmitter->puresignal && receiver[PS_RX_FEEDBACK]->adc == 0) i=receiver[PS_RX_FEEDBACK]->alex_antenna;
+ if (isTransmitting() && transmitter->puresignal) i=receiver[PS_RX_FEEDBACK]->alex_antenna;
#endif
switch(i) {
case 3: // Alex: RX2 IN, ANAN: EXT1, ANAN7000: still uses internal feedback
output_buffer[C1]|=receiver[0]->adc; // RX1 bound to ADC of first receiver
output_buffer[C1]|=(receiver[1]->adc<<2); // RX2 actually unsused with PURESIGNAL
output_buffer[C1]|=receiver[1]->adc<<4; // RX3 bound to ADC of second receiver
- output_buffer[C1]|=(receiver[PS_RX_FEEDBACK]->adc<<6); // RX4 is PS_RX_Feedbacka
- // Usually ADC0, but if feedback is to
- // RX2 input it must be ADC1 (see ps_menu.c)
- // RX5 is hard-wired to the TX DAC and needs no ADC setting.
+ // RX4 is PS_RX_Feedback and bound to ADC0
+ // RX5 is hard-wired to the TX DAC and needs no ADC setting.
}
#else
output_buffer[C1]|=receiver[0]->adc;
output_buffer[C1]=0x00;
if(isTransmitting()) {
-#ifdef PURESIGNAL
- // If we are using the RX2 jack for PURESIGNAL RX feedback, then we MUST NOT ground
- // the ADC2 input upon TX.
- if (transmitter->puresignal && receiver[PS_RX_FEEDBACK]->adc == 1) {
- // Note that this statement seems to have no effect since
- // one cannot goto to "manual filter setting" for the ALEX2 board individually
- output_buffer[C1]|=0x40; // Set ADC2 filter board to "ByPass"
- } else
-#endif
-
output_buffer[C1]|=0x80; // ground RX2 on transmit, bit0-6 are Alex2 filters
}
output_buffer[C2]=0x00;
if(string[0]!='#') {
name=strtok(string,"=");
value=strtok(NULL,"\n");
- property=malloc(sizeof(PROPERTY));
- property->name=malloc(strlen(name)+1);
- strcpy(property->name,name);
- property->value=malloc(strlen(value)+1);
- strcpy(property->value,value);
- property->next_property=properties;
- properties=property;
- if(strcmp(name,"property_version")==0) {
- version=atof(value);
- }
+ // Beware of "illegal" lines in corrupted files
+ if (name != NULL && value != NULL) {
+ property=malloc(sizeof(PROPERTY));
+ property->name=malloc(strlen(name)+1);
+ strcpy(property->name,name);
+ property->value=malloc(strlen(value)+1);
+ strcpy(property->value,value);
+ property->next_property=properties;
+ properties=property;
+ if(strcmp(name,"property_version")==0) {
+ version=atof(value);
+ }
+ }
}
}
fclose(f);