airspy / airspyone_host

AirSpy's usemode driver and associated tools
http://airspy.com
247 stars 88 forks source link

airspy_close() blocks for ever if disconnect from USB unconditionally #64

Closed AlbrechtL closed 4 years ago

AlbrechtL commented 5 years ago

When the airspy mini is disconnected from USB unconditionally then the function airspy_stop_rx() reports AIRSPY_ERROR_LIBUSB(-1000) which is as expected. But the function airspy_close() blocks for ever.

I use both functions during the shutdown of my application. Because of airspy_close() the program is not quit correctly.

https://github.com/AlbrechtL/welle.io/blob/56504bcd40544e32987ceb3832715e3cc0f1c821/src/input/airspy_sdr.cpp#L84

CAirspy::~CAirspy(void)
{
    if (device) {
        int result = airspy_stop_rx(device);
        if (result != AIRSPY_SUCCESS) {
            std::clog  << "Airspy: airspy_stop_rx () failed:" << airspy_error_name((airspy_error)result) << "(" << result << ")" << std::endl;
        }

        result = airspy_close(device);
        if (result != AIRSPY_SUCCESS) {
            std::clog  << "Airspy: airspy_close () failed:" << airspy_error_name((airspy_error)result) << "(" << result << ")" << std::endl;
        }
    }

    airspy_exit();
}

What can I do to close the airspy driver correctly even if the airspy in disconnected?

bvernoux commented 5 years ago

1) Could you provide more details on how to reproduce it ?

2) Could you reproduce it with https://github.com/airspy/airspyone_host/blob/master/airspy-tools/src/airspy_rx.c