Sending Android Keyevents via Leonardo Arduino - Android General

I hope I am posting this to the right forum, if not, can someone point me to a more appropriate one.
I am trying to send keyevent commands from my Leonardo Arduino to my Android tablet, part of a head unit. I can send the commands via ADB shell on my laptop, but I cannot figure out how to send them via the arduino.
I have been looking for weeks on how to do this, I have gotten some close hits (http://www.instructables.com/id/USB-Pedal-HID-Keyboard-With-Arduino-Leonardo/) but they are in the area of sending the standard ASCII keyboard codes, and I am looking to send screen diming/brighten and sleep/wake.
Has anyone had experience in this area?
Thanks,
-Erik

I have noticed that I can execute an "input keyevent" in a serial terminal via a USB keyboard, but the instruction is just ignored, no errors, and if I just type "input" it gives me the usage method so I know it is there. Does the Android need to be rooted to execute the command, or is it a permission issue?
Thanks,
-Erik

Related

GoodLink Debugging info

Howdy all,
I was talking with some internal Goodlink support people yesterday and they forwarded me a list of debugging commands for their app that can be run to troubleshoot and fix some issues with GoodLink. To use these commands you have to be in the GoodLink app, then press the <Shift> key and then type debug this will bring up a command prompt where you can input the commands from the list. If this has been posted before my apologies but as an IT Support guy this came in very handy to me and I wanted to share it. This works with any GoodLink installation on any device.

Trying To Register Without a Data Plan (apparently) But...

I need to know more about ADB I guess, like how to get it to stay open when I double click the app if thats even how I open it. Instead the window keeps closing as soon as it opens.
My friend (the one who owns this forum account) just downgraded my G1 from RC33 to 29 and now its asking me to sign in but I can't. Apparently my girlfriend can't either on her phone and we didn't do anything with hers but I just signed her in through wifi since it wasn't on the setup screen like mine was. I on the otherhand am stuck at the beginning and need a way to get around it, I don't know why we lost the data plan we had all of a sudden but I'm not going to bother with that and instead will keep moving forward with an alternative.
I'm completely noob to all things command promp so I don't know what an SDK is, just found out what the ADB is and dled that and the drivers but can't start anything up as of yet. I know my android is at RC29 because of the reboot test on the how to bypass the registration thread.
EDIT: Lmfao I guess I picked a bad time to modify my G1, at the time of this post there is a global outage of T-mobile's internet, everything west of the mississippi river is out so thats why I couldn't sign in before, if this thread gets locked or ignored then its ok, I can just wait it out, but just goes to show murphy's law is the real deal, the day I decide to finally start editing stuff this happens.
I'm not really an expert and I had to learn as I went, but here's how I went through the same problem.
Basically, you don't run ADB as a normal program, you open a command prompt (for vista and xp go to run and type cmd) and then you have to navigate to the folder that ADB is in, so if you have the SDK on your desktop youd type something like
"cd c:\users\yourusername\desktop\SDK\tools" (for vista)
yours will probably differ, but use "cd" to navigate to the folder ADB is in. Then assuming you have your phone and the drivers setup properly, when you're navigated to that folder you can type commands that start with adb or whatever and they should work.
If that doesn't work then your phone may not be setup properly, in which case you need to follow the steps in the registering without a data plan thread, although I had a sim so I skipped the disabling of the insert sim screen. The rest is fairly simple, assuming you've got past the insert sim screen somehow you need to type on your phone
<enter>setprop persist.service.adb.enable 1<enter>
I did this in the email box of the signup so you can actually see what you've typed because you won't know if it's worked until you actually try it. After that again type
<enter>telnetd<enter>
which will allow you to get root access to the phone temporarily, then we connect to your phone from your computer.
In a command prompt on your computer do what I said up top by navigating to the folder ADB is in (c:\users\yourname\desktop\sdk\tools or whatever depending on which version of windows you're on and where the SDK is) and type
adb shell
this will probably say the daemon is not currently running, start the daemon etc.... this is good. If it then gives you a hash (#) at the start of the line you are now accessing your phone from your computer. If not, type
adb devices
and see if it gives you anything under where it says "List of devices attached" in the command prompt. If not it's not recognising your phone so you need to get it to do that first.
Last step when you have this, on your computer type
am start -a android.intent.action.MAIN -n com.android.settings/.Settings
which should bring up the page on your phone to enable and manage wifi connections... Connect to your wifi like normal, check it says connected on the settings page and press back and you can register over your wifi.
Hope this helps, I'm no pro but this is how I did it and it worked fine.

Are there any wpctsc.exe command line switches?

Hi there,
at the moment I try to develop an application that connects to a server with just one click on a button.
I therefore want to use the built-in wpctsc.exe.
Are there any command line switches that I can use to connect directly, without clicking on "Connect" in the wpctsc mask again.
Maybe something like "wpctsc.exe /s profilename" or "wpctsc.exe /IP/port / username / password", etc.
I tried to search with google, but couldn't find any stuff regarding my problem.
Same problem here, anyone knows the trick?

Setting up ADB on macbook

I've been trying to setup ADB on my Mac book and followed a tutorial but after typing "ADB devices" it says devices connected and then no serial number as it is supposed to. I'm wondering if anyone had this problem with their thunderbolt? Here is the tutorial it used:
http://esausilva.com/2010/10/02/how-to-set-up-adb-android-debug-bridge-in-mac-osx
Any help would be appreciated.
Sent from my Thunderbolt
Does this at least mean that the thunderbolt is not connected?
Sent from my Thunderbolt
Double check USB Debugging is on.
It works just fine on my iMac. Though the way I have it set up, I have to type "./adb devices"
Have you tried doing anything past there? See if any other commands actually work. Try to install something, or read the log.
Just in case someone comes to is problem i've found the answer. I have the Easythether app installed and the driver for it conflicts with allowing adb and your computer to connect with your phone. The solution is pretty simple you have to either disable the driver on the mac everyone you want to debug or remove it altogether. Here is a page explaining the process.
http://stackoverflow.com/questions/...and-adb-devices-fails-to-list-android-devices
Sent from my Thunderbolt

Obtain MSL code on Linux/Unix

How to find the MSL for your Photon Q
chrisngrod posted a tool for getting the MSL from logcat (http://forum.xda-developers.com/showthread.php?p=31765156) but is in the form of a .bat script, which isn't very useful for Mac or Linux users. I'm a decently regular reader, but I guess I've never posted. So sorry that this isn't in the dev section.
I'm assuming a couple things here
You have the android SDK installed, or at least adb available to you
You have a Motorola Photon Q (on Sprint?) plugged into your computer and appropriate drivers installed (if needed--not sure)
USB Debugging is enabled on your device
You know what a terminal is, or at least how to use one
You are in the current directory of adb. If it's in your path, omit the "./"
Make sure your computer sees your phone
Code:
./adb devices
You should see something like
Code:
List of devices attached
T*******Y device
where *'s are numbers. If you don't see any devices, make sure nothing else is interfering (tethering apps on computer, etc)
Now, go to the dialer on your phone, and dial ##DATA#. A menu should pop up, tap on Data Profile, then the three dots at the top right, and finally Edit. Enter 6 random digits, and click Verify.
Now go back to your computer and run this
Code:
./adb logcat -b radio -d | grep "grde"
Hopefully you'll only see one line. If there's more than one, look for one that looks like this
Code:
09-21 21:56:38.837 360 360 E RIL-MOTEXT: NV Read 32, length 6, data length 6, grde - 313934333230
The last set of numbers is what we care about. Your MSL is encoded in the even digits (in counting i.e. 2, 4 ,6 ,8 ..). Mine happened to be hidden in some 3's. So this phone's MSL is 194320.
Test it out by going back to your phone and typing it in.
This worked for me, and I haven't found anywhere else that talked about doing it for the Photon Q, so please correct any incorrect information.
asinginglamp said:
How to find the MSL for your Photon Q
Now go back to your computer and run this
Code:
./adb logcat -b radio -d
Hopefully you'll only see one line. If there's more than one, look for one that looks like this
Code:
09-21 21:56:38.837 360 360 E RIL-MOTEXT: NV Read 32, length 6, data length 6, grde - 313934333230
The last set of numbers is what we care about. Your MSL is encoded in the even digits (in counting i.e. 2, 4 ,6 ,8 ..). Mine happened to be hidden in some 3's. So this phone's MSL is 194320.
Click to expand...
Click to collapse
I was able to do this with only the phone and connectbot. Putting in a false code and then looking over logcat for the NV Read 32, Mine was also hanging out with a group of 3s.
KitsunePaws said:
I was able to do this with only the phone and connectbot. Putting in a false code and then looking over logcat for the NV Read 32, Mine was also hanging out with a group of 3s.
Click to expand...
Click to collapse
Nice. I tried doing it with aLogcat, but didn't see anything. Didn't think to try connectBot.
with me it was between the 3's, i copied the msl.bat to the ADB-platform tools folder what i use for compiling-decompiling apk's, and it worked.
This Is Cray
Gojira-r32 said:
with me it was between the 3's, i copied the msl.bat to the ADB-platform tools folder what i use for compiling-decompiling apk's, and it worked.
Click to expand...
Click to collapse
err
i tried this method the only thing i see on the transcript using adb logcat is checksubsidylockpasswrdcomplete<>errorno=RIL_OEM_CDMA_GENERIC_FAILURE..
Like ive tried everything, any suggestions..besides call sprint
batzluminatti said:
err
i tried this method the only thing i see on the transcript using adb logcat is checksubsidylockpasswrdcomplete<>errorno=RIL_OEM_CDMA_GENERIC_FAILURE..
Like ive tried everything, any suggestions..besides call sprint
Click to expand...
Click to collapse
Do you get anything with adb logcat?
???
asinginglamp said:
How to find the MSL for your Photon Q
chrisngrod posted a tool for getting the MSL from logcat (http://forum.xda-developers.com/showthread.php?p=31765156) but is in the form of a .bat script, which isn't very useful for Mac or Linux users. I'm a decently regular reader, but I guess I've never posted. So sorry that this isn't in the dev section.
I'm assuming a couple things here
You have the android SDK installed, or at least adb available to you
You have a Motorola Photon Q (on Sprint?) plugged into your computer and appropriate drivers installed (if needed--not sure)
USB Debugging is enabled on your device
You know what a terminal is, or at least how to use one
You are in the current directory of adb. If it's in your path, omit the "./"
Make sure your computer sees your phone
Code:
./adb devices
You should see something like
Code:
List of devices attached
T*******Y device
where *'s are numbers. If you don't see any devices, make sure nothing else is interfering (tethering apps on computer, etc)
Now, go to the dialer on your phone, and dial ##DATA#. A menu should pop up, tap on Data Profile, then the three dots at the top right, and finally Edit. Enter 6 random digits, and click Verify.
Now go back to your computer and run this
Code:
./adb logcat -b radio -d | grep "grde"
Hopefully you'll only see one line. If there's more than one, look for one that looks like this
Code:
09-21 21:56:38.837 360 360 E RIL-MOTEXT: NV Read 32, length 6, data length 6, grde - 313934333230
The last set of numbers is what we care about. Your MSL is encoded in the even digits (in counting i.e. 2, 4 ,6 ,8 ..). Mine happened to be hidden in some 3's. So this phone's MSL is 194320.
Test it out by going back to your phone and typing it in.
This worked for me, and I haven't found anywhere else that talked about doing it for the Photon Q, so please correct any incorrect information.
Click to expand...
Click to collapse
The first command works..Recognizes dev, then the logcat command works ONLY when i leave off at the -d. When i do the process i see the RI-MOTEXTem Hook header type 0, requestcode 0x2000016...blah blah blah..how do i write the second part of the comand..?
msl
I ran into that error- OEMRequestunlock thingy.... I tried looking through myself with alogcat, but nothing... at the time I thought I fixed it by downgrading the android OS... then the .bat still didn't work... I figured out that that was because of the path statement not including the location of findstr.exe (grep in this linux example) but now I think that maybe the .bat file didn't work originally because of the path statement and I maybe didn't have to downgrade the OS, but if you're straight up doing it by typing the command into terminal and with grep no less and encountering the problem, then I'll bet it was necessary to downgrade the OS.
So what I'm saying is- you probably have to downgrade the Android OS to one that has the MSL in the ril. Also, it might not be showing up in aLogcat because you'd have to tell it to read the radio log (which is what the -radio switch does)
Hope this helps
I made one phone call to Sprint tech support and simply asked for my MSL, and the lady gave it to me. No questions asked.

Categories

Resources