Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Suppress UsbRequestJNI / ALOGD log messages

I'm developing an Android app which is streaming serial data from some custom hardware. I'm using mik3y's usb-serial-for-android library to get the serial data over USB in OTG mode, which after some tweaks is working fine.

However, for every transaction over the USB interface, UsbRequestJNI is logging an init and close message. This is swamping LogCat with thousands of log messages per second (note the timestamps):

02-17 09:30:21.590    2332-2349/com.dummydomain.app D/UsbRequestJNI﹕ close
02-17 09:30:21.590    2332-2349/com.dummydomain.app D/UsbRequestJNI﹕ init
02-17 09:30:21.594    2332-2349/com.dummydomain.app D/UsbRequestJNI﹕ close
02-17 09:30:21.594    2332-2349/com.dummydomain.app D/UsbRequestJNI﹕ init
02-17 09:30:21.598    2332-2349/com.dummydomain.app D/UsbRequestJNI﹕ close
02-17 09:30:21.598    2332-2349/com.dummydomain.app D/UsbRequestJNI﹕ init
02-17 09:30:21.602    2332-2349/com.dummydomain.app D/UsbRequestJNI﹕ close
02-17 09:30:21.602    2332-2349/com.dummydomain.app D/UsbRequestJNI﹕ init
02-17 09:30:21.606    2332-2349/com.dummydomain.app D/UsbRequestJNI﹕ close
02-17 09:30:21.606    2332-2349/com.dummydomain.app D/UsbRequestJNI﹕ init
02-17 09:30:21.610    2332-2349/com.dummydomain.app D/UsbRequestJNI﹕ close
02-17 09:30:21.610    2332-2349/com.dummydomain.app D/UsbRequestJNI﹕ init
02-17 09:30:21.614    2332-2349/com.dummydomain.app D/UsbRequestJNI﹕ close
02-17 09:30:21.614    2332-2349/com.dummydomain.app D/UsbRequestJNI﹕ init

I know I can filter these in the IDE, but I want to stop them so they're not chewing through debugger bandwidth.

From what I can gather, UsbRequestJNI is an operating-system-provided JNI library, so I can't just edit the source. So how can I tell it to stop logging these debug messages while still running a debug build so I can see other relevant debug info?

Googling around has produced only this, which is basically the same problem but with no resolution that's applicable here.

(My development device is running Android 4.3 and I'm developing on Android Studio 1.0.1)

UPDATE: Just found the source for UsbRequest, the relevant lines being ALOGD statments (lines 45 and 71). So I guess the question becomes: how do I suppress ALOGD messages?

UPDATE 2: I've tried setprop log.tag.UsbRequestJNI SUPPRESS as per this answer, but frustratingly it has no effect on my device.

like image 878
davidf2281 Avatar asked Oct 19 '22 17:10

davidf2281


1 Answers

For posterity these messages seem to come from UsbRequest initialize() and close() methods so by reusing UsbRequest objects instead of creating new object mostly solves this issue and probably also marginally improve performance.

like image 81
nyholku Avatar answered Oct 22 '22 07:10

nyholku