Constant INIT when using Interface Kit software.

Supporting 4.1 and up
MarqTwine
Phidgetly
Posts: 17
Joined: Mon Dec 27, 2010 11:45 pm
Contact:

Constant INIT when using Interface Kit software.

Postby MarqTwine » Fri May 25, 2012 12:48 pm

Is it normal for LogCat to show INIT being constantly performed when running the Interface Kit program? I get good inputs and outputs but INIT is constantly executed while the program is active.

I have created my own program based on the Interface Kit software which controls two Interface Kits, and it works reasonably well so far. I have a problem, however, with the outputs blinking as the program is running. I am wondering if it is because the USB service is constantly initializing itself.

I also wonder if the constant initializing causes Eclipse to crash when it happens too many times in a row.

At the very least, this reinitializing slows the program down significantly. How can it be corrected?

I am using the Toshiba Thrive with Android 3.2.1 on Eclipse Indigo.

(I don't plan to update the OS any time soon because of the trouble I had trying to gain root access after my last update. Root access is absolutely necessary when writing USB host programs. I presume Google does not want people to write USB based Android apps because they do not allow root access. :roll: )

Thank you for your help and suggestions.

User avatar
Patrick
Lead Developer
Posts: 3064
Joined: Mon Jun 20, 2005 8:46 am
Location: Canada
Contact:

Re: Constant INIT when using Interface Kit software.

Postby Patrick » Fri May 25, 2012 2:00 pm

You don't need root to write USB host programs - this is supported by the official API v12+.

As for constant initializations, can you post the logs of this? I'm not exactly sure what you mean? The USB subsystem is only initialized once - when you call com.phidgets.usb.Manager.Initialize(this);.

-Patrick

MarqTwine
Phidgetly
Posts: 17
Joined: Mon Dec 27, 2010 11:45 pm
Contact:

Re: Constant INIT when using Interface Kit software.

Postby MarqTwine » Fri May 25, 2012 3:04 pm

I apologize if this is too much info. It is originally over 100 pages.

Thank you for your help.


05-26 15:49:12.320: I/System.out(906): waiting for debugger to settle...
05-26 15:49:12.520: I/System.out(906): debugger has settled (1330)
05-26 15:49:12.850: D/1(906): onCreate
05-26 15:49:12.860: D/dalvikvm(906): Trying to load lib /data/data/com.phidgets.InterfaceKitUSB/lib/libphidget21.so 0x4077c8b8
05-26 15:49:12.870: D/dalvikvm(906): Added shared lib /data/data/com.phidgets.InterfaceKitUSB/lib/libphidget21.so 0x4077c8b8
05-26 15:49:12.870: D/dalvikvm(906): Trying to load lib /data/data/com.phidgets.InterfaceKitUSB/lib/libphidget21.so 0x4077c8b8
...
05-26 15:49:12.870: D/dalvikvm(906): Shared lib '/data/data/com.phidgets.InterfaceKitUSB/lib/libphidget21.so' already loaded in same CL 0x4077c8b8
05-26 15:49:12.870: I/dalvikvm(906): threadid=1: recursive native library load attempt (/data/data/com.phidgets.InterfaceKitUSB/lib/libphidget21.so)
05-26 15:49:12.900: D/dalvikvm(906): Trying to load lib /data/data/com.phidgets.InterfaceKitUSB/lib/libphidget21.so 0x4077c8b8
05-26 15:49:12.900: D/dalvikvm(906): Shared lib '/data/data/com.phidgets.InterfaceKitUSB/lib/libphidget21.so' already loaded in same CL 0x4077c8b8
05-26 15:49:12.900: I/dalvikvm(906): threadid=1: recursive native library load attempt (/data/data/com.phidgets.InterfaceKitUSB/lib/libphidget21.so)
05-26 15:49:12.910: W/System.err(906): PhidgetException 5 (Phidget not physically attached.)
05-26 15:49:12.910: W/System.err(906): at com.phidgets.Phidget.getSerialNumber(Native Method)
05-26 15:49:12.910: W/System.err(906): at com.phidgets.InterfaceKitUSB.InterfaceKitUSBExampleActivity.onCreate(InterfaceKitUSBExampleActivity.java:130)
05-26 15:49:12.910: W/System.err(906): at android.app.Activity.performCreate(Activity.java:4397)
05-26 15:49:12.910: W/System.err(906): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1048)
05-26 15:49:12.910: W/System.err(906): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1779)
05-26 15:49:12.920: W/System.err(906): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1831)
05-26 15:49:12.920: W/System.err(906): at android.app.ActivityThread.access$500(ActivityThread.java:122)
05-26 15:49:12.920: W/System.err(906): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1024)
05-26 15:49:12.920: W/System.err(906): at android.os.Handler.dispatchMessage(Handler.java:99)
05-26 15:49:12.920: W/System.err(906): at android.os.Looper.loop(Looper.java:132)
05-26 15:49:12.920: W/System.err(906): at android.app.ActivityThread.main(ActivityThread.java:4123)
05-26 15:49:12.920: W/System.err(906): at java.lang.reflect.Method.invokeNative(Native Method)
05-26 15:49:12.920: W/System.err(906): at java.lang.reflect.Method.invoke(Method.java:491)
05-26 15:49:12.920: W/System.err(906): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
05-26 15:49:12.920: W/System.err(906): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
05-26 15:49:12.930: W/System.err(906): at dalvik.system.NativeStart.main(Native Method)
05-26 15:49:12.930: D/1(906): no SN
05-26 15:49:12.960: D/UsbDeviceConnectionJNI(906): close
05-26 15:49:12.960: I/ActivityManager(139): Starting: Intent { flg=0x10000000 cmp=com.android.systemui/.usb.UsbPermissionActivity (has extras) } from pid 139
05-26 15:49:12.970: D/PowerManagerService(139): acquireWakeLock flags=0x1 tag=ActivityManager-Launch
05-26 15:49:12.990: D/UsbRequestJNI(906): init
05-26 15:49:12.990: D/2(906): Try 4
05-26 15:49:13.100: D/2(906): handler.wait
05-26 15:49:13.140: W/InputManagerService(139): Starting input on non-focused client com.android.internal.view.IInputMethodClient$Stub$Proxy@408ddb88 (uid=10042 pid=240)
05-26 15:49:13.140: D/PowerManagerService(139): releaseWakeLock flags=0x1 tag=ActivityManager-Launch
05-26 15:49:13.180: D/UsbRequestJNI(906): init
05-26 15:49:13.190: D/UsbRequestJNI(906): init
...
05-26 15:49:13.280: D/UsbRequestJNI(906): init
05-26 15:49:13.290: I/ActivityManager(139): Displayed com.phidgets.InterfaceKitUSB/.InterfaceKitUSBExampleActivity: +3s439ms
05-26 15:49:13.290: D/UsbRequestJNI(906): init
05-26 15:49:13.300: D/UsbRequestJNI(906): init
...
05-26 15:49:13.370: D/UsbRequestJNI(906): init
05-26 15:49:13.380: I/ActivityManager(139): Displayed com.android.systemui/.usb.UsbPermissionActivity: +310ms
05-26 15:49:13.380: D/UsbRequestJNI(906): init
05-26 15:49:13.390: D/UsbRequestJNI(906): init
05-26 15:49:13.390: D/UsbRequestJNI(906): init
05-26 15:49:13.400: D/UsbRequestJNI(906): init
05-26 15:49:13.400: D/PhoneWindow(240): couldn't save which view has focus because the focused view android.widget.TextView@40776560 has no id.
05-26 15:49:13.410: D/UsbRequestJNI(906): init
05-26 15:49:13.420: D/UsbRequestJNI(906): init
...
05-26 15:49:13.580: D/UsbRequestJNI(906): init
05-26 15:49:13.590: D/UsbRequestJNI(906): init
05-26 15:49:13.590: D/dalvikvm(906): GC_CONCURRENT freed 156K, 5% free 6581K/6855K, paused 3ms+3ms
05-26 15:49:13.590: V/UsbRequest(906): endpoint still open in finalize(): android.hardware.usb.UsbRequest@407d3260
05-26 15:49:13.590: D/UsbRequestJNI(906): close
05-26 15:49:13.590: V/UsbRequest(906): endpoint still open in finalize(): android.hardware.usb.UsbRequest@407d3038
05-26 15:49:13.590: D/UsbRequestJNI(906): close
...
05-26 15:49:13.610: V/UsbRequest(906): endpoint still open in finalize(): android.hardware.usb.UsbRequest@407d3888
05-26 15:49:13.610: D/UsbRequestJNI(906): close
05-26 15:49:13.610: V/UsbRequest(906): endpoint still open in finalize(): android.hardware.usb.UsbRequest@407d34a8
05-26 15:49:13.610: D/UsbRequestJNI(906): close
05-26 15:49:13.620: D/UsbRequestJNI(906): init
05-26 15:49:13.630: D/UsbRequestJNI(906): init
05-26 15:49:13.630: D/UsbRequestJNI(906): init
...
05-26 15:49:17.230: D/UsbRequestJNI(906): init
05-26 15:49:17.240: D/UsbRequestJNI(906): init
05-26 15:49:17.250: D/dalvikvm(906): GC_CONCURRENT freed 199K, 5% free 6788K/7111K, paused 2ms+2ms
05-26 15:49:17.250: V/UsbRequest(906): endpoint still open in finalize(): android.hardware.usb.UsbRequest@40825d30
05-26 15:49:17.250: D/UsbRequestJNI(906): close
05-26 15:49:17.250: V/UsbRequest(906): endpoint still open in finalize(): android.hardware.usb.UsbRequest@40825a40
05-26 15:49:17.250: D/UsbRequestJNI(906): close

05-26 15:49:17.760: V/UsbRequest(906): endpoint still open in finalize(): android.hardware.usb.UsbRequest@4079ce70
05-26 15:49:17.760: D/UsbRequestJNI(906): close
05-26 15:49:17.760: V/UsbRequest(906): endpoint still open in finalize(): android.hardware.usb.UsbRequest@40826280
05-26 15:49:17.760: D/UsbRequestJNI(906): close
05-26 15:49:17.760: D/UsbRequestJNI(906): init
05-26 15:49:17.770: D/UsbRequestJNI(906): init
...
05-26 15:49:21.580: D/UsbRequestJNI(906): init
05-26 15:49:21.590: D/UsbRequestJNI(906): init
05-26 15:49:21.600: D/dalvikvm(906): GC_CONCURRENT freed 212K, 5% free 7030K/7367K, paused 2ms+2ms
05-26 15:49:21.600: V/UsbRequest(906): endpoint still open in finalize(): android.hardware.usb.UsbRequest@40866e90
05-26 15:49:21.600: D/UsbRequestJNI(906): close
05-26 15:49:21.600: D/UsbRequestJNI(906): init
05-26 15:49:21.600: V/UsbRequest(906): endpoint still open in finalize(): android.hardware.usb.UsbRequest@40866ba0
05-26 15:49:21.600: D/UsbRequestJNI(906): close
...
05-26 15:49:22.010: V/UsbRequest(906): endpoint still open in finalize(): android.hardware.usb.UsbRequest@40847098
05-26 15:49:22.010: D/UsbRequestJNI(906): close
05-26 15:49:22.010: V/UsbRequest(906): endpoint still open in finalize(): android.hardware.usb.UsbRequest@40867180
05-26 15:49:22.010: D/UsbRequestJNI(906): close
05-26 15:49:22.020: D/UsbRequestJNI(906): init
05-26 15:49:22.030: D/UsbRequestJNI(906): init
05-26 15:49:22.030: D/UsbRequestJNI(906): init
...
05-26 15:49:23.180: D/UsbRequestJNI(906): init
05-26 15:49:23.190: D/UsbRequestJNI(906): init
05-26 15:49:23.200: D/UsbRequestJNI(906): init
05-26 15:49:23.200: D/UsbRequestJNI(906): init

MarqTwine
Phidgetly
Posts: 17
Joined: Mon Dec 27, 2010 11:45 pm
Contact:

Re: Constant INIT when using Interface Kit software.

Postby MarqTwine » Fri May 25, 2012 3:13 pm

Perhaps I was wrong about needing root access to work with Phidgets. I had first tried another IO device that used terminal commands and that required root and it took me a month after updating to gain root again.

I shortly thereafter gave up on that company and have made steady progress with the Phidgets Interface Kit (except for this init issue).

I am developing a device for commercial sale with an established company so these are not just a hobbiest frustration issues.

Thanks again.

User avatar
Patrick
Lead Developer
Posts: 3064
Joined: Mon Jun 20, 2005 8:46 am
Location: Canada
Contact:

Re: Constant INIT when using Interface Kit software.

Postby Patrick » Fri May 25, 2012 3:22 pm

These messages must be a result of the library polling for new USB devices in the background. You may wish to disable JNI debug messages to cut down on the flood - but these shouldn't affect your app performance while not debugging.

-Patrick

MarqTwine
Phidgetly
Posts: 17
Joined: Mon Dec 27, 2010 11:45 pm
Contact:

Re: Constant INIT when using Interface Kit software.

Postby MarqTwine » Fri May 25, 2012 6:20 pm

Great! Thank you.

After a second look I noticed that the output does not blink when the IntFace Kit program is running, therefore there is something goophy with my program. (Imagine that!)

I will investigate more thoroughly and may repost if I can't cypher it out.

Thanks again.

MarqTwine
Phidgetly
Posts: 17
Joined: Mon Dec 27, 2010 11:45 pm
Contact:

Re: Constant INIT when using Interface Kit software.

Postby MarqTwine » Tue Jul 17, 2012 2:23 pm

I have come back to the init issue after working on other parts of the program.

How does one "disable JNI debug messages" please?

I have looked everywhere I could think of in Eclipse and haven't tracked it down.

Thank you.

MarqTwine
Phidgetly
Posts: 17
Joined: Mon Dec 27, 2010 11:45 pm
Contact:

Re: Constant INIT when using Interface Kit software.

Postby MarqTwine » Mon Jul 30, 2012 12:49 pm

The constant init is still a BIG problem. If I don't shut my app down with an android task killer, Eclipse will die in about 5 minutes.

Furthermore, it causes my development computer to run out of memory and run both CPUs full tilt. Sometimes, I have to do a full reboot to clear the computer and use it again.

Additionally, I use Logcat all the time, and this init issue causes whatever I print out to scroll off the screen within seconds.

Any suggestions, please?

Thanks.

MarqTwine
Phidgetly
Posts: 17
Joined: Mon Dec 27, 2010 11:45 pm
Contact:

Re: Constant INIT when using Interface Kit software.

Postby MarqTwine » Tue Aug 07, 2012 6:34 pm

Removed by user.
Last edited by MarqTwine on Tue Sep 11, 2012 7:08 am, edited 1 time in total.

MarqTwine
Phidgetly
Posts: 17
Joined: Mon Dec 27, 2010 11:45 pm
Contact:

Re: Constant INIT when using Interface Kit software.

Postby MarqTwine » Tue Aug 07, 2012 6:36 pm

Are there others with this problem, or am I the only one? :?


Return to “Android”

Who is online

Users browsing this forum: No registered users and 1 guest