Working kernel driver.

This commit is contained in:
John Greb 2014-11-12 19:54:03 +00:00
parent 80a9d30fc3
commit 333976fa6d
4 changed files with 5 additions and 12 deletions

View File

@ -70,16 +70,6 @@ V4LInput::V4LInput(MessageQueue* msgQueueToGUI) :
{ {
} }
bool V4LThread::Init()
{
OpenSource("/dev/swradio0");
if (fd < 0) {
qCritical("could not open SDR");
return false;
}
return true;
}
V4LInput::~V4LInput() V4LInput::~V4LInput()
{ {
stopInput(); stopInput();

View File

@ -119,6 +119,7 @@ V4LThread::OpenSource(const char *filename)
xioctl(fd, VIDIOC_QBUF, &buf); xioctl(fd, VIDIOC_QBUF, &buf);
} }
set_sample_rate((double)SAMPLERATE);
// start streaming // start streaming
type = V4L2_BUF_TYPE_SDR_CAPTURE; type = V4L2_BUF_TYPE_SDR_CAPTURE;
xioctl(fd, VIDIOC_STREAMON, &type); xioctl(fd, VIDIOC_STREAMON, &type);

View File

@ -26,6 +26,7 @@ V4LThread::V4LThread(SampleFifo* sampleFifo, QObject* parent) :
m_convertBuffer(BLOCKSIZE), m_convertBuffer(BLOCKSIZE),
m_sampleFifo(sampleFifo) m_sampleFifo(sampleFifo)
{ {
start();
} }
V4LThread::~V4LThread() V4LThread::~V4LThread()
@ -35,12 +36,14 @@ V4LThread::~V4LThread()
void V4LThread::stopWork() void V4LThread::stopWork()
{ {
m_running = false; m_running = false;
wait();
} }
void V4LThread::run() void V4LThread::run()
{ {
m_running = true; m_running = true;
if (! Init() ) OpenSource("/dev/swradio0");
if (fd < 0)
return; return;
while(m_running) { while(m_running) {

View File

@ -34,7 +34,6 @@ public:
V4LThread(SampleFifo* sampleFifo, QObject* parent = NULL); V4LThread(SampleFifo* sampleFifo, QObject* parent = NULL);
~V4LThread(); ~V4LThread();
bool Init();
void stopWork(); void stopWork();
void OpenSource(const char *filename); void OpenSource(const char *filename);
void CloseSource(); void CloseSource();