Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Galaxy S2 and Motorola Xoom #1

Closed
shinyshez opened this issue Jun 19, 2013 · 20 comments
Closed

Galaxy S2 and Motorola Xoom #1

shinyshez opened this issue Jun 19, 2013 · 20 comments
Assignees
Milestone

Comments

@shinyshez
Copy link

Hey,

On both these platforms I get this message and stacktrace almost immediately (before unplugging and plugging into an Arduino due)

I appreciate the Due is adding further unknown variables (presumably I need to add vendor & product id to device_filter.xml at least ?) but it looks like its falling over before that.

Does this sound like a device specific problem, or am I just being dumd?
Cheers
Shez

FATAL EXCEPTION: Animation Thread
java.lang.IllegalStateException: Cannot setup USB Serial.
at com.yourinventit.processing.android.serial.UsbSerialCommunicator.doStart(UsbSerialCommunicator.java:105)
at com.yourinventit.processing.android.serial.AbstractAndroidSerialCommunicator.start(AbstractAndroidSerialCommunicator.java:333)
at com.yourinventit.processing.android.serial.AbstractAndroidSerialCommunicator.start(AbstractAndroidSerialCommunicator.java:308)
at com.yourinventit.processing.android.serial.AbstractAndroidSerialCommunicator.start(AbstractAndroidSerialCommunicator.java:297)
at com.yourinventit.processing.android.serial.Serial.(Serial.java:51)
at com.yourinventit.processing.android.serial.Serial.list(Serial.java:263)
at processing.test.serialtest.serialtest.setup(serialtest.java:33)
at processing.core.PApplet.handleDraw(Unknown Source)
at processing.core.PGraphicsAndroid2D.requestDraw(Unknown Source)
at processing.core.PApplet.run(Unknown Source)
at java.lang.Thread.run(Thread.java:856)

@ghost ghost assigned dbaba Jun 20, 2013
@dbaba
Copy link
Contributor

dbaba commented Jun 20, 2013

Hi Shez,

Thank you for your feedback!
I've tried to fix the issue.
Please download the new binary again and try it.
(Now the binary download is moved to SourceForge page)
However, I don't have Arduino Due, so let us know when you still have a problem with it.

Thanks,
db

@dbaba dbaba closed this as completed Jun 20, 2013
@shinyshez
Copy link
Author

Hey,

I've tried with this new version, but still get the same problem.

I recompiled from source to add wee bits of debugging, and when plugged into
the Due a USB device is returned in usbManager.getDeviceList(), but the
acquire(..) stage from usb-android-serial does not seem to succede. Happy to
add any debugging I can to help!
Cheers
Shez

On Thursday 20 June 2013 14:53:19 Daisuke Baba wrote:

Hi Shez,

Thank you for your feedback!
I've tried to fix the issue.
Please download the new
binary again and try it.
(Now the binary download is moved to SourceForge page)
However, I don't have Arduino Due, so let us know when you still have a
problem with it.

Thanks,
db


Reply to this email directly or view it on GitHub:
#1 (comment)
-19753646

@dbaba
Copy link
Contributor

dbaba commented Jun 24, 2013

Thank you for the report. Reopen the issue.
I will address this.

@dbaba dbaba reopened this Jun 24, 2013
@shinyshez
Copy link
Author

Hey,

I've hacked in a work around which works for me - your new code wasn't getting
hit because in 'list()' we deviceName is null. The below bypasses
UsbSerialProber.acquire when deviceName is null.

Not really production ready but gets me flying (literally, this is for a
hacked quadcopter controller!)

Cheers
Shez



a/src/main/java/com/yourinventit/processing/android/serial/UsbSerialCommunicator.java
+++
b/src/main/java/com/yourinventit/processing/android/serial/UsbSerialCommunicator.java
@@ -75,16 +75,16 @@ class UsbSerialCommunicator extends
AbstractAndroidSerialCommunicator implements
* @return
*/
protected UsbSerialDriver findUsbSerialDriver(String deviceName) {

  •           if (deviceName == null || deviceName.length() == 0) {
    
  •                   return UsbSerialProber.acquire(usbManager);
    
  •           }
    
  •       //          if (deviceName == null || deviceName.length() == 0) {
    
  •       //                  return UsbSerialProber.acquire(usbManager);
    
  •       //          }
            for (final UsbSerialProber prober : UsbSerialProber.values()) 
    
    {
    for (final UsbDevice usbDevice :
    usbManager.getDeviceList()
    .values()) {
    final UsbSerialDriver driver =
    getDevice(prober, usbDevice);
    if (driver != null
  •                                           && deviceName
    
  •                                                           .equals(driver.getDevice().getDeviceName())) 
    
    {
  •                               && (deviceName ==null || deviceName
    
  •                                   .equals(driver.getDevice().getDeviceName()))) 
    
    {
    return driver;
    }
    }
    On Monday 24 June 2013 14:48:40 Daisuke Baba wrote:

    Thank you for the report. Reopen the issue.
    I will address this.


    Reply to this email directly or view it on GitHub:
    Galaxy S2 and Motorola Xoom #1 (comment)
    -19907658

@dbaba
Copy link
Contributor

dbaba commented Jun 25, 2013

Thanks. So you cannot pass the deviceName since list() doesn't return anything.

I will address it.

db

@shinyshez
Copy link
Author

Hey.

If I understand you, then not quite - it was list() itself that was failing,
as that was the first point doStart and inquireUsbcontroller are called. No
opportunity to pass in a deviceName at that point. The original stacktrace
shows this.

Thanks again for your work on this, I've been round the houses looking for
reliable solutions, and last night was the first time my cotper flew under
tablet control - all be it straight into every hard surface in the flat ;)

Cheers
Shez

On Tuesday 25 June 2013 15:47:58 Daisuke Baba wrote:

Thanks. So you cannot pass the deviceName since list() doesn't return
anything.

I will address it.

db


Reply to this email directly or view it on GitHub:
#1 (comment)
-19981302

Hey,

I've hacked in a work around which works for me - your new code wasn't
getting
hit because in 'list()' we deviceName is null.  The below bypasses
UsbSerialProber.acquire when deviceName is null.

Not really production ready but gets me flying (literally, this is for a
hacked quadcopter controller!)

Cheers
Shez

@dbaba
Copy link
Contributor

dbaba commented Jun 25, 2013

I understood. The first call of Serial.list() never passes any deviceName, which caused the exception.

That is, the known bug where I put on my todo list.

Anyway, I'm very glad to hear your success story!

Flying quadcopter is really amazing!!!
I'd like to watch a video introducing your quadcopter and your tablet performance and/or to read a blog if possible.

I'm trying to create a vehicle (not a real one!) controlled by a tablet or a smartphone via BLE. However, I was just succeeded in using PWM to control a mabuchi motor with UNO R3 last Sunday...

db

@dbaba dbaba closed this as completed Jun 25, 2013
@shinyshez
Copy link
Author

Cool - I'll get something up for you and others - so far its not as useful as
the remote control the copter came with, but pretty damn cool none the less -
the Due is driving a A7105 radio chip to talk to a Hubsan X4 quadcopter board
taped to some kebab sticks, photo of the copter attached in the mean time :)

On Tuesday 25 June 2013 16:16:16 Daisuke Baba wrote:

I understood. The first call of Serial.list() never passes any
deviceName, which caused the exception.

That is, the known bug where I put on my todo list.

Anyway, I'm very glad to hear your success story!

Flying quadcopter is really amazing!!!
I'd like to watch a video introducing your quadcopter and your tablet
performance and/or a blog if possible.

I'm trying to create a vehicle controlled by a tablet or a smartphone via
BLE. However, I was just succeeded in using PWM to control a mabuchi motor
with UNO R3 last Sunday...

db


Reply to this email directly or view it on GitHub:
#1 (comment)
-19983498

@dbaba
Copy link
Contributor

dbaba commented Jun 27, 2013

Thank you for the info. Very helpful.
I'm looking forward to seeing the cool stuff!
db

@shinyshez
Copy link
Author

Video of a (kebabstick) octocopter being flown by my motorola xoom:
https://www.dropbox.com/s/fesrc4n9tjhul1p/2013-06-27%2022.01.41.mp4

write up to follow...

On Thursday 27 June 2013 12:00:57 Daisuke Baba wrote:

Thank you for the info. Very helpful.
I'm looking forward to seeing the cool stuff!
db


Reply to this email directly or view it on GitHub:
#1 (comment)
-20111162

@dbaba
Copy link
Contributor

dbaba commented Jul 1, 2013

Great!!
Thank you for the video. I like it.
I think it a good idea to post it to Vimeo or other video services as this is very attractive!

@shinyshez
Copy link
Author

http://www.instructables.com/id/Easy-Android-controllable-PC-Interfaceable-Relati/

:)

On Thursday 27 June 2013 12:00:57 Daisuke Baba wrote:

Thank you for the info. Very helpful.
I'm looking forward to seeing the cool stuff!
db


Reply to this email directly or view it on GitHub:
#1 (comment)
-20111162

@dbaba
Copy link
Contributor

dbaba commented Jul 13, 2013

Thanks! A great post!

@ArmoredGenie
Copy link

Hi was this fixed? I cant for the life of me get it to work!
I think I am having the same issue:

FATAL EXCEPTION: Animation Thread
java.lang.IllegalStateException: Cannot setup USB Serial.
at com.yourinventit.processing.android.serial.UsbSerialCommunicator.doStart(UsbSerialCommunicator.java:108)
at com.yourinventit.processing.android.serial.AbstractAndroidSerialCommunicator.start(AbstractAndroidSerialCommunicator.java:333)
at com.yourinventit.processing.android.serial.AbstractAndroidSerialCommunicator.start(AbstractAndroidSerialCommunicator.java:308)
at com.yourinventit.processing.android.serial.Serial.(Serial.java:72)
at processing.test.serialtest.SerialTest.setup(SerialTest.java:53)
at processing.core.PApplet.handleDraw(Unknown Source)
at processing.core.PGraphicsAndroid2D.requestDraw(Unknown Source)
at processing.core.PApplet.run(Unknown Source)
at java.lang.Thread.run(Thread.java:856)

Is there a workaround I can use? right now all I'm trying to do is write a single character to the serial port to test it out. Also I'm using a Galaxy S4 on 4.2.2

Thanks for all your hard work!

@dbaba dbaba reopened this Sep 28, 2013
@dbaba
Copy link
Contributor

dbaba commented Sep 28, 2013

Hi genie360,

Can you tell me the USB vendor ID and product ID of the device you connected to S4?
The error occurs when an unknown device is connected.
The way to get the info is:

@ArmoredGenie
Copy link

Thanks for the reply! t's a parallax xbee shield,
Heres what usbview said:

Device Descriptor:
bcdUSB: 0x0200
bDeviceClass: 0x00
bDeviceSubClass: 0x00
bDeviceProtocol: 0x00
bMaxPacketSize0: 0x08 (8)
idVendor: 0x0403 (Future Technology Devices International Limited)
idProduct: 0x6001
bcdDevice: 0x0600
iManufacturer: 0x01
iProduct: 0x02
iSerialNumber: 0x03
bNumConfigurations: 0x01

ConnectionStatus: DeviceConnected
Current Config Value: 0x01
Device Bus Speed: Full
Device Address: 0x01
Open Pipes: 2

Endpoint Descriptor:
bEndpointAddress: 0x81
Transfer Type: Bulk
wMaxPacketSize: 0x0040 (64)
bInterval: 0x00

Endpoint Descriptor:
bEndpointAddress: 0x02
Transfer Type: Bulk
wMaxPacketSize: 0x0040 (64)
bInterval: 0x00

@ArmoredGenie
Copy link

also something I just though of.... whats the best way to make sure that I'm using the correst com port on the phone? I'm pretty sure its "/dev/ttyUSB0", but seeing as I cant get it to run, I cant list the ports to be sure. Thanks again!

@dbaba
Copy link
Contributor

dbaba commented Sep 30, 2013

Both vendorId and productId are valid for FTDI USB values. So there is another issue.
How about your AndroidManifest.xml? Does it include the following?

      <intent-filter>
          <action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
      </intent-filter>
      <meta-data
          android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"
          android:resource="@xml/device_filter" />
    </activity>

And make sure that an xml file is placed at YOUR_PROJECT_ROOT/res/xml/device_filter.xml. The xml content is available here.

When you connect the XBee shield to Galaxy via USB, a popup dialog appears in order for the Galaxy to ask you to choose an application using the USB device. If you have never seen the dialog, the USB settings are wrong.

The complete AndroidManifest.xml file example is available here.

Regarding the usb port on the phone, using Serial.list()[0] is recommended instead of /dev/ttyUSB0 since the correct port name may be different between phones (even if their device model is same).

@ArmoredGenie
Copy link

that did the trick! Thank you. I am also using this for a quadcopter :) I have an AR.Drone 2.0 and added a pan/tilt mechanism for the front camera. Thanks to your library I am able to control the pan/tilt using the android gyroscope! It has opened so many doors. I made a simple head tracker (with video glasses) and hand held version too. Cant wait for a test flight! will link a video soon

Thanks again

@dbaba
Copy link
Contributor

dbaba commented Oct 1, 2013

Good!
I'm looking forward to the update!

@dbaba dbaba closed this as completed Oct 1, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants