I am trying to access an Arduino from my Xiaomi Pocophone F1. The phone is running LineageOS 16 and is rooted.
I am trying to use this code project as a start:
https://www.instructables.com/id/Arduin-Adroid-USB-Serial-Communication/
It uses the slightly old "Physicaloid" library I got from here:
https://github.com/ksksue/PhysicaloidLibrary
I imported the project and the Physicaloid library into AndroidStudio, and I can start the app. But every attempt to connect to the Arduino fails.
I am struggling with the permission for using the USB Host feature in my app, I guess. The app "USB Device Info" shows me a recognized USB2.0-Serial device when I plug the Arduno in. But it seems no intent is created and so I cannot request the permission "on the fly" via an intent filter. And I also don't know how to explicitly request the permission. I tried to create a permission xml file "android.hardware.usb.host.xml" in /system/etc/permissions (copied there via "Root Explorer") with the following content (as I have read in several locations on the web):
Code:
<?xml version="1.0" encoding="utf-8"?>
<permissions>
<feature name="android.hardware.usb.host"/>
</permissions>
Then I try to request the permission by name "android.hardware.usb.host", but that does not seem to work, either.
Am I on the right track? What would be the right track?
PLEASE MOVE BACK TO ANDROID DEVELOPMENT - THIS IS ABOUT CREATING CODE - NOT Q&A; NOT TROUBLESHOOTING; BUT CODE DEVELOPMENT - THANK YOU VERY MUCH !!!!!!!!!!!!!!!!!!!!!!!!!!!!
If there is a tutorial about logging for Android development in the "Software Development & Hacking" section, why is a posting related to permissions not in the correct spot?
I am wondering wheter @SacredDeviL666 is a human being or just a forum bot.
pegnose said:
PLEASE MOVE BACK TO ANDROID DEVELOPMENT - THIS IS ABOUT CREATING CODE - NOT Q&A; NOT TROUBLESHOOTING; BUT CODE DEVELOPMENT - THANK YOU VERY MUCH !!!!!!!!!!!!!!!!!!!!!!!!!!!!
If there is a tutorial about logging for Android development in the "Software Development & Hacking" section, why is a posting related to permissions not in the correct spot?
I am wondering wheter @SacredDeviL666 is a human being or just a forum bot.
Click to expand...
Click to collapse
A bot i believe....
Development forum is to share a dev's work and not for troubleshooting or assistance which goes in Q&A.
When you have developed something then you can share in the dev sections
Nice, man. Asking about a dev issue in a sub-forum where people post who don't know how to save battery or do backups and stuff.
You are a really cool elite circle here. Exclusivity is always a nice touch. Thank you so much.
So no one knows this?
Never mind, problem solved.
Related
Hi there,
I am an android application developer and I'd like to write an application, which is rooting the phone.
There was a time(Android 2.2 and older), when rooting was not really a big thing.
Changing the rwx permissions of two files by running two "chmod" terminal commands was enough on nearly every device to root them.
But then it went more difficult.
There may not be such a simple solution like above, but I keep hoping that it is still possible programmatically. Here is an idea:
We could use Assembler and native C to generate a Puffer overflow by calling a Unix system call like here(http://peterdn.com/post/e28098Hello-World!e28099-in-ARM-assembly.aspx).Then we could get some code, which would be able to change the file permissions coz it's running in Kernel mode, into the Kernel this way.
What do you think of my idea? Write it down! I don't expect code or does anybody here know a Linux kernel exploit
But ideas where we have to look for those would be great.
Questions should be posted in Q&A forums, not Development forums.
http://forum.xda-developers.com/announcement.php?a=81
See rule #15
Thread moved.
Hello friends!
I have a Chinese BML One mini phone (I know it's crappy, but I had no choice), and I'm trying to start an android development with it.
I was aware that it might be hard to find any drivers for that phone, so I decided to use linux (opensuse 13.1) as a development machine (hopefully it requires no extra drivers).
The problem is that device seems to be invisible for the eclipse.
When I do in eclipse "run as - android application" - it says that there is no suitable device found and suggests to create a virtual one.
Usb debugging is on. Phone keyboard is unlocked.
The project is created to run on android 2.2. (The phone says that it is 4, but while digging here on the forum I found that it is really 2.3.5)
Is there any special way of connecting that phone to the PC? Hold secret combination of buttons maybe?
(As far as I know galaxy nexus for example is also invisible for eclipse when you connect it as a flash drive, so you have to connect it as camera.)
The problem is even worse as my laptop is too weak for the development on emulator, so that mobile was the only chance to start android development.
I would be grateful for any answers and links.
Thank you.
Hej hej! Please share any thoughts why it could be? Any suggestion of what to try? Does anyone experienced any device recognition problems with Chinese mobiles on any OS? Is there something special with connection MocorDroid to PC?
What would you try?
Please give me at least a direction to dig.
Thanks
The main issue is that it's not an official Android version and the fact that they modded it to read the wrong Android version there is almost nothing you can do. Mix in the fact that there IS no kernel source code there will not be much you can do at all with development for that device.
Hello, thank you for the answer. You inspired me to search in Chinese internet using google translate, and that is what I've found:
One need to find the vendor and device id using lsusb command
Bus 001 Device 002: ID 1782:5d04 Spreadtrum Communications Inc
These 1782:5d04 is actually a device and vendor id.
Then we need to write it to /etc/udev/rules.d/51-android.rules file in that way:
SUBSYSTEM=="usb",ATTRS{idVendor}=="1782",ATTRS{idProduct}=="5d04",MODE="0666"
And also add "0x1782" without quotes to /home/XXX/.android/adb_usb.ini file.
If you don't have any of these files, create it. Note that 51-android.rules should have 644 permissions.
Than I googled for "0x1782" and found these two links, so I think that problem is not only chinese-fake-android-specific:
stackoverflow. com/questions/9210152/set-up-device-for-development-no-permissions
sudotask. wordpress.com/2013/10/30/how-to-adb-on-open-suse
It could be also problem with permissions like described here:
stackoverflow. com/questions/6484279/detecting-device-for-debugging-adb-does-not-work
So, now I able to use my mobile for Android development! Wait for more garbage in play market!
Thank you!
I am trying to set up a PPP connection from a Zte MF820b 4G LTE USB modem/router to a WiFi only Android tablet with a 4.2.2 os that has a custom ROM installed which technically shouldnt of been jailbroken. The tablet is running a Linux version 2.4.3 and KERNEL:3.0.36. The problem here is me. I am a complete newbie, but do know a little about command prompts and how this should work in theory. The tablet is fully rooted and has all the necessary applets installed via busy box(chat, nc, pppd, ect) and terminal emulator, or at least I think that's what's necessary. I installed PPPwidget 2 and 3 but as apk's and since they are not from the Play Store will not function. I have Google play store installed but its all but useless since I can not log into my account, for reasons I suspect as being that the system is too old and says something about the connection not being secure or private and as such...can not actually get the app with license verification from Google play store. I tried to lucky patch the apk and remove license verification but that did nothing as well. However the apk will read the modem and ask permission to allow pppwidget to be used but shortly fail after for the aforementioned lack of correct license. There must be a way to manually call the modem and connect via terminal emulator using adb ppp or nc? Without any understanding on how to actually write a script I'm hoping someone can help me get this functioning. Situation beyond current controll will not allow me to work with anything other than what's at hand, and I'm willing to pay for someones time if I can actually get this working. I also have a tablet with a different os (8.1 Oreo) should that be easier. With the 4.2.2 the device pops up as "storage" in my file manager. With the 8.1 it pops up as a device Id number when I type in lsusb in my terminal emulator. The 8.1 has Termux installed should that open up a different venue. The carrier I'm using is T-Mobile and the nameserver and ISP info is NS1-AUTH.SPRINTLINK.NET; IP 206.228.179.10. The device is functional as when the opportunity arose I was able to plug up to a computer and try it out. That's no longer viable. Again, I'm willing to pay for the help as I'm sure I'll need to correspond back and forth a few times and will probably need help writing the correct script if needed. Please email me @ [email protected]. Thank you.
Spoiler
milanv5 said:
I am trying to set up a PPP connection from a Zte MF820b 4G LTE USB modem/router to a WiFi only Android tablet with a 4.2.2 os that has a custom ROM installed which technically shouldnt of been jailbroken. The tablet is running a Linux version 2.4.3 and KERNEL:3.0.36. The problem here is me. I am a complete newbie, but do know a little about command prompts and how this should work in theory. The tablet is fully rooted and has all the necessary applets installed via busy box(chat, nc, pppd, ect) and terminal emulator, or at least I think that's what's necessary. I installed PPPwidget 2 and 3 but as apk's and since they are not from the Play Store will not function. I have Google play store installed but its all but useless since I can not log into my account, for reasons I suspect as being that the system is too old and says something about the connection not being secure or private and as such...can not actually get the app with license verification from Google play store. I tried to lucky patch the apk and remove license verification but that did nothing as well. However the apk will read the modem and ask permission to allow pppwidget to be used but shortly fail after for the aforementioned lack of correct license. There must be a way to manually call the modem and connect via terminal emulator using adb ppp or nc? Without any understanding on how to actually write a script I'm hoping someone can help me get this functioning. Situation beyond current controll will not allow me to work with anything other than what's at hand, and I'm willing to pay for someones time if I can actually get this working. I also have a tablet with a different os (8.1 Oreo) should that be easier. With the 4.2.2 the device pops up as "storage" in my file manager. With the 8.1 it pops up as a device Id number when I type in lsusb in my terminal emulator. The 8.1 has Termux installed should that open up a different venue. The carrier I'm using is T-Mobile and the nameserver and ISP info is NS1-AUTH.SPRINTLINK.NET; IP 206.228.179.10. The device is functional as when the opportunity arose I was able to plug up to a computer and try it out. That's no longer viable. Again, I'm willing to pay for the help as I'm sure I'll need to correspond back and forth a few times and will probably need help writing the correct script if needed. Please email me @ [email protected]. Thank you.
Click to expand...
Click to collapse
@milanv5
Prior to your next posting please read the guidances that are stuck on top of every forum like
Note: Questions go in Q&A Forum
If you are posting a Question Thread post it in the Q&A forum. Technical discussion of Android development and hacking. No noobs, please. Device-specific releases should go under the appropriate device forum...
forum.xda-developers.com
I've moved the thread to Android Q&A but I also closed it as duplicate of
PPP connection with android
I am trying to set up a PPP connection from a Zte MF820b 4G LTE USB modem/router to a WiFi only Android tablet with a 4.2.2 os that has a custom ROM installed which technically shouldnt of been jailbroken. The tablet is running a Linux version...
forum.xda-developers.com
Allow me to suggest to review the XDA Forum Rules, to which you agreed to adhere when you registered on XDA two years ago, and to focus especially on rule no. 5!
Thanks for your cooperation.
Regards
Oswald Boelcke
Senior Moderator
I would like to use sendevent rather than keyevent to send commands since it is faster and more flexible, however, I understand that recent devices do not allow access to sendevent.
Is there anyway to bypass the restriction without rooting the device? I have tried invoking it from the device side but still no luck.
kapiosallos said:
I would like to use sendevent rather than keyevent to send commands since it is faster and more flexible, however, I understand that recent devices do not allow access to sendevent.
Is there anyway to bypass the restriction without rooting the device? I have tried invoking it from the device side but still no luck.
Click to expand...
Click to collapse
Hello and good afternoon, @kapiosallos
Welcome to XDA! I hope you'll always get the support you require.
However, prior to your next posting please read the guidances that are stuck on top of every forum like
Note: Questions go in Q&A Forum
If you are posting a Question Thread post it in the Q&A forum. Technical discussion of Android development and hacking. No noobs, please. Device-specific releases should go under the appropriate device forum...
forum.xda-developers.com
and the others. I've moved your thread to General Q&A.
Thanks for your cooperation!
Regards
Oswald Boelcke
Senior Moderator
sure there is no common workaround for all devices, as the restrictions vary. on Xiaomi devices I cannot even use keyevent via adb shell unless Mi account bonded (I don't) and explicitly allowed in developer options (I can't). that's a pity I can't use scrcpy on Xiaomi.
Ugh. input keyevent.
It has to spin up a Java just to do a stupid character.
Actually, I don't even know anything about sendevent
Me, I just make my own injector daemon using uinput and a pipe.
You can mod ueventd.rc to give a 660 to the pipe.
You're still stuck with the SELinux end of things.
I've been lazy. I just start the client app on the pipe, setenforce 0, kick it, setenforce 1.
I have to patch the SE policy correctly. Someday.
Ah, you do need root.
alecxs said:
sure there is no common workaround for all devices, as the restrictions vary. on Xiaomi devices I cannot even use keyevent via adb shell unless Mi account bonded (I don't) and explicitly allowed in developer options (I can't). that's a pity I can't use scrcpy on Xiaomi.
Click to expand...
Click to collapse
I've shied away from Firesticks because of all the imposed restrictions. I didn't realize that Xiami is worse. I've been searching for an OS level workaround but not having any luck.
Renate said:
Ugh. input keyevent.
It has to spin up a Java just to do a stupid character.
Actually, I don't even know anything about sendevent
Me, I just make my own injector daemon using uinput and a pipe.
You can mod ueventd.rc to give a 660 to the pipe.
You're still stuck with the SELinux end of things.
I've been lazy. I just start the client app on the pipe, setenforce 0, kick it, setenforce 1.
I have to patch the SE policy correctly. Someday.
Ah, you do need root.
Click to expand...
Click to collapse
does the solution you describe require root?
if access is denied one can't circumvent this. there is nothing you can do. all exploits are device specific - and maybe not what you're looking for. all you can get is uid 2000 shell.
Tasker 5.9.2 beta lets you run ADB shell commands without being tethered to a PC
The latest Tasker beta update brings a new feature that allows you to run ADB shell commands without being tethered to a PC.
www.xda-developers.com
ot
@Renate there is a blog on selinux
https://dev.to/msfjarvis/understanding-and-resolving-selinux-denials-on-android-2588
https://gist.github.com/msfjarvis/ec52b48eb2df1688b7cbe32bcd39ee5f
Since there is no way to sidestep the permission issue, is there any way that keyvents can be executed programmatically on the device itself? I'd like to figure out a way to simulate longpress keyevents.
I have a HTC Desire 650 running android 6 and I am trying to root it and also keep the original recovery.
I have found this thread: https://forum.xda-developers.com/t/root-htc-desire-650.3713325/ and apparently someone built a twrp for it. Doesn't that need a root in the first place to extract the kernel source?
Anyway, are there any apps or known vulnerabilities that would allow me to root the phone or at least extract the recovery image?
The problem is that I couldn't find any stock rom images or anything else for this phone. I was only able to unlock the bootloader.
Dan Ti said:
I have a HTC Desire 650 running android 6 and I am trying to root it and also keep the original recovery.
I have found this thread: https://forum.xda-developers.com/t/root-htc-desire-650.3713325/ and apparently someone built a twrp for it. Doesn't that need a root in the first place to extract the kernel source?
Anyway, are there any apps or known vulnerabilities that would allow me to root the phone or at least extract the recovery image?
The problem is that I couldn't find any stock rom images or anything else for this phone. I was only able to unlock the bootloader.
Click to expand...
Click to collapse
Hello and good morning, @Dan Ti
Prior to your next posting please read the guidances that are stuck on top of every forum like
Note: Questions go in Q&A Forum
If you are posting a Question Thread post it in the Q&A forum. Technical discussion of Android development and hacking. No noobs, please. Device-specific releases should go under the appropriate device forum...
forum.xda-developers.com
and the others. I've moved your thread to Android Q&A.
Thanks for your cooperation!
Regards
Oswald Boelcke
Senior Moderator
Only to clarify things:
1. Recovery is a small and independent operating system that is set up in its own partition in many Android smartphones and tablets.
The "Recovery mode" is useful for you if you want to access the Android system of your smartphone or tablet beyond the conventional settings.
Since the recovery system is on its own partition next to the actual operating system and is thus intact even after a virus attack, it is often used for system repair.
2. Android's bootloader is a program that is responsible forbooting Android device.
3. Rooting is how you get complete access to everything in the Android OS, and those elevated permissions allow you to change it all. Root, at least the way I'm understanding it, is the superuser.
When you root your Android, you're simply adding a standard Linux function that was removed by OEM. A small file called su is placed in the system and given permissions so that another user can run it. It stands for Switch User, and if you run the file without any other parameters, it switches your credentials and permissions from a normal user to that of the superuser. You are then in complete control and can add anything, remove anything, and access functions on your phone or tablet that you couldn't reach before. This is pretty important and something you should think about before you begin.
To root Android OS it's neither necessary to unlock devices bootloader nor to install TWRP: this is an obviously not eradicable old nurse's tale!