Skip to content

Commit

Permalink
Kill debug messages
Browse files Browse the repository at this point in the history
  • Loading branch information
cgutman committed Jul 27, 2014
1 parent 872fa9d commit e6dcab0
Showing 1 changed file with 21 additions and 10 deletions.
31 changes: 21 additions & 10 deletions src/org/cgutman/usbip/service/UsbIpService.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ public class UsbIpService extends Service implements UsbRequestHandler {
private WakeLock cpuWakeLock;
private WifiLock wifiLock;

private static final boolean DEBUG = false;

private static final int NOTIFICATION_ID = 100;

private static final String ACTION_USB_PERMISSION =
Expand Down Expand Up @@ -343,14 +345,18 @@ public void run() {
}

if (selectedEndpoint.getType() == UsbConstants.USB_ENDPOINT_XFER_BULK) {
System.out.printf("Bulk transfer - %d bytes %s on EP %d\n",
buff.array().length, msg.direction == UsbIpDevicePacket.USBIP_DIR_IN ? "in" : "out",
selectedEndpoint.getEndpointNumber());
if (DEBUG) {
System.out.printf("Bulk transfer - %d bytes %s on EP %d\n",
buff.array().length, msg.direction == UsbIpDevicePacket.USBIP_DIR_IN ? "in" : "out",
selectedEndpoint.getEndpointNumber());
}

int res = XferUtils.doBulkTransfer(context.devConn,selectedEndpoint, buff.array(), msg.interval);

System.out.printf("Bulk transfer complete with %d bytes (wanted %d)\n",
res, msg.transferBufferLength);
if (DEBUG) {
System.out.printf("Bulk transfer complete with %d bytes (wanted %d)\n",
res, msg.transferBufferLength);
}

if (res < 0) {
reply.status = ProtoDefs.ST_NA;
Expand All @@ -362,9 +368,12 @@ public void run() {
sendReply(s, reply, reply.status);
}
else if (selectedEndpoint.getType() == UsbConstants.USB_ENDPOINT_XFER_INT) {
System.out.printf("Interrupt transfer - %d bytes %s on EP %d\n",
msg.transferBufferLength, msg.direction == UsbIpDevicePacket.USBIP_DIR_IN ? "in" : "out",
selectedEndpoint.getEndpointNumber());

if (DEBUG) {
System.out.printf("Interrupt transfer - %d bytes %s on EP %d\n",
msg.transferBufferLength, msg.direction == UsbIpDevicePacket.USBIP_DIR_IN ? "in" : "out",
selectedEndpoint.getEndpointNumber());
}

UsbRequest req = new UsbRequest();
req.initialize(context.devConn, selectedEndpoint);
Expand Down Expand Up @@ -407,8 +416,10 @@ else if (selectedEndpoint.getType() == UsbConstants.USB_ENDPOINT_XFER_INT) {

req.close();

System.out.printf("Interrupt transfer complete with %d bytes (wanted %d)\n",
reply.actualLength, originalMsg.transferBufferLength);
if (DEBUG) {
System.out.printf("Interrupt transfer complete with %d bytes (wanted %d)\n",
reply.actualLength, originalMsg.transferBufferLength);
}
if (reply.actualLength == 0) {
// Request actually failed
reply.status = ProtoDefs.ST_NA;
Expand Down

0 comments on commit e6dcab0

Please sign in to comment.