summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPali Rohár <pali.rohar@gmail.com>2016-12-16 15:39:46 +0100
committerPali Rohár <pali.rohar@gmail.com>2016-12-16 15:39:46 +0100
commit7522a9fbc72f14c5cb7fbaa54fb57526c5221d85 (patch)
tree6a58251e655580a3ba94357f57aed24dd17d9113
parent6ec64f4992ccd5e4ff42e9578d6c306a5b688a35 (diff)
download0xFFFF-7522a9fbc72f14c5cb7fbaa54fb57526c5221d85.tar.bz2
all: Fix compilation when u_int*_t are not defined and used by usb.h
-rw-r--r--src/cold-flash.c2
-rw-r--r--src/nolo.c2
-rw-r--r--src/usb-device.c14
-rw-r--r--src/usb-device.h7
4 files changed, 13 insertions, 12 deletions
diff --git a/src/cold-flash.c b/src/cold-flash.c
index fc2e86b..6338670 100644
--- a/src/cold-flash.c
+++ b/src/cold-flash.c
@@ -22,8 +22,6 @@
#include <string.h>
#include <errno.h>
-#include <usb.h>
-
#include "global.h"
#include "cold-flash.h"
#include "image.h"
diff --git a/src/nolo.c b/src/nolo.c
index 1dd9d61..9faea56 100644
--- a/src/nolo.c
+++ b/src/nolo.c
@@ -22,8 +22,6 @@
#include <stdlib.h>
#include <arpa/inet.h>
-#include <usb.h>
-
#include "nolo.h"
#include "image.h"
#include "global.h"
diff --git a/src/usb-device.c b/src/usb-device.c
index 391574a..24ce4be 100644
--- a/src/usb-device.c
+++ b/src/usb-device.c
@@ -31,14 +31,6 @@
#include <signal.h>
#include <dlfcn.h>
-#include <usb.h>
-
-#ifdef __linux__
-#ifdef LIBUSB_HAS_DETACH_KERNEL_DRIVER_NP
-#include <sys/ioctl.h>
-#endif
-#endif
-
#include "global.h"
#include "device.h"
#include "usb-device.h"
@@ -47,6 +39,12 @@
#include "cold-flash.h"
#include "mkii.h"
+#ifdef __linux__
+#ifdef LIBUSB_HAS_DETACH_KERNEL_DRIVER_NP
+#include <sys/ioctl.h>
+#endif
+#endif
+
static struct usb_flash_device usb_devices[] = {
{ 0x0421, 0x0096, -1, -1, -1, FLASH_DISK, { DEVICE_RX_44, 0 } },
{ 0x0421, 0x0105, 2, 1, -1, FLASH_NOLO, { DEVICE_SU_18, DEVICE_RX_44, DEVICE_RX_48, DEVICE_RX_51, DEVICE_RM_680, 0 } },
diff --git a/src/usb-device.h b/src/usb-device.h
index 101fbcd..082bf73 100644
--- a/src/usb-device.h
+++ b/src/usb-device.h
@@ -20,6 +20,13 @@
#ifndef USB_DEVICE_H
#define USB_DEVICE_H
+#include <stdint.h>
+
+/* u_int*_t types are not defined without _GNU_SOURCE but usb.h needs them */
+#define u_int8_t uint8_t
+#define u_int16_t uint16_t
+#define u_int32_t uint32_t
+
#include <usb.h>
#define USB_READ_EP (USB_ENDPOINT_IN | 0x1)