| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -79,15 +79,14 @@ void usage(void) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						#ifdef _WIN32 | 
					 | 
					 | 
					 | 
						#ifdef _WIN32 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						printf("rtl-sdr, an I/Q recorder for RTL2832 based USB-sticks\n\n" | 
					 | 
					 | 
					 | 
						printf("rtl-sdr, an I/Q recorder for RTL2832 based USB-sticks\n\n" | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							"Usage:\t rtl-sdr-win.exe [listen addr] [listen port] " | 
					 | 
					 | 
					 | 
							"Usage:\t rtl-sdr-win.exe [listen addr] [listen port] " | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							"[samplerate in kHz] [frequency in hz] [device index]\n"); | 
					 | 
					 | 
					 | 
							"[samplerate in kHz] [frequency in Hz] [device index]\n"); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						#else | 
					 | 
					 | 
					 | 
						#else | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						printf("rtl-sdr, an I/Q recorder for RTL2832 based USB-sticks\n\n" | 
					 | 
					 | 
					 | 
						printf("rtl-sdr, an I/Q recorder for RTL2832 based USB-sticks\n\n" | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							"Usage:\t -a listen address\n" | 
					 | 
					 | 
					 | 
							"Usage:\t -a listen address\n" | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							"\t[-p listen port (default: 1234)\n" | 
					 | 
					 | 
					 | 
							"\t[-p listen port (default: 1234)\n" | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							"\t -f frequency to tune to [Hz]\n" | 
					 | 
					 | 
					 | 
							"\t -f frequency to tune to [Hz]\n" | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							"\t[-s samplerate in kHz (default: 2048 kHz)]\n" | 
					 | 
					 | 
					 | 
							"\t[-s samplerate in Hz (default: 2048000 Hz)]\n" | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							"\t[-d device index (default: 0)]\n" | 
					 | 
					 | 
					 | 
							"\t[-d device index (default: 0)]\n"); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							"\toutput filename\n"); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						#endif | 
					 | 
					 | 
					 | 
						#endif | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						exit(1); | 
					 | 
					 | 
					 | 
						exit(1); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					} | 
					 | 
					 | 
					 | 
					} | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -281,6 +280,7 @@ static void *command_worker(void *arg) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            rtlsdr_set_center_freq(dev, cmd.param); | 
					 | 
					 | 
					 | 
					            rtlsdr_set_center_freq(dev, cmd.param); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            break; | 
					 | 
					 | 
					 | 
					            break; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							case 0x04: | 
					 | 
					 | 
					 | 
							case 0x04: | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            printf("set gain %d\n", cmd.param); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            rtlsdr_set_tuner_gain(dev, cmd.param); | 
					 | 
					 | 
					 | 
					            rtlsdr_set_tuner_gain(dev, cmd.param); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            break; | 
					 | 
					 | 
					 | 
					            break; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							default: | 
					 | 
					 | 
					 | 
							default: | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -315,11 +315,14 @@ int main(int argc, char **argv) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						struct sigaction sigact; | 
					 | 
					 | 
					 | 
						struct sigaction sigact; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						while ((opt = getopt(argc, argv, "a:p:f:s:d:")) != -1) { | 
					 | 
					 | 
					 | 
						while ((opt = getopt(argc, argv, "a:p:f:s:d:")) != -1) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							switch (opt) { | 
					 | 
					 | 
					 | 
							switch (opt) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							case 'd': | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
								dev_index = atoi(optarg); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
								break; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							case 'f': | 
					 | 
					 | 
					 | 
							case 'f': | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								frequency = atoi(optarg); | 
					 | 
					 | 
					 | 
								frequency = (uint32_t)atof(optarg); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								break; | 
					 | 
					 | 
					 | 
								break; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							case 's': | 
					 | 
					 | 
					 | 
							case 's': | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								samp_rate = atoi(optarg)*1000; | 
					 | 
					 | 
					 | 
								samp_rate = (uint32_t)atof(optarg); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								break; | 
					 | 
					 | 
					 | 
								break; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							case 'a': | 
					 | 
					 | 
					 | 
							case 'a': | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								addr = optarg; | 
					 | 
					 | 
					 | 
								addr = optarg; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -327,9 +330,6 @@ int main(int argc, char **argv) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							case 'p': | 
					 | 
					 | 
					 | 
							case 'p': | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								port = atoi(optarg); | 
					 | 
					 | 
					 | 
								port = atoi(optarg); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								break; | 
					 | 
					 | 
					 | 
								break; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							case 'd': | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								dev_index = atoi(optarg); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								break; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							default: | 
					 | 
					 | 
					 | 
							default: | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								usage(); | 
					 | 
					 | 
					 | 
								usage(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								break; | 
					 | 
					 | 
					 | 
								break; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -398,7 +398,6 @@ int main(int argc, char **argv) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						if (r < 0) | 
					 | 
					 | 
					 | 
						if (r < 0) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							fprintf(stderr, "WARNING: Failed to reset buffers.\n"); | 
					 | 
					 | 
					 | 
							fprintf(stderr, "WARNING: Failed to reset buffers.\n"); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						pthread_mutex_init(&exit_cond_lock, NULL); | 
					 | 
					 | 
					 | 
						pthread_mutex_init(&exit_cond_lock, NULL); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						pthread_mutex_init(&ll_mutex, NULL); | 
					 | 
					 | 
					 | 
						pthread_mutex_init(&ll_mutex, NULL); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						pthread_mutex_init(&exit_cond_lock, NULL); | 
					 | 
					 | 
					 | 
						pthread_mutex_init(&exit_cond_lock, NULL); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
  |