mirror of
https://github.com/rtlsdrblog/rtl-sdr-blog.git
synced 2025-03-26 21:45:29 +01:00
rtl_tcp: add parameter for changing number of buffers
This is useful for devices with low memory, e.g. routers with OpenWRT (decrease to 8 for example). Signed-off-by: Steve Markgraf <steve@steve-m.de>
This commit is contained in:
parent
d08c4770ab
commit
92d936568c
@ -85,6 +85,7 @@ void usage(void)
|
|||||||
"\t[-f frequency to tune to [Hz]]\n"
|
"\t[-f frequency to tune to [Hz]]\n"
|
||||||
"\t[-g gain (default: 0 for auto)]\n"
|
"\t[-g gain (default: 0 for auto)]\n"
|
||||||
"\t[-s samplerate in Hz (default: 2048000 Hz)]\n"
|
"\t[-s samplerate in Hz (default: 2048000 Hz)]\n"
|
||||||
|
"\t[-b number of buffers (default: 32, set by library)]\n"
|
||||||
"\t[-d device index (default: 0)]\n");
|
"\t[-d device index (default: 0)]\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@ -308,7 +309,7 @@ int main(int argc, char **argv)
|
|||||||
uint32_t frequency = 100000000, samp_rate = 2048000;
|
uint32_t frequency = 100000000, samp_rate = 2048000;
|
||||||
struct sockaddr_in local, remote;
|
struct sockaddr_in local, remote;
|
||||||
int device_count;
|
int device_count;
|
||||||
uint32_t dev_index = 0;
|
uint32_t dev_index = 0, buf_num = 0;
|
||||||
int gain = 0;
|
int gain = 0;
|
||||||
struct llist *curelem,*prev;
|
struct llist *curelem,*prev;
|
||||||
pthread_attr_t attr;
|
pthread_attr_t attr;
|
||||||
@ -326,7 +327,7 @@ int main(int argc, char **argv)
|
|||||||
struct sigaction sigact;
|
struct sigaction sigact;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
while ((opt = getopt(argc, argv, "a:p:f:g:s:d:")) != -1) {
|
while ((opt = getopt(argc, argv, "a:p:f:g:s:b:d:")) != -1) {
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
case 'd':
|
case 'd':
|
||||||
dev_index = atoi(optarg);
|
dev_index = atoi(optarg);
|
||||||
@ -346,6 +347,9 @@ int main(int argc, char **argv)
|
|||||||
case 'p':
|
case 'p':
|
||||||
port = atoi(optarg);
|
port = atoi(optarg);
|
||||||
break;
|
break;
|
||||||
|
case 'b':
|
||||||
|
buf_num = atoi(optarg);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
usage();
|
usage();
|
||||||
break;
|
break;
|
||||||
@ -474,7 +478,8 @@ int main(int argc, char **argv)
|
|||||||
r = pthread_create(&command_thread, &attr, command_worker, NULL);
|
r = pthread_create(&command_thread, &attr, command_worker, NULL);
|
||||||
pthread_attr_destroy(&attr);
|
pthread_attr_destroy(&attr);
|
||||||
|
|
||||||
rtlsdr_wait_async(dev, rtlsdr_callback, (void *)0);
|
r = rtlsdr_read_async(dev, rtlsdr_callback, (void *)0,
|
||||||
|
buf_num, 0);
|
||||||
|
|
||||||
closesocket(s);
|
closesocket(s);
|
||||||
if(!dead[0])
|
if(!dead[0])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user