X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fsurfaces%2Ftranzport%2Fio_usb.cc;h=c9c595ee0d21a4cfed0bf1e961b07a1093919d61;hb=384c97e12db22c102cc4723aa7bcda13f3ec8d0d;hp=c4a004a160066735570d1e5dc37c8e4f4dc2a774;hpb=99904735e066804358f1d0bd138a84f1e9ecda91;p=ardour.git diff --git a/libs/surfaces/tranzport/io_usb.cc b/libs/surfaces/tranzport/io_usb.cc index c4a004a160..c9c595ee0d 100644 --- a/libs/surfaces/tranzport/io_usb.cc +++ b/libs/surfaces/tranzport/io_usb.cc @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006 Paul Davis + * Copyright (C) 2006 Paul Davis * Copyright (C) 2007 Michael Taht * * This program is free software; you can redistribute it and/or modify @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * + * * */ #include @@ -36,11 +36,11 @@ using namespace std; using namespace sigc; using namespace PBD; -#include "i18n.h" +#include "pbd/i18n.h" #include -// I note that these usb specific open, close, probe, read routines are basically +// I note that these usb specific open, close, probe, read routines are basically // pure boilerplate and could easily be abstracted elsewhere bool @@ -57,7 +57,7 @@ TranzportControlProtocol::probe () for(dev = bus->devices; dev; dev = dev->next) { if (dev->descriptor.idVendor == VENDORID && dev->descriptor.idProduct == PRODUCTID) { - return true; + return true; } } } @@ -97,7 +97,7 @@ TranzportControlProtocol::open_core (struct usb_device* dev) cerr << _("Tranzport: cannot open USB transport") << endmsg; return -1; } - + if (usb_claim_interface (udev, 0) < 0) { cerr << _("Tranzport: cannot claim USB interface") << endmsg; usb_close (udev); @@ -135,20 +135,20 @@ TranzportControlProtocol::close () return ret; } -int TranzportControlProtocol::read(uint8_t *buf, uint32_t timeout_override) +int TranzportControlProtocol::read(uint8_t *buf, uint32_t timeout_override) { last_read_error = usb_interrupt_read (udev, READ_ENDPOINT, (char *) buf, 8, timeout_override); switch(last_read_error) { case -ENOENT: case -ENXIO: case -ECONNRESET: - case -ESHUTDOWN: - case -ENODEV: + case -ESHUTDOWN: + case -ENODEV: cerr << "Tranzport disconnected, errno: " << last_read_error; set_active(false); case -ETIMEDOUT: // This is normal break; - default: + default: #if DEBUG_TRANZPORT cerr << "Got an unknown error on read:" << last_read_error "\n"; #endif @@ -156,9 +156,9 @@ int TranzportControlProtocol::read(uint8_t *buf, uint32_t timeout_override) } return last_read_error; -} +} + - int TranzportControlProtocol::write_noretry (uint8_t* cmd, uint32_t timeout_override) { @@ -175,13 +175,13 @@ TranzportControlProtocol::write_noretry (uint8_t* cmd, uint32_t timeout_override case -ENOENT: case -ENXIO: case -ECONNRESET: - case -ESHUTDOWN: - case -ENODEV: + case -ESHUTDOWN: + case -ENODEV: cerr << "Tranzport disconnected, errno: " << last_write_error; set_active(false); case -ETIMEDOUT: // This is normal break; - default: + default: #if DEBUG_TRANZPORT cerr << "Got an unknown error on read:" << last_write_error "\n"; #endif @@ -195,7 +195,7 @@ TranzportControlProtocol::write_noretry (uint8_t* cmd, uint32_t timeout_override return 0; -} +} int TranzportControlProtocol::write (uint8_t* cmd, uint32_t timeout_override) @@ -204,7 +204,7 @@ TranzportControlProtocol::write (uint8_t* cmd, uint32_t timeout_override) int val; int retry = 0; if(inflight > MAX_TRANZPORT_INFLIGHT) { return (-1); } - + while((val = usb_interrupt_write (udev, WRITE_ENDPOINT, (char*) cmd, 8, timeout_override ? timeout_override : timeout))!=8 && retry++ < MAX_RETRY) { printf("usb_interrupt_write failed, retrying: %d\n", val); } @@ -227,6 +227,6 @@ TranzportControlProtocol::write (uint8_t* cmd, uint32_t timeout_override) return (write_noretry(cmd,timeout_override)); #endif -} +} #endif