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

Using USB Serial Facade #2

Closed
foxtrotmike opened this issue Apr 18, 2015 · 11 comments
Closed

Using USB Serial Facade #2

foxtrotmike opened this issue Apr 18, 2015 · 11 comments

Comments

@foxtrotmike
Copy link

I am using the SL4a 5x04 and Python 2.7.9 onn my Nexus 7 (android 5.1) and am trying to access the USB with the example script given here: https://github.com/kuri65536/sl4a/blob/master/android/USBHostSerialFacade/samplescripts/testpl2303.py

However, android.usbserialGetDeviceList() gives an error saying that the RPC is not recognized. The exact error is:

Result(id=1, result=None, error=u'com.googlecode.android_scripting.rpc.RpcError: Unknown RPC.')

I used the latest releases for both SL4A and Python available on GitHub.
Any hints?

@kuri65536
Copy link
Owner

lease check below in the document (USBHostSerialFacade.md):

  • USB Serial devices were not handled by Android kernel.

BTW, What device you use?
This information is helpful for me.

Some tablets grab the usb-devices in kernel level.
In this situation, you will not be able to treat devices with usb serial facade
and you can use serial device in pySerial module via /dev/ttyUSB0
(I'm really not sure because I have not met such devices grabbed by kernel.)

@foxtrotmike
Copy link
Author

Thank you for your reply. I am afraid I don't understand what "USB serial devices were not handled by Android kernel" means. I am under the impression that with the USBHostSerialFacade we should be able to use the USB port on android devices just as the Java android usb module, No?
I have tried it on my ASUS Google Nexus 2012 running Android 5.1 as well as my Samsung Galaxy Core II running Android 4.4 but it gives the same error. To me it seems that the distribution apk doesn't include the RPC function for USB handling. But again, I don't have much of a background here.

@kuri65536
Copy link
Owner

To me it seems that the distribution apk doesn't include the RPC function for USB handling

oh, no I forget to enable USB Facade in FacadeConfiguration.java.
I made binary soon, just wait for minutes.
(but I trying fix another issue today, please wait.)

@foxtrotmike
Copy link
Author

Thanks. Please let me know and I will be happy to test it again.

kuri65536 pushed a commit that referenced this issue Apr 19, 2015
@kuri65536
Copy link
Owner

I fixed to enable facade and binary is now updated: [https://github.com/kuri65536/sl4a/commit/58dea62a878d1270ebca6b5b18d8d97aeb9b3eb7]

My question is what the serial device did you want to use, so
I'm interested in what serial device you will use.
Especially, Running arduino with this facade is the very useful information for sl4a or python users.

BTW, handled by kernel is shown in app as above (devices in linux tab)::

https://lh4.ggpht.com/XtDQ1Uo8zMfBLl9LLhh8HLBhObZVbLRvdLMwRz7G_dQIo2yLisBfIR0AUdYiBuJML3Q=h900

The devices in linux tab will not be handled from Android USB API.

@foxtrotmike
Copy link
Author

Thanks. I have just tried to connect my USB flash disk and at least it recognized it now but of course read or write doesn't work. I am planning to try it with my PIC18F4550's USB. Let's see what happens. I will let you know about it. If you know more about this, I will be grateful if you share it with me.

@foxtrotmike
Copy link
Author

Oh and can you please put the help file on using the usb facade here?

@kuri65536
Copy link
Owner

  • Sorry, there is no document for USB facade... I make it later (please don't expect comes soon).
  • I had work with PIC24F USB-CDC in native Android app.
    I forget the successed or failed work with facade. but trials were remained in code.

@foxtrotmike
Copy link
Author

I tried it with PIC18F4550. It does pick up the device (device id, vendor id) but actual connection and transfers do not seem to work. Any ideas?
Thanks in advance.

@kuri65536
Copy link
Owner

Let me know about your device status.

  • What your device USB Class? This facade may be work with USB-CDC only.
  • How do you connect your device to PC? Terminal emulater (like teraterm, putty)?
    Out device connect to PC, this appear to COM? in Windows. then we see data in putty.

In this (Android USB Host) system, USB Implementation must be written in java code.
your device is not configured to USB-CDC, new facade was needed.

@kuri65536
Copy link
Owner

close this is old post.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants