[Q] Can I access and use serial ports from a native Linux app on an Android device? - Android Q&A, Help & Troubleshooting

Hi there,
I just signed up here and this is most probably not the right place for this kind of questions, but as a newbie I'm obviously not allowed to post into the developer section.
We're currently examining the pros and cons of the next hardware platform for our project, which consists of two software components: one is a non-UI background application that communicates with industrial plants over a serial connection via RS232 and/or RS485. It also offers an interface to higher-level software, such as the corresponding GUI, in which we want to show a data visualization and monitor.
I've done some testing with Linux and Qt, it ran quite well on the currently used BeagleBone Black ARM board in combination with a 7" LCD touch display, but the UI is not nearly as smooth as Android, for example.
Now I'd like to rebuild it with Android, as it offers a much more comfortable and "fun-to-use" UI. But I couldn't find an answer to the most important point for us: as Android is set upon the underlying linux - can we compile and run our background application on this system AND also access and use the "real" serial ports the hardware offers (e.g. dev/ttyS[n], not talking specifically about the BeagleBone right now, think of any ARM board with these ports built into it), just like on every other ARM linux board with COM ports? Or is there a fundamental difference in the way Android and its base linux behave when it comes to IO ports?
Basically, what I think of is this:
- a background application running on Android Linux that talks to the plant over a serial connection
- an Android app acting as UI talking to the background process
Thanks for your help!

Related

[Q] Android technical introduction

Hi. I'm about to get my first Android phone, and would naturally like to know more about the OS. I would describe myself as intimately familiar with ordinary GNU/Linux systems, but let's face it, Android is hardly your ordinary such creature. Moreover, there seems to be very few technical introductions to Android around; those I've found tend to be idiotic user's guides (not technical at all) or focused on software development (interesting, but not what I'm looking for right now).
Things I wonder about with Android include:
There's an unusual libc, right? Is the GNU userland around, though?
The file system directory structure. It's hardly LSB-compliant, eh?
The package system. Everything I've come across is centered around the SDK, and hides many of the details of what goes on here. Sub-questions: Is it only "apps" (gah, I hate the word, I'm sorry) that use the package manager, or is everything covered by it, as in a normal Linux system?
The boot loader. Experience with other ARM/non-x86-systems indicate this is a world very different from GRUB, and also a highly varied one.
How do shared libraries fit into the Android ecosystem? Some places I get the impression everything is static. Is that really true?
What's this non-X display system? How do you configure it, etc.?
What's the init system like?
As far as I've understood, the actual phone software (is "baseband" the right terminology?) tends to be proprietary and separate from the OS. How does it fit into all of this? Does the OS execute code at some mysterious memory location? Is some special-purpose hardware run? Is it just a standard process? Is it in kernel-space?
I'm not looking to get these questions answered here. Rather, I'm asking: Are there any documents or books around that try to fill the role of bringing an experienced Linux user with decent development background and technical knowledge into Android?

[Q] Is it possible to use virtualization on the Atrix

I've been working these days on virtual servers and in that state of "virtualization user" mindset an idea hit me: Could it be possible to use virtualization techniques to account for lack of proper ICS drivers in Atrix.? For example: Emulating 3.x kernel supported hardware (Nexus?) on top of a 2.6.x kernel with the released drivers?
I found this video of EmbeddedXen running on an HTC phone: http://www.youtube.com/watch?v=ErLZQE5ZI7U&feature=player_embedded but I think we wouldn't need simultaneous running of two OSs (well, on second thought, this could be a terrific WebTop).
Saludos, Marco.
Sounds like you're after a concept similar to ndiswrapper on Linux.
I think that would likely introduce more complexity and instability than it's worth.
Hm, that's an interesting idea. I've been having similar thoughts about virtualizing the virtual machine on android and being able to save ram by not replicating the virtual machine state for each app you open up. For example open g l e s 2 libraries get loaded at around 5 or 8 megabytes each for each app that uses 3d rendering on android.

[Q] Tablet ubuntu able to run edubuntu (kde etc)?

Hi all
Does anyone know if I can run kde-based software on the developer alpha of Ubuntu for tablets yet please? Not expecting reliability, just want to do some child user testing of the edubuntu suite on tablets.
Thanks
Chris
Currently you can't and probably neither in the near futur 'cause you need an X Server for that.
And there is no X server on ubuntu touch.
Huge thanks, that is really useful
Hempe said:
Currently you can't and probably neither in the near futur 'cause you need an X Server for that.
And there is no X server on ubuntu touch.
Click to expand...
Click to collapse
After some research on your reply I've a couple questions. Does it mean the Unity interface doesn't need X-server? Or are they just using a temporary workaround until X-server is implemented?
And does this apply to both Ubuntu for Android, and Ubuntu for tablets?
Huge thanks
Having done some further research I've made my decision - thanks hugely for providing the missing link in my knowledge. What follows is my best interpretation of the rumours.
Currently in place of X-server is SurfaceFlinger, ("because X-server uses 30 yr old code" - Canonical). Canonical publicly dabbled with using Wayland until mid-Feb, then decided to create their own revamped display server from scratch, called Mir, which they seem to have been working on since mid last year, and are trying to get GPU vendors to support, written to run across all devices and to meet the needs of the Unity interface, and written in Qt/QML which is what they want native apps written in.
Bottom line for me, is that the technology is still right up there in the clouds and nowhere near decided enough to base my business strategy on. Also, Ubuntu for tablets seems a pretty thin version of Ubuntu anyway, so Edubuntu was never an option and I'm unlikely to be able to leverage much from Ubuntu's Open Source libraries anyway.
Like others, (see the comment on jonobacon.org below), I find it frustrating that the wealth of code written for Ubuntu is no longer usable, but I reckon this is probably necessary to squeeze the most out of every single CPU cycle and milliamp. Ubuntu for tablet is dead in the water if it kills the battery and performs worse than the established competitors.
Therefore all indications are I need to write for Android, keeping my options as open as possible to migrate. So it is now Titanium/UnityIDE versus HTML5, particularly assessing relative performance.
http://www.omgubuntu.co.uk/2013/03/canonical-announce-custom-display-server-mir-not-wayland-not-x
http://www.jonobacon.org/2013/02/21/five-ubuntu-touch-facts/ -- not the article but the comment starting "In that case, wouldn't it be better to port existing apps instead of...."
http://www.omgubuntu.co.uk/2013/02/canonical-working-on-new-display-server
http://www.phoronix.com/scan.php?page=news_item&px=MTMwOTM
Just to clarify.
1. There are plans to make a X-Mir compatibility layer that will allow you to run programs that require an X-Server to work with mir.
2. Not all is lost at the moment it just looks that way.
Only Graphical Userinterfaces are affected. Your commandline tools and libraries don't need to be changed.
3. If you are looking for platform to write apps for, well there is worke being done to let you run your QML apps (intended for ubuntu touch) on android.
So if you choose to make QML apps they can be or will be able to run on linux, mac, windows and android
Wow, huge thanks, I missed that.
Does this mean EVERYTHING Ubuntu without a GUI will work? I want to run a NodeJS server. How likely is it that it will work perfectly now? How likely is it that it will work perfectly in the (nominally October 2013) release? (Sorry, just give me a keyword and I'll go off and do my research.)
Is Canonical planning to get X-Mir into the next ~Oct release?
My other query was whether QML on Android would perform as well. For others interested, it looks like it works directly with the Android SurfaceFlinger, bypassing the Dalvik VM, so performance should compare with native Java code.
Huge thanks once again
Chris
Sources:
http://www.youtube.com/watch?v=TEkubKZaUt8
http://victorpalau.net/2013/01/25/ubuntu-qml-todo-android-vs-ubuntu/

Android app framework suggestion.

Hello all!
Would it be possible to develop a framework of some sorts to install android apps natively instead of using Darwin or JVM on Ubuntu Touch?
The way I see it (might be a little too simple) is to convert the bytecode to native code and write wrapper functions for Android function calls or something like that. Is it possible?
Android doesn't use Darwin or the JVM (In the strictest sense), it uses either the Dalvik VM (which is based off Java, but is not Java, nor is it a JVM in the strictest sense [as in, executes applications made for the Java JVM]) or the Android Runtime (ART).
To my knowledge there is no Android analog to WINE (what you're proposing). There are applications such as Genymotion and Shashlik but those either aren't targeting ARM or aren't ready for ARM yet.
It's quite possible, if you ported the Android Runtime or Dalvik VM over to a WINE-esque application, but no, to my knowledge there are no projects doing this.
As Android is coming to Chromebooks it may be possible to just replicate the same container on Ubuntu Touch - it may require some work to make Mir work with whatever interface Chromebook's android port talks to (Freon?) but Google will do most of the effort here
grandrew said:
As Android is coming to Chromebooks it may be possible to just replicate the same container on Ubuntu Touch - it may require some work to make Mir work with whatever interface Chromebook's android port talks to (Freon?) but Google will do most of the effort here
Click to expand...
Click to collapse
Android itself is NOT coming to Chromebooks, this is simply Google's Android Runtime for Chrome being released into mainstream usage (see the Archon project for more information about this runtime.), This is still an emulated Android device (albeit more optimized so it runs faster, likely using x86 binaries) that runs under Chrome's NACL platform, it is NOT Android on Chromebooks as many news sources would like to suggest.
At the moment, Chromium does not run very well inside XMir (which is why I didn't give it any real thought there), but yes, this and the Android Runtime for Chrome should fill this gap perfectly. In the future though, it may be possible to use the LXC container with some work done to surface_flinger and the Android frameworks (to support Mir's windowing system ofc) to run the applications inside the Android container.
Like I said though, Google's Chromium runtime would work. But we currently have no hardware acceleration inside of legacy X11 applications, limited filesystem access inside said legacy container (only the XDG standard folders: Downloads, Documents, Music, Pictures are mounted into the legacy container), We also don't really have good, working OpenGL available to X11 applications since GPU access is done through libhybris which X11 knows nothing about.
It's possible to get around this similar to how Canonical has done it on the PC's development version of Unity8 and get Hardware Acceleration (truthfully, I haven't tested to see if it works with the android mirplatform packages though) by turning on DRI/DRM, I did this in my tweaked kernel, but it doesn't seem to provide any performance improvements with the freedreno X11 driver installed (I saw no indication that XMir initialized the freedreno driver at all, only Mesa's Software Rasterizing Interface driver.)

Hello Jide, I'm a developer, and I want to develop on Remix OS.

When I first saw Remix OS, I was ecstatic thinking of the possibilities for development, and now that it's come out on the Pixel C, this could be really innovative.
Imagine using Android Studio on my laptop and then pushing my in-development application to the Pixel C using ADB (Android Debug Bridge) over wire or wifi, and then an app window showing up to test my app, essentially replacing a real phone with an all in one Pixel C computer. The main reason why this was so ecstatic for me was because what I am testing on is now no longer a phone, but a computer, four very important and useful things open up for me to possibly experience:
I can resize my application easily on the tablet to test out any dimensions.
- We all know the emulator is a ***** in Android and even the thought of starting and restarting different emulator instances for different dimensions, or, god forbid spending hundreds of dollars on different android devices of different sizes just irks me to the core.
- Resizing would become as simple as a click, hold, and drag, just like browser development. An added bonus would be Jide giving a little toolbar above or below or to the side of these development applications to simulate different settings, such as Location, Network, whatever, and maybe even a resize button to select popular and customizable preset dimensions.
I can have multiple instances of my application to run at the same time, basically A/B test on myself.
- I don't know how you can manage this, but if you can, whatever the way it may be done, it would be marvelous.
- Imagine the power of being able to test multiple versions of an application side by side or even different applications side by side, one for each window of Android studio perhaps.
- Testing is one of the slowest factors of android development, but no matter how you put it, being able to run as many applications as I want to test would definitely speed up the process.
- Write a bit of code for idea one and start the test and let it run.
- Code up another idea to test.
- While the second one is getting ready for testing, you can test the first one.
- When the second one is ready, we can test them side by side to see which idea is better.
- It would be, again, simply marvelous, and the number of instances to test could be increased for even greater speed.
I can control it from my laptop.
- If you need to be told the gigantic advantages of being able to control your android device by simply moving your mouse over to the screen as if it was an extended display, then you must really not have any imagination.
- https://sites.google.com/site/droidskm/
- https://sourceforge.net/projects/synergyandroid/
- There are many tools out there to allow this kind of control, and all Jide really has to do is make it really easy for us to root the OS, maybe a button click in the developer tools, so we can install tools like the ones I mentioned above.
Remix OS could become where I test AND develop. If an android studio like tool were to be created for Remix OS, where all the previews and all the testing are just popups on the sides of the tool, then development would be even cooler.
- There would be no need for a native android device, no need to fumble back and forth, especially since Laptops or the Pixel C would probably have all the features of a modern phone, and thus act just like one in testing.
- Since all we're doing is launching another application on the native OS, there shouldn't be any annoying and overbearing emulator problems, nor lag or performance issues.
- I know this is a stretch, since a tool like Android Studio would be very hard to live up to, but even a simpler version would do, like sublime; Jide may even contract or partner up with IntelliJ to create such a tool or host of tools.
These four core points are marvelous, and for an android developer, Jide would become heaven. If Jide really does listen to the community, they would listen to this, because if they pushed forward with these ideas, their platform would grow a lot, easily becoming the number one platform for Android development, definitely garnering a lot of attention.
Oh, and please add a Linux console I can use.
Thank you.
Sincerely, an imaginative android/web developer.
- redDrill
On #2 you can sort of do that already by using different users
On #4 something like AIDE would be too simple I take it...

Categories

Resources