File: 0001-Use-device-stop_requested-when-libusb-errors-out-76.patch

package info (click to toggle)
airspyone-host 1.0.10-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,200 kB
  • sloc: ansic: 6,550; sh: 31; xml: 20; makefile: 2
file content (53 lines) | stat: -rw-r--r-- 1,561 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
From 3f233282d2acddeaf4e93d496ee8a5ec4bed1b28 Mon Sep 17 00:00:00 2001
From: Johan Hedin <johan.o.hedin@gmail.com>
Date: Sun, 16 May 2021 18:32:09 +0200
Subject: [PATCH 01/29] Use device->stop_requested when libusb errors out (#76)

Replace device->streaming = false with device->stop_requested = true for
USB errors to avoid deadlock on device removal. Also check
stop_requested when checking if streaming or not to be consistent with
the old behaviour.
---
 libairspy/src/airspy.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libairspy/src/airspy.c b/libairspy/src/airspy.c
index 3ac3c55..afd096c 100644
--- a/libairspy/src/airspy.c
+++ b/libairspy/src/airspy.c
@@ -477,12 +477,12 @@ static void airspy_libusb_transfer_callback(struct libusb_transfer* usb_transfer
 
 		if (libusb_submit_transfer(usb_transfer) != 0)
 		{
-			device->streaming = false;
+			device->stop_requested = true;
 		}
 	}
 	else
 	{
-		device->streaming = false;
+		device->stop_requested = true;
 	}
 }
 
@@ -504,7 +504,7 @@ static void* transfer_threadproc(void* arg)
 		if (error < 0)
 		{
 			if (error != LIBUSB_ERROR_INTERRUPTED)
-				device->streaming = false;
+				device->stop_requested = true;
 		}
 	}
 
@@ -1872,7 +1872,7 @@ int airspy_list_devices(uint64_t *serials, int count)
 
 	int ADDCALL airspy_is_streaming(airspy_device_t* device)
 	{
-		return device->streaming == true;
+		return (device->streaming == true && device->stop_requested == false);
 	}
 
 	const char* ADDCALL airspy_error_name(enum airspy_error errcode)
-- 
2.47.3