Skip to content

Commit e6dcab0

Browse files
committed
Kill debug messages
1 parent 872fa9d commit e6dcab0

File tree

1 file changed

+21
-10
lines changed

1 file changed

+21
-10
lines changed

src/org/cgutman/usbip/service/UsbIpService.java

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ public class UsbIpService extends Service implements UsbRequestHandler {
5858
private WakeLock cpuWakeLock;
5959
private WifiLock wifiLock;
6060

61+
private static final boolean DEBUG = false;
62+
6163
private static final int NOTIFICATION_ID = 100;
6264

6365
private static final String ACTION_USB_PERMISSION =
@@ -343,14 +345,18 @@ public void run() {
343345
}
344346

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

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

352-
System.out.printf("Bulk transfer complete with %d bytes (wanted %d)\n",
353-
res, msg.transferBufferLength);
356+
if (DEBUG) {
357+
System.out.printf("Bulk transfer complete with %d bytes (wanted %d)\n",
358+
res, msg.transferBufferLength);
359+
}
354360

355361
if (res < 0) {
356362
reply.status = ProtoDefs.ST_NA;
@@ -362,9 +368,12 @@ public void run() {
362368
sendReply(s, reply, reply.status);
363369
}
364370
else if (selectedEndpoint.getType() == UsbConstants.USB_ENDPOINT_XFER_INT) {
365-
System.out.printf("Interrupt transfer - %d bytes %s on EP %d\n",
366-
msg.transferBufferLength, msg.direction == UsbIpDevicePacket.USBIP_DIR_IN ? "in" : "out",
367-
selectedEndpoint.getEndpointNumber());
371+
372+
if (DEBUG) {
373+
System.out.printf("Interrupt transfer - %d bytes %s on EP %d\n",
374+
msg.transferBufferLength, msg.direction == UsbIpDevicePacket.USBIP_DIR_IN ? "in" : "out",
375+
selectedEndpoint.getEndpointNumber());
376+
}
368377

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

408417
req.close();
409418

410-
System.out.printf("Interrupt transfer complete with %d bytes (wanted %d)\n",
411-
reply.actualLength, originalMsg.transferBufferLength);
419+
if (DEBUG) {
420+
System.out.printf("Interrupt transfer complete with %d bytes (wanted %d)\n",
421+
reply.actualLength, originalMsg.transferBufferLength);
422+
}
412423
if (reply.actualLength == 0) {
413424
// Request actually failed
414425
reply.status = ProtoDefs.ST_NA;

0 commit comments

Comments
 (0)