Automatically sending ALT Commands - Other Tools & General Discussion

Heya
I'm trying to develop my first android/arduino app.
I've read some tutorials and stuff like that, however I am stuck in a little hurdle and maybe one of you smart fellas can help me here, I believe this is the right forum.
I've searched for other similar topics but I couldnt find something close enough to answer my question.
Here's the problem:
I have a device connected to an Arduino, which is connected to a bluetooth adapter, I have been able to successfully connect it to my PC, open up PuttY and do all the sh-bang things this thing can do. Basically it outputs resistance values over and over with a line break in between, so it looks like:
10000
9999
10001
10234
10235
9323
and so forth, assuming the resistance is oscillating around 10k.
However, to begin the resistance reading I have to first send a few commands via PuttY:
ALT + 231 Initializes the resistance reader
ALT + 202 recognizes if resistors are connected
ALT + 208 return a single read off the resistance
and there's a few other ALT commands that I don't really use ,but I have the list to use them. However, I dont know how to send these commands via an Android App.
How can I tell the android app:
"Hey android app, as soon as you pair up with this device, send these ALT + xxx commands to start getting readings, and then you can display the readings on the phone screen!"
??
Any help will be greatly appreciated!
Thank you!

Related

Howto: Android G1 Serial cable

Hey folks. I put some instructions up that state how to make a G1 Serial to USB adapter. This could be handy for kernel hackers and could be modified too for other purposes which I plan to explore...
http://www.instructables.com/id/Android_G1_Serial_Cable/
Enjoy, and please leave comments on the instructables website if you see something wrong or confusing!
CMOS vs TTL levels can mean the difference between a functional device and a dead UART.
anyone know if it's actually 5v tolerant or does in fact require CMOS voltage level?
I can tell you the G1's pins output 2.8v. I think I would stick close to that. The only reason I used the 3.3v cable is because I have seen pictures of a cable an actual android dev has allegedly used 3.3v levels.
Did you find the instructions confusing since I claimed CMOS-TTL? I actually switched it to just say 2.8v levels now to be safe. I guess saying TTL was a bad word choice since it can go up to 5v although I do specify you need a 2.8 or 3.3v serial to usb adapter in the required materials section.
Nice.
Next step is to disconnect the console and allow control of rs232 devices from the phone.
Working on it You need to disable H2W and PIQ AFIK.
ya it was the TTL that made me second guess.
I have several TTL level uarts that will smoke CMOS level inputs. I wasn't about to try one of them unless you had said you did with no problems.
2.8 is odd, but i imagine it's still some form of low voltage MOS and can handle 3.3v without problems.
macpod said:
Working on it You need to disable H2W and PIQ AFIK.
Click to expand...
Click to collapse
Thanks for the great tutorial !
I've compiled a kernel with CONFIG_TROUT_H2W, CONFIG_MSM_FIQ_SUPPORT and CONFIG_MSM_SERIAL_DEBUGGER unset
I understand that the UART port appears as /dev/ttyMSM2, however I can't measure anything on the TX pin when sending data from the Dream, i.e :
echo "Hello" > /dev/ttyMSM2
Have you succeeded in transmitting data in any direction ?
What are you using to measure? A multimeter isn't going to work.. you would need a scope.. or serial device of compatible voltage levels able to run at the g1's baud rate.
I didn't have a build env setup on my computer and I only got everything setup/compiled last night because of the cupcake merge into master (I might post instructions on how to build everything before the march 18th merge if there is interest).. so I haven't had a chance to disable the debug console/etc and test yet. I plan to work on that tonight and tommorow.
Some interesting things I have found sofar and questions if you guys happen to be researching this stuff:
-Booted normally you get a "debug>" prompt. ps works.. but I haven't researched what other commands are possible. What have you guys found?
-With the phone powered off, if you plug the serial cable in and read it, it tells you the charging mode and some other characteristics/etc.
-The engineering spl has a serial console you can send commands to. I haven't research what commands are possible yet.. again, what have you folks found?
edit: I bet if you attached a piezoelectric speaker between the tx and gnd pins.. then piped /dev/urandom to /dev/ttyMSM2, you could test that way too.. but that's unconfirmed.
Thanks for your answer, I was measuring with a scope.
I'll try again with a default msm_defconfig'd kernel and see if I get a console.
Looking forward to hearing of your tests !
macpod said:
-The engineering spl has a serial console you can send commands to. I haven't research what commands are possible yet.. again, what have you folks found?
Click to expand...
Click to collapse
Not only the engineering spl has that. You can use either usb or serial to talk to the interface. What is more interesting : Serial lets you talk to the radio directly (oemsbl) and outputs debug info. Access to all commands is only given using engineering spl and security unlocked device. The commands however are already in the wiki.
macpod said:
edit: I bet if you attached a piezoelectric speaker between the tx and gnd pins.. then piped /dev/urandom to /dev/ttyMSM2, you could test that way too.. but that's unconfirmed.
Click to expand...
Click to collapse
Totally confirmed. Sounds just like a good old modem
Cya,
Viper BJK
Ok, taxes put me on hold.. but I'm back and have it working. Here is the config file I used to compile the kernel.
Speed is set to 9600 8N1, the G1 serial device is /dev/ttyMSM2. If you were curious, /dev/ttyMSM0 is bluetooth related.
I'll post up instructions later on how to compile and install it as well as a boot.img for convenience if folks are interested.
macpod said:
Ok, taxes put me on hold.. but I'm back and have it working. Here is the config file I used to compile the kernel.
Speed is set to 9600 8N1, the G1 serial device is /dev/ttyMSM2. If you were curious, /dev/ttyMSM0 is bluetooth related.
I'll post up instructions later on how to compile and install it as well as a boot.img for convenience if folks are interested.
Click to expand...
Click to collapse
Great, thanks a lot for all your contributions! I am looking forward to your instructions.
Hi all xda users ,
Thank you for your work macpod.
I am looking forward to your instructions also.
TIA
regards,
Maciej
I would love to get a boot.img as well, I'm not very skilled with all that and only want the serial console to interface the G1 with my Arduino.
Just ordered the parts for this. Thanks.
Okay, I got it working! Instructions are for Ubuntu only, sorry. I believe you need a rooted phone with engineering (or hardspl or comparable fastboot-enabled) bootloader and macpods serial to usb cable (or something comparable).
1) Compile Android source with Dream-specifics as described by this. You probably only need prebuilt and kernel, but I'm not very familiar with git and just got everything.
2) cd into the kernel directory, copy macpods serial9600config from above as .config there
3) "make ARCH=arm CROSS_COMPILE=../prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin/arm-eabi- oldconfig" I don't remember if this asks for anything at all, if it does, go with the suggested answers
4) "make ARCH=arm CROSS_COMPILE=../prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin/arm-eabi-" - You now have a kernel image for Android 1.0 (I think), but for me it works with JFv1.51 as well
5) You can now compile fastboot in $ANDROIDSOURCE/system/core/fastboot or grab the precompiled binary from http://android-dls.com/files/linux/fastboot
6) Hook up your phone, power off, start with camera+power. Press back when the skating androids appear to switch to fastboot mode.
6) Do ./fastboot boot $ANDROIDSOURCE/kernel/arch/arm/boot/zImage and wait. This takes a moment, then it should start.
You know should have /dev/ttyMSM2 which you can echo into (echo "hello world" > /dev/ttyMSM2) or listen to (cat /dev/ttyMSM2). For instance, I'm building an Android app that passes GPS coordinates over the console to an ArduPilot board and will provide telemetry to a ground station. Testing it with "Serial port terminal" from the Ubuntu repository works as well (remember to choose 9600 bauds and the right port).
Thanks to to macpod for his excellent work and help with building the cable, Google for providing such a kick-ass (somewhat) open phone and all the kernel hackers and rooters for their work.
I just wrote this from the top of my head, just post if you have trouble getting this to work.
edit: I attached my kernel image, which should allow you to skip steps 1 - 4 if you're so inclined.
do you guys think this will help all the bricked devices? just a question i don't have a bricked device to test but would be nice if did
So let me get this straight? The cable allows direct access to the motherboard and all the hard were in it? Sorry i am a complete noob
Well, I don't know nothing about bricked devices, but if you can still get them into fastboot mode, you can flash every partition on the phone, so you should be able to resurrect it.
The cable normally allows you access to a debug console (you see kernel outputs while booting, then get a console). I don't know what that is for (maybe USB debugging for developing apps, dunno. I read somewhere that you can directly access the GSM chip, issue AT commands and the like). You'd need to look into that. And with a custom kernel you get a regular serial console trough that extended USB port on your phone, just like telnet'ing into your phone or whatever. Normal unix stuff. And this console can be accessed from Android apps as well.
do we know what config options/boot options should be used, so we can receive the kernel output while it loads from serial?

Google TV hack!

Greetings Programs!
I have found the recovery menu for Sony's Google TV/BluRay player!
Here are the details on how to access it (from my original post here: androidforums.[COM]/google-tv/201827-sony-google-tv-hack.html)
OK... so I found out how to get into recovery mode on the Sony Google TV/BluRay player that was released yesterday.
1.Have everything plugged into the unit except the power coord. Have the power coord in your hand.
2.Press and hold the power button and plug the unit in.
3.Continue to hold down the power button for 3 seconds after plugging it in, then release the power button.
4.Wait a couple of seconds and it will say Sony, then you will see the recovery screen.
5.After it loads, press and hold the connect button on the unit. Then follow the directions at the bottom of the screen (Press and hold ALT+ENTER) for 8 seconds/until the bottom message changes. It will change back to it saying that you have to press the CONNECT button, but your remote IS connected.
6.You can now press the numbers assigned to the commands!
WARNING: This could possibly brick your unit and could possibly void your warranty. I am not responsible for anything that happens to your device.
I am going to work on trying to find working drivers and I am going to try to use the Android SDK Tools to install some applications, or at the least try to execute some shell commands. Hopefully we can root it!
Click to expand...
Click to collapse
Lets start hacking!
awesome, I will have to keep my eye on this. google TV plus angry birds would be awesome.
Looking forward to seeing this thing cracked! I'm hoping someone will be able to get a USB tuner to work on one, so those without cable or satellite will be able to get TV content without the hassle of another set-top box.
Nice.... Wonder what the possibilities are
Sent from my PC36100 using XDA App
OK Guys, I am still working on it. Heres a video of me booting it into the recovery mode.
http://www.youtube.com/watch?v=L21guovXDsc
Thanks for the information about recovery, I tried it, and was able to get into recovery. I tried writing the logfile to USB, and it "seemed" to work, but after mounting the USB stick on my linux machine, I didn't see any files there.
I bought the Sony NSZ-GT1 so I could port my Android app Better Terminal Emulator Pro onto Google TV. I already ported it to Android-x86 in preparation for this, but seems like I could not ADB into the Google TV over Ethernet. Frustrated, I decided to take a screwdriver to my Google TV, and did a "teardown" as a result. You can see what the guts look like here:
http://www.magicandroidapps.com/wiki//index.php?title=Main_Page#Sony_NSZ-GT1_Google_TV_Teardown
Sorry the pictures are not that great, I used my Moto Droid to take them, and the lighting was terrible.
-Howard
hharte said:
Thanks for the information about recovery, I tried it, and was able to get into recovery. I tried writing the logfile to USB, and it "seemed" to work, but after mounting the USB stick on my linux machine, I didn't see any files there.
I bought the Sony NSZ-GT1 so I could port my Android app Better Terminal Emulator Pro onto Google TV. I already ported it to Android-x86 in preparation for this, but seems like I could not ADB into the Google TV over Ethernet. Frustrated, I decided to take a screwdriver to my Google TV, and did a "teardown" as a result. You can see what the guts look like here:
magicandroidapps.com
Sorry the pictures are not that great, I used my Moto Droid to take them, and the lighting was terrible.
-Howard
Click to expand...
Click to collapse
ETHERNET? Hasnt anyone tried USB A to USB A cable? I've been busy all day. Gonna go get one tomorrow and figure it out for myself I guess. Can't stand that they have ALREADY corrected the hulu fix for the thing. Why shouldn't I be able to access my paid July plus account? Oh well.
Try USB a to USB a!!!!!
USB A to A will definitely not work. All of the USB ports are connected through internal SMSC 4-port hubs. There are two hubs in the unit, one in the back with 3 ports going to external connectors, and one going to the WLAN module. Up front there is another 4-port hub going to the front USB connector, and presumably to a BT module, but I didn't take mine far enough apart to be sure.
There is one large connector over near the CPU that might have some debug stuff on it.There are also about three 4-pin connectors populated, one of which might be a UART. There is also a footprint for another. Tomorrow I'll get my oscilloscope out and see if any of those pins wiggle on boot.
-Howard
hharte said:
USB A to A will definitely not work. All of the USB ports are connected through internal SMSC 4-port hubs. There are two hubs in the unit, one in the back with 3 ports going to external connectors, and one going to the WLAN module. Up front there is another 4-port hub going to the front USB connector, and presumably to a BT module, but I didn't take mine far enough apart to be sure.
There is one large connector over near the CPU that might have some debug stuff on it.There are also about three 4-pin connectors populated, one of which might be a UART. There is also a footprint for another. Tomorrow I'll get my oscilloscope out and see if any of those pins wiggle on boot.
-Howard
Click to expand...
Click to collapse
Yeah, the big long/wide plug. I was looking at the inside of my box too. First day jitters. Anyway, I was also going to start looking for a serial port connection through one of those ports. Good luck and post right away if you find something!
If somene with an ethernet sniffer who has not booted their box yet can catch a sniff of the update download, it might be possible to get the update.zip URL, then we could try hacking the update and install it via recovery. This method was very popular with Android devices... but there you could get the update URL from the logcat
-Howard.
Have we not figured out how to use log copy? It doesn't seem to like anything i plugged in to copy to...
Sent from my PC36100 using XDA App
Great job guys! My friend is going to be getting a GTV later this week, and I will try to get it from him before he boots it up. Guess I will stop trying USB A to USB A.
Will post results later tonight.
Another possibility is to try and find the kernel source. If you look in Settings, system Information, Open Source Licenses, there is a site on Google Code that is supposed to contain the GPL'd components:
http://code.google.com/p/googletv-mirrored-source/
Going there doesn't show much except one user space component, and a link to a Sony mirror site:
http://products.sel.sony.com/opensource/
I couldn't find anything useful on the Sony site, but maybe someone else will have better luck.
I'll also try plugging in a USB Serial adapter, but my expectations are pretty low that I'd be able to get a console from that. It's interesting that there are so many USB ports on the Google TV. I wonder what other USB peripherals might be supported? I can see the front port being used for a USB memory stick, and maybe one on the back for a camera, but that still leaves two unused ports. Any idea what Sony/Google might have intended them for?
-Howard
http://www.magicandroidapps.com - Home of Better Terminal Emulator Pro
hmm
I have this unit and usb keyboards and mice do work . Also iremember a rep saying the logitech cam would work with the sony blu-ray also. I think you would need to wait for the android store to open though for an app that uses it.
hharte said:
I couldn't find anything useful on the Sony site, but maybe someone else will have better luck.
Click to expand...
Click to collapse
Did you look here : sony.net/Products/Linux/TV/NSZ-GT1.html
That looks like it, thanks! Nice that they have minicom and busybox listed there, so there is hope that some hacking tools are preloaded on the Google TV.
-Howard
Not sure if this helps anyone or not, but i ran a port scan on my box and there are 2 ports 9551 and 9552 that are accepting TCP connections.
nmap -p - <IP address of NSZ-GT1>
result :
PORT STATE SERVICE
9551/tcp open unknown
9552/tcp open unknown
I tried to get ADB to connect to those ports but did not work.
Steps that I tried :
1) export ADBHOST=<IP address of my PC>
2) adb kill-server
3) adb devices
No ADB devices were returned
4) adb connect <IP address of Sony NSZ-GT1>:9551
5) adb shell
Got error "error: device offline"
6) repeat steps 4 and 5 except with port 9552 and got same result
I am no expert in any of this stuff so the above might just be sending someone down a rabbit hole but I figured I might share in case it might be helpful to some of the smarter people on here.
Try "adb devices" and see if it show anything.
I looked at the kernel from the Sony site:
http://www.sony.net/Products/Linux/TV/NSZ-GT1.html
Here are some findings:
Linux kernel version: 2.6.23.18_nl-btv
Kernel config:
arch/i386/configs/btv_defconfig
CONFIG_USB_SMSC9500=m
Note the SMSC 9500 USB/Ethernet is one of only two loadable modules in the kernel config. Maybe this has some significance, like maybe they use a second Ethernet port for development.
-Howard
Very interesting.... I am thinking of getting a second unit to try to intercept the update.zip.... would anyone be able to tell me how I would do this?

[Q] Simple RxTx Communication from Android (How to?)

Hey everyone, small question about how to do serial communication (send/receive basic commands) between android and a microcontroller.
Basically trying to do some simple RxTx serial communication from my Galaxy S, simply send/receive hexadecimal commands.
After some pretty intense googling, it seems the more likely option for serial communication would be over bluetooth, as apparently using the single external COM port will involve a lot of custom code/hacking/drivers. Plan on creating hopefully a simple program.
Wondering if anyone is aware of any custom applications that allow me to do simple send/receive commands over BT? or even the COM port...
Overall my project will be to read the water temperature of my car from my ECU (over the consult port), which involves sending simple hexadecimal commands to the ECU, getting a response and converting the response to a decimal number, which i intend to display on my phone so i can monitor the water temp (will get the value to constantly update). So my main hurdle is getting Android to communicate to the consult port. Initially would have plugged the phone directly to the consult port, but using a bluetooth connection will be equivalent at the end of the day.
Thanks, any help is appreciated!
Josh.
Any help appreciated. Thanks

[Q] Infrared Pen + Wiimote + Android + HDMI

Infrared Pen + Wiimote + Android + HDMI = Touchscreen Anywhere
i've had this idea for a while and was trying to see if i could make it happen on my own. sadly i've not much to show for it, so i'm here now to see if there is any way to progress this.
how i hope this would work:
Aim the wiimote at a tv/monitor that your android phone is plugged into via hdmi. The Wiimote picks up the Infrared Pen, sends the data to the phone app, then interprets it as touch interaction, which gets displayed on a monitor/tv over hdmi.
i thought i read somewhere that the phone might not be able to handle the infrared data stream. i certainly hope it can, otherwise this idea is sunk.
This wiimote whiteboard application (http://www.uweschmidt.org/wiimote-whiteboard) is written in java. if i were in anyway a decent programmer i'd have attempted this already. just wondering if anyone has any incite to whether or not this is possible.
any tips or leads will be greatly appreciated.
i bump therefore i am.
old topic but im very interested in this.

lynec c2 2.4ghz remote help

I have a lynec c2 is there any way to access the remote itself via usb dongle on a pc or a usb connected directly to the remote to remap keys. The problem with this remote is there is no long press on this remote except for the enter key so when u hold down the directional keys it basically moves like you are slowly tapping the button which is really useless when scrolling or playing games if anyone knows how to help i would be really great full been trying to find something to help on google over a week now with no help i cant even find an email address for lynec to inform them of nonsense they did with this remote this is the first remote I've ever seen doing this if i only knew i would never buy this

Categories

Resources