Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5946517
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:50:03+00:00 2026-05-22T16:50:03+00:00

I am doing this for a hobby type device where I am using the

  • 0

I am doing this for a hobby type device where I am using the Android as a cheap why to get GPS and other hardware services (since I already have the phone). I have used an unofficial kernel called AdbWinUsb that disconnects the USB from its usual use and makes it into an io port. Has anyone else out there done this before successfully? I have code to write out to the serial port:
import java.io.DataInputStream;
import android.os.Bundle;
import android.os.Messenger;

  DataInputStream os;      
  process = Runtime.getRuntime().exec("su");
  os = new DataOutputStream(process.getOutputStream());
  os.writeBytes("chmod 777 /dev/ttyMSM0\n");
  ....
  String data = "echo \"Hello World\" > /dev/ttyMSM0";
  os.writeBytes(data + "\n"); 
  os.flush(); 

and this works great.

Then in another thread, I need to set up the read, but I can’t write to the port to set it up as I did in the output….

    process = Runtime.getRuntime().exec("su");
    os = new DataInputStream(process.getInputStream());
    char xx = os.readChar();

The readChar doesn’t work because it is not set up. Is this correct? So what do I do?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T16:50:04+00:00Added an answer on May 22, 2026 at 4:50 pm

    There is no reference to any serial or USB port in the code you have posted.

    Pushing “Test” into the stdin of whatever process ‘su’ gives you isn’t going to accomplish much of anything. You’ll have better luck using su to chmod the device file of whatever device driver you have loaded to talk to whatever you plugged into the USB port (you do have a device driver loaded for that device, right?) and then talk to it from java, or to run a command line executable which proxies it’s stdin/stdout to the device file for you.

    What exactly have you plugged into the usb port?

    If you can tolerate a higher external hardware cost, either the new, official ADK from google for recent android releases or the 3rd party IOIO (which should at least with modifications work on just about anything) may manage to abstract away more of the difficulty and connect you to more sources of support, though frankly having the accessory as the USB host is an unfortunate backwardness to have to resort to.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently doing this, but I am doing something wrong :): <Style TargetType={x:Type
Im doing something like this to get a list of all users that have
While doing this in python: tp = curses.textpad.Textbox(stdscr, insert_mode=True) text = tp.edit() I get
I am doing this first time so I need some help. I am using
I find my self doing this type of IF statement allot. For example: if($variable
I'm doing a raytracer hobby project, and originally I was using structs for my
Im doing this project where i need to download files through a webservice (images,
I have some code doing this : var changes = document.getElementsByName(from); for (var c=0;
I'm doing this system Stacked and I am creating the search function. And in
So I'm doing this in PHP but it is a logic issue so I'll

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.