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 8523637
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T07:27:58+00:00 2026-06-11T07:27:58+00:00

I am currently trying to write data to a HID driver that i have

  • 0

I am currently trying to write data to a HID driver that i have running on my phone. If i run the following command in shell (via adb) echo -e \\x00\\x00\\x07\\x04\\x00\\x00\\x00 > /dev/hidg0 && echo -e \\x00\\x00\\x00\\x00\\x00\\x00\\x00 > /dev/hidg0 the correct characters are typed on the computer connected to the device, which in this case is da. If however i send the same command in an android application like so

Runtime shell = Runtime.getRuntime();
Process p = shell.exec("su");
DataOutputStream out = new DataOutputStream(p.getOutputStream());
out.writeBytes("echo -e \\x00\\x00\\x07\\x04\\x00\\x00\\x00 > /dev/hidg0 && echo -e \\x00\\x00\\x00\\x00\\x00\\x00\\x00 > /dev/hidg0\n");

2 single quotes are printed but nothing else. I have proved that the app is getting root privilages by writing files to locations that can only be accesed by root.

So why would a command like this not act the same way in a shell as threw the process class? and does anyone have any suggestions as to how i should send data to my device driver?

Thanks
Adrian

PS i have also tried shell.exec("echo -e \\x00\\x00\\x07\\x04\\x16\\x06\\x00 > /dev/hidg0 && echo -e \\x00\\x00\\x00\\x00\\x00\\x00\\x00 > /dev/hidg0"); but this gives me nothing

  • 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-06-11T07:28:00+00:00Added an answer on June 11, 2026 at 7:28 am

    After Java processes the stream, the shell is seeing this command:

    echo -e \x00\x00\x07\x04\x00\x00\x00...
    

    i.e., Java is processing the double backslashes itself. You would need to add another set of escaped backslashes so that the shell actually sees a single escaped backslash. You could do

    out.writeBytes("echo -e \\\\x00\\\\x00...")
    

    but that looks horrible. Just pass a quoted string to the shell with

    out.writeBytes("echo -e '\\x00\\x00\\x07\\x04\\x00\\x00\\x00' > /dev/hidg0 && echo -e '\\x00\\x00\\x00\\x00\\x00\\x00\\x00' > /dev/hidg0\n");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently trying to write some code that will accept some FTP details,
I'm currently trying to write a script that will connect to a site using
I am currently trying to write an addin for PowerPoint that whenever any PowerPoint
Currently I'm trying to write my first Python library and I've encountered the following
I'm currently trying to write data from an array of objects to a range
I am currently trying to write a large amount of data to an excel
I'm currently trying to create a kernel module that will produce data based on
I am currently trying to write a program to store data about people into
I'm currently trying to write an iPhone companion to a website that I'm developing.
I'm currently trying to write a website for testing / learning purposes that will

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.