Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
yids
kukuruku-fork
Commits
8805b304
Commit
8805b304
authored
Jul 17, 2016
by
Jenda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allow pipe scanner output
parent
2e715051
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
17 deletions
+24
-17
client/libclient.py
client/libclient.py
+1
-1
scanner/KukurukuScanner.py
scanner/KukurukuScanner.py
+14
-4
scanner/confdir/fm.conf
scanner/confdir/fm.conf
+2
-2
scanner/util.py
scanner/util.py
+6
-9
scanner/xlater.c
scanner/xlater.c
+1
-1
No files found.
client/libclient.py
View file @
8805b304
...
...
@@ -300,7 +300,7 @@ class client():
def
spawn_mode
(
self
,
cmd
):
""" Spawn a process cmd, spawn feeder_thr for it, return reference to queue and thread. """
process
=
subprocess
.
Popen
([
cmd
],
stdin
=
subprocess
.
PIPE
,
shell
=
True
)
process
=
subprocess
.
Popen
([
cmd
],
stdin
=
subprocess
.
PIPE
,
shell
=
True
,
bufsize
=-
1
)
que
=
Queue
.
Queue
()
t
=
threading
.
Thread
(
target
=
self
.
feeder_thr
,
args
=
(
que
,
process
),
name
=
"feeder_thr for %s"
%
cmd
)
t
.
daemon
=
True
...
...
scanner/KukurukuScanner.py
View file @
8805b304
...
...
@@ -11,13 +11,14 @@ import math
import
numpy
as
np
import
xlater
import
struct
import
subprocess
from
datetime
import
datetime
from
libutil
import
Struct
,
safe_cast
from
gnuradio.filter
import
firdes
def
channelhelper
():
ChannelHelperT
=
Struct
(
"channelhelper"
,
"rotator decim rate file taps carry rotpos firpos cylen"
)
ChannelHelperT
=
Struct
(
"channelhelper"
,
"rotator decim rate file taps carry rotpos firpos cylen
fd_r
"
)
return
ChannelHelperT
()
COMPLEX64
=
8
...
...
@@ -75,7 +76,7 @@ class scanner():
self
.
sdrflush
()
peaks
=
[]
for
channel
in
cronframe
.
channels
:
peaks
.
append
((
channel
.
freq
-
cronframe
.
freq
,
channel
.
bw
))
peaks
.
append
((
channel
.
freq
-
cronframe
.
freq
,
channel
.
bw
,
channel
))
self
.
do_record
(
peaks
,
cronframe
.
cronlen
,
cronframe
.
stickactivity
,
1
,
channel
.
freq
,
cronframe
.
floor
,
None
)
...
...
@@ -114,7 +115,6 @@ class scanner():
ch
.
decim
=
math
.
ceil
(
self
.
conf
.
rate
/
w
)
ch
.
rate
=
self
.
conf
.
rate
/
ch
.
decim
ch
.
file
=
os
.
open
(
self
.
getfn
(
f
+
center
,
ch
.
rate
)
+
".cfile"
,
os
.
O_WRONLY
|
os
.
O_CREAT
)
ch
.
rotator
=
-
float
(
f
)
/
self
.
conf
.
rate
*
2
*
math
.
pi
ch
.
rotpos
=
np
.
zeros
(
2
,
dtype
=
np
.
float32
)
ch
.
rotpos
[
0
]
=
1
# start with unit vector
...
...
@@ -123,7 +123,15 @@ class scanner():
ch
.
firpos
=
np
.
zeros
(
1
,
dtype
=
np
.
int32
)
ch
.
cylen
=
len
(
ch
.
taps
)
ch
.
carry
=
'
\0
'
*
ch
.
cylen
self
.
l
.
l
(
"Recording %s"
%
ch
.
file
,
"INFO"
)
if
len
(
peak
)
>=
2
and
peak
[
2
].
pipe
is
not
None
:
(
ch
.
fd_r
,
ch
.
file
)
=
os
.
pipe
()
subprocess
.
Popen
([
peak
[
2
].
pipe
],
shell
=
True
,
stdin
=
ch
.
fd_r
,
bufsize
=-
1
)
self
.
l
.
l
(
"Recording %i (PIPE)"
%
f
,
"INFO"
)
else
:
ch
.
file
=
os
.
open
(
self
.
getfn
(
f
+
center
,
ch
.
rate
)
+
".cfile"
,
os
.
O_WRONLY
|
os
.
O_CREAT
)
self
.
l
.
l
(
"Recording %s"
%
ch
.
file
,
"INFO"
)
helpers
.
append
(
ch
)
while
True
:
...
...
@@ -154,6 +162,8 @@ class scanner():
for
ch
in
helpers
:
os
.
close
(
ch
.
file
)
if
ch
.
fd_r
:
os
.
close
(
ch
.
fd_r
)
def
check_activity
(
self
,
acc
,
peak
,
q
):
floor
=
sorted
(
acc
)[
int
(
q
*
self
.
conf
.
fftw
)]
...
...
scanner/confdir/fm.conf
View file @
8805b304
...
...
@@ -2,9 +2,9 @@
freq
=
100000
floor
=
0
.
2
sql
=
0
.
3
cron
=
58
2
1
* * *
cron
=
*
2
2
* * *
cronlen
=
60
randscan
=
yes
randscan
=
no
stickactivity
=
True
[
Channel1
]
...
...
scanner/util.py
View file @
8805b304
...
...
@@ -80,11 +80,6 @@ class ConfReader():
except
:
stick
=
self
.
stick
try
:
pipe
=
rc
.
get
(
MAINSECTION
,
'pipe'
)
except
:
pipe
=
None
if
"freqstart"
in
rc
.
options
(
MAINSECTION
):
# range randscan
freqstart
=
rc
.
getint
(
MAINSECTION
,
"freqstart"
)
*
1000
+
step
/
2
freqstop
=
rc
.
getint
(
MAINSECTION
,
"freqstop"
)
*
1000
-
step
/
2
...
...
@@ -97,7 +92,6 @@ class ConfReader():
frm
.
floor
=
floor
frm
.
stickactivity
=
stickactivity
frm
.
stick
=
stick
frm
.
pipe
=
pipe
frm
.
sql
=
sql
frm
.
gain
=
self
.
gain
...
...
@@ -109,10 +103,9 @@ class ConfReader():
frm
=
cronframe
()
frm
.
freq
=
rc
.
getint
(
MAINSECTION
,
"freq"
)
*
1000
frm
.
floor
=
"
floor
"
frm
.
floor
=
self
.
floor
frm
.
stickactivity
=
stickactivity
frm
.
stick
=
stick
frm
.
pipe
=
pipe
frm
.
sql
=
sql
frm
.
gain
=
self
.
gain
frm
.
cron
=
rc
.
get
(
MAINSECTION
,
"cron"
)
...
...
@@ -133,7 +126,6 @@ class ConfReader():
frm
.
floor
=
floor
frm
.
stickactivity
=
stickactivity
frm
.
stick
=
stick
frm
.
pipe
=
pipe
frm
.
sql
=
sql
frm
.
gain
=
self
.
gain
...
...
@@ -159,6 +151,11 @@ class ConfReader():
except
:
ch
.
cont
=
0
try
:
ch
.
pipe
=
rc
.
get
(
ssect
,
'pipe'
)
except
:
ch
.
pipe
=
None
channels
.
append
(
ch
)
return
channels
...
...
scanner/xlater.c
View file @
8805b304
...
...
@@ -35,7 +35,7 @@ int xdump(char * _buf, size_t buflen, char * _carry, size_t carrylen, char * _ta
int32_t
i
;
int
outsample
=
0
;
FILE
*
of
=
fdopen
(
fd
,
"
a
"
);
FILE
*
of
=
fdopen
(
fd
,
"
w
"
);
if
(
of
==
NULL
)
{
perror
(
"fdopen"
);
fprintf
(
stderr
,
"Cannot open fd %i for writing
\n
"
,
fd
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment