Attach multiple USB Phidgets (1024_0) to Android device

Supporting 4.1 and up
fl0wtec
Fresh meat
Posts: 3
Joined: Mon Jul 16, 2018 4:49 am
Contact:

Attach multiple USB Phidgets (1024_0) to Android device

Postby fl0wtec » Wed Aug 01, 2018 4:37 am

Dear Patrick,

it seems, that on Android your Phidget-USB-library is not able to connect multiple USB Phidgets at a time.

Both these threats mention the same issue, without any solution so far:

Phidget on Android with USB-Hub. InterfaceKit & Temp Sensor
https://www.phidgets.com/phorum/viewtopic.php?f=49&t=6947

Interfacing multiple phidgets on Android/JAVA
https://www.phidgets.com/phorum/viewtopic.php?f=49&t=5633

I am experiencing the exact same issue: trying to open more than one RFID 1024_0 phidget, does only pick up one and throws a TIMEOUT PhidgetException afterwards for the second one:

Code: Select all

I/Phidget22: INFO [phidget22usb][2018-08-01T12:25:39]:Found device not in AttachedDevices: /dev/bus/usb/001/049
I/Phidget22: INFO [phidget22usb][2018-08-01T12:25:39]:PhidgetAndroid_openPhidget -> Opening: /dev/bus/usb/001/049 Interface: 0
D/UsbRequestJNI: init
I/Phidget22: INFO [phidget22usb][2018-08-01T12:25:39]:PhidgetAndroid_openPhidget -> Got a successful opened device!
I/Phidget22: INFO [phidget22][2018-08-01T12:25:39]:PhidgetRFID Read-Write(1024) (518886): ReadThread starting
I/Phidget22: INFO [phidget22][2018-08-01T12:25:39]:tagTimerThread running
D/ATTACH_RFID_1: Channel RFID: 0 on device 518886 ATTACHED
...
W/System.err: PhidgetException TIMEOUT (Timed Out)
W/System.err:     at com.phidget22.PhidgetBase.open(Native Method)



What I do for all RFID objects:
    Create RFID objects
    setDeviceSerialNumbers
    setChannels
    attach listenerss
    open(5000) both channels

I assign different channels (0 and 1) and the corresponding serial numbers to the RFID objects.

Additionally, this is considered already:
In the app code

Code: Select all

com.phidget22.usb.Manager.Initialize(this);


In the Manifest

Code: Select all

<uses-feature android:name="android.hardware.usb.host" android:required="false" />


I verified this even with your Android RFID example.

Adding another channel produces the same results: the app is not able to open more than one RFID channel.

Can you please point me into the right direction?

BR
fl0wtec

LucasP
Phidgetly
Posts: 17
Joined: Fri Oct 07, 2016 4:47 pm
Contact:

Re: Attach multiple USB Phidgets (1024_0) to Android device

Postby LucasP » Wed Aug 01, 2018 8:46 pm

Channel should be 0 for both.

fl0wtec
Fresh meat
Posts: 3
Joined: Mon Jul 16, 2018 4:49 am
Contact:

Re: Attach multiple USB Phidgets (1024_0) to Android device

Postby fl0wtec » Thu Aug 02, 2018 8:48 am

Dear LucasP,

thanks for your suggestion. However, it does not work that way:

Here`s the code:

Code: Select all

ch1.setChannel(0);
ch2.setChannel(0);
ch3.setChannel(0);

ch1.open(5000);
ch2.open(5000);
ch3.open(5000);


And this is the resulting console output:

Code: Select all

$ adb shell am start -n "appname/com.example.PhidgetRFIDExample.RFIDExample" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Connected to process 3306 on device DEVICE
Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat output" section of the "Debugger" settings page.
W/linker: libphidget22java.so: unused DT entry: type 0x6ffffffe arg 0x2a15c
          libphidget22java.so: unused DT entry: type 0x6fffffff arg 0x3
I/art: Thread[1,tid=3306,WaitingForJniOnLoad,Thread*=0xb4827800,peer=0x74074000,"main"] recursive attempt to load library "/data/app/appname-1/lib/arm/libphidget22java.so"
I/art: Thread[1,tid=3306,WaitingForJniOnLoad,Thread*=0xb4827800,peer=0x74074000,"main"] recursive attempt to load library "/data/app/appname-1/lib/arm/libphidget22java.so"
W/art: Suspending all threads took: 7.117ms
I/art: Background sticky concurrent mark sweep GC freed 3500(251KB) AllocSpace objects, 0(0B) LOS objects, 7% free, 2MB/3MB, paused 9.376ms total 28.894ms
I/art: Thread[1,tid=3306,WaitingForJniOnLoad,Thread*=0xb4827800,peer=0x74074000,"main"] recursive attempt to load library "/data/app/appname-1/lib/arm/libphidget22java.so"
I/art: Thread[1,tid=3306,WaitingForJniOnLoad,Thread*=0xb4827800,peer=0x74074000,"main"] recursive attempt to load library "/data/app/appname-1/lib/arm/libphidget22java.so"
D/UsbDeviceConnectionJNI: close
D/UsbRequestJNI: init
W/System.err: PhidgetException TIMEOUT (Timed Out)
W/System.err:     at com.phidget22.PhidgetBase.open(Native Method)
                  at com.example.PhidgetRFIDExample.RFIDExample.onCreate(RFIDExample.java:103)
                  at android.app.Activity.performCreate(Activity.java:5990)
                  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
                  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
W/System.err:     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
                  at android.app.ActivityThread.access$800(ActivityThread.java:151)
                  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
                  at android.os.Handler.dispatchMessage(Handler.java:102)
                  at android.os.Looper.loop(Looper.java:135)
                  at android.app.ActivityThread.main(ActivityThread.java:5254)
                  at java.lang.reflect.Method.invoke(Native Method)
                  at java.lang.reflect.Method.invoke(Method.java:372)
                  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
D/Atlas: Validating map...
I/Choreographer: Skipped 321 frames!  The application may be doing too much work on its main thread.
D/libEGL: loaded /system/lib/egl/libEGL_vr.so
D/libEGL: loaded /system/lib/egl/libGLESv1_CM_vr.so
D/libEGL: loaded /system/lib/egl/libGLESv2_vr.so
I/OpenGLRenderer: Initialized EGL, version 1.4
D/OpenGLRenderer: Enabling debug mode 0
E/[EGL-ERROR]: EGLBoolean __egl_platform_create_surface_window(egl_surface*, mali_base_ctx_handle):933: =========> usage 0x900
D/ATTACH_RFID_2: Channel RFID: 0 on device 518886 ATTACHED



It attaches just one device and times out for at least one other.

@Patrick: can you please provide some insight on this issue?

BR
Florian

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

Re: Attach multiple USB Phidgets (1024_0) to Android device

Postby Patrick » Mon Aug 20, 2018 1:28 pm

This issue has been reproduced, and we are looking into it.

-Patrick

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

Re: Attach multiple USB Phidgets (1024_0) to Android device

Postby Patrick » Mon Sep 24, 2018 10:12 am

This issue has been resolved.


Return to “Android”

Who is online

Users browsing this forum: No registered users and 1 guest