diff options
-rw-r--r-- | libgphoto2_port/configure.ac | 3 | ||||
-rw-r--r-- | libgphoto2_port/usbscsi/linux.c | 12 |
2 files changed, 12 insertions, 3 deletions
diff --git a/libgphoto2_port/configure.ac b/libgphoto2_port/configure.ac index 0510cc188..69dea39ae 100644 --- a/libgphoto2_port/configure.ac +++ b/libgphoto2_port/configure.ac @@ -152,7 +152,8 @@ AC_C_CONST([]) AC_CHECK_HEADERS(stdlib.h unistd.h stdio.h fcntl.h errno.h sys/time.h \ sys/param.h sys/select.h termios.h sgetty.h ttold.h ioctl-types.h \ fcntl.h sgtty.h sys/ioctl.h sys/time.h termio.h unistd.h \ - endian.h byteswap.h asm/io.h mntent.h sys/mntent.h sys/mnttab.h) + endian.h byteswap.h asm/io.h mntent.h sys/mntent.h sys/mnttab.h \ + scsi/sg.h) dnl FIXME: Provide regex.h with the corresponding object code for dnl platforms which do not have it, e.g. Windows. diff --git a/libgphoto2_port/usbscsi/linux.c b/libgphoto2_port/usbscsi/linux.c index 6bf8df62c..ad9c0ee6a 100644 --- a/libgphoto2_port/usbscsi/linux.c +++ b/libgphoto2_port/usbscsi/linux.c @@ -27,8 +27,12 @@ #include <sys/stat.h> #include <sys/types.h> #include <sys/param.h> -#include <sys/ioctl.h> -#include <scsi/sg.h> +#ifdef HAVE_SYS_IOCTL_H +# include <sys/ioctl.h> +#endif +#ifdef HAVE_SCSI_SG_H +# include <scsi/sg.h> +#endif #ifdef HAVE_LOCKDEV # include <lockdev.h> #endif @@ -297,6 +301,7 @@ gp_port_usbscsi_close (GPPort *port) static int gp_port_usbscsi_send_scsi_cmd (GPPort *port, int to_dev, char *cmd, int cmd_size, char *sense, int sense_size, char *data, int data_size) { +#ifdef HAVE_SCSI_SG_H sg_io_hdr_t io_hdr; if (!port) @@ -328,6 +333,9 @@ static int gp_port_usbscsi_send_scsi_cmd (GPPort *port, int to_dev, char *cmd, } return GP_OK; +#else + return GP_ERROR_NOT_SUPPORTED; +#endif } static int |