aboutsummaryrefslogtreecommitdiff
path: root/astro/fowsr/files/patch-fowsr-c
blob: d7eb95d15757c138ac06632ed16a3372638279cb (plain) (blame)
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
--- fowsr.c.orig	2010-07-18 18:06:30.000000000 +0200
+++ fowsr.c	2010-09-01 10:59:58.004518772 +0200
@@ -110,13 +110,17 @@
 
 	signal(SIGTERM, release_usb_device);
 
+#ifdef LIBUSB_HAS_GET_DRIVER_NP
 	ret = usb_get_driver_np(devh, 0, buf, sizeof(buf));
 	printf("usb_get_driver_np returned %d\n", ret);
 	if (ret == 0) {
 		printf("interface 0 already claimed by driver \\'%s\\', attempting to detach it\n", buf);
+#ifdef LIBUSB_HAS_DETACH_KERNEL_DRIVER_NP
 		ret = usb_detach_kernel_driver_np(devh, 0);
 		printf("usb_detach_kernel_driver_np returned %d\n", ret);
+#endif
 	}
+#endif
 	ret = usb_claim_interface(devh, 0);
 	if (ret != 0) {
 		printf("claim failed with error %d\n", ret);
@@ -159,12 +163,14 @@
 	FILE* f;
 	if (isStoring == ISREADING) {
 		if (f=fopen(fname,"rb")) {
+			printf("using cache file %s\n", fname);
 			n=fread(&m_previous_timestamp,sizeof(m_previous_timestamp),1,f);
 			n=fread(m_buf,sizeof(m_buf[0]),WS_BUFFER_SIZE,f);
 		}
 		print_bytes((char *)&m_previous_timestamp, sizeof(time_t));
 	} else {	// ISWRITING
 		if (f=fopen(fname,"wb")) {
+			printf("updating cache file %s\n", fname);
 			n=fwrite(&m_timestamp,sizeof(m_timestamp),1,f);
 			n=fwrite(m_buf,sizeof(m_buf[0]),WS_BUFFER_SIZE,f);
 		}
@@ -566,6 +572,7 @@
 
 	FILE* f;
 	if (f=fopen(fname,"a+s")) {
+		printf("writing to %s\n", fname);
 
 		// Header
 		switch (arg) {