1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-25 00:51:21 +00:00
freebsd-ports/astro/fowsr/files/patch-fowsr-c
2010-09-01 10:35:12 +00:00

44 lines
1.3 KiB
Plaintext

--- 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) {