aboutsummaryrefslogtreecommitdiff
path: root/libmpio/src/io.c
diff options
context:
space:
mode:
authorgermeier <germeier>2003-10-19 21:44:16 +0000
committergermeier <germeier>2003-10-19 21:44:16 +0000
commiteb859c48e6ce237ea0a84cbc9ba2588c8c936847 (patch)
treefb6428ecbc52ed6b0dd4f213df02954edb8febfc /libmpio/src/io.c
parent2ce485fa24fb3ccba872e6dbd256c0485e1e7ed8 (diff)
downloadmpiosh-eb859c48e6ce237ea0a84cbc9ba2588c8c936847.tar.gz
mpiosh-eb859c48e6ce237ea0a84cbc9ba2588c8c936847.tar.bz2
mpiosh-eb859c48e6ce237ea0a84cbc9ba2588c8c936847.zip
added some missing #ifdef HAVE_USB
Diffstat (limited to 'libmpio/src/io.c')
-rw-r--r--libmpio/src/io.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/libmpio/src/io.c b/libmpio/src/io.c
index 5ec0957..7f29032 100644
--- a/libmpio/src/io.c
+++ b/libmpio/src/io.c
@@ -1,5 +1,5 @@
/*
- * $Id: io.c,v 1.7 2003/10/19 21:06:35 germeier Exp $
+ * $Id: io.c,v 1.8 2003/10/19 21:44:16 germeier Exp $
*
* libmpio - a library for accessing Digit@lways MPIO players
* Copyright (C) 2002, 2003 Markus Germeier
@@ -509,9 +509,9 @@ mpio_device_open(mpio_t *m){
struct usb_interface_descriptor *interface;
struct usb_endpoint_descriptor *ep;
int ret, i;
+ m->use_libusb=0;
#endif
- m->use_libusb=0;
m->fd = open(MPIO_DEVICE, O_RDWR);
if (m->fd > 0) {
debug ("using kernel module\n");
@@ -589,9 +589,16 @@ mpio_device_open(mpio_t *m){
int
mpio_device_close(mpio_t *m) {
+#ifdef HAVE_USB
+ if(m->use_libusb) {
+#endif
+ close(m->fd);
+ m->fd=0;
+#ifdef HAVE_USB
+ }
usb_close(m->usb_handle);
-
- m->use_libusb = 0;
+ m->use_libusb = 0;
+#endif
return MPIO_OK;
}
@@ -686,11 +693,15 @@ mpio_io_bulk_write(int fd, BYTE *block, int num_bytes)
int
mpio_io_write(mpio_t *m, BYTE *block, int num_bytes)
{
+#ifdef HAVE_USB
if (m->use_libusb) {
return usb_bulk_write(m->usb_handle, m->usb_out_ep, block, num_bytes, MPIO_USB_TIMEOUT);
- } else {
+ } else {
+#endif
return mpio_io_bulk_write(m->fd, block, num_bytes);
+#ifdef HAVE_USB
}
+#endif
}
@@ -732,11 +743,15 @@ mpio_io_bulk_read (int fd, BYTE *block, int num_bytes)
int
mpio_io_read (mpio_t *m, BYTE *block, int num_bytes)
{
+#ifdef HAVE_USB
if (m->use_libusb) {
return usb_bulk_read(m->usb_handle, m->usb_in_ep, block, num_bytes, MPIO_USB_TIMEOUT);
} else {
+#endif
return mpio_io_bulk_read(m->fd, block, num_bytes);
+#ifdef HAVE_USB
}
+#endif
}
/*