Showing posts with label computers. Show all posts
Showing posts with label computers. Show all posts

Wednesday, May 25, 2016

Android: WiFi ADB



It's great being able to debug code on a real live Android device. Typically, though, your device needs to be tethered to your host computer. Now ADB has a facility to connect wirelessly, so you can debug code on your device without a physical connection to it. To do this, you need to know the IP address of the device, and follow these steps:
  1. Connect the device to your computer via USB; make sure ADB can see it (ie, make sure it shows up in the command 'adb devices').
  2. Enter the command 'adb tcpip 5037'
  3. Enter the command 'adb connect <ip address>:5037'
You're now free to disconnect your device. Go ahead and disconnect the device, and you'll still see it in the response to 'adb devices', and you can use all the other adb commands as well (shell, push/pull, etc).

Here's a Ruby script that'll do all this for you:

wifiadb.rb
# get the IP address of the device
if ARGV.length == 0
port = 5037
print "PORT not specified: defaulting to 5037\n"
else
port = ARGV[0]
end
wlan0 = `adb shell netcfg | find /i "wlan0"`[/(\d{1,3}\.){3}\d{1,3}/]
printf "The device's IP address is " + wlan0 + "\n"
system("adb tcpip " + port.to_s)
system("adb connect " + wlan0 + ":" + port.to_s)


Now all you need to do is run wifiadb.rb. It'll figure out your device's IP address and run the necessary commands.

For more information:
Android Debug Bridge: https://developer.android.com/studio/command-line/adb.html
Ruby: https://www.ruby-lang.org/en/

Monday, August 13, 2012

Adobe Flash Woes

My wife's computer recently started giving her grief. The browser had started to report that "the plugin could not be loaded" on Flash-using sites (ie, Facebook, and most of our 8-year-old daughter's play sites). It is a somewhat elderly machine (AMD Athlon XP 2600+), but it had been running Ubuntu 10.04 LTS (Lynx) nicely for quite some time. I've used Firefox for years, and that was the browser running on that machine too.

I had heard said that Adobe was no longer going to provide Flash for Linux (outside of Chrome), and so I thought I'd try two Flash alternatives: Lightspark and Gnash. The very nice Flash-Aid Firefox plugin made this attempt very straightfoward. However, although the plugins loaded and reported their version numbers to Adobe's test site (http://www.adobe.com/software/flash/about), Facebook said I needed to upgrade the plugin. So the latest Adobe plugin didn't work, and the alternatives worked, but they were too far back.

Let's try a new browser. I read that Google Chrome had "integrated" Flash support, so I thought I could just download and go. So I downloaded Chrome, but the flash plugin still would not run.

Sigh. I suppose it's time to upgrade the OS. I had gotten out of the habit of upgrading that particular machine because,

1. If it ain't broke don't fix it,
2. I had had a pretty messy upgrade experience once with that particular machine.
3. And now that I was several revs back, I'd have to step through each new version to get up-to-date.

So after each version upgrade, I'd try Firefox and Chrome (and Chromium too) to see whether Flash sites would load. 10.10 -- Nope. 11.04 -- Nope. 11.10 -- Nope.

I started to wonder whether I had some kind of incompatibility with my card (an old nVidia GeForce 5200 [I told you this machine was old]) and Flash. I saw references to weird behavior (like the Smurf effect), but none of the fixes for those issues addressed the problem I was having.

In one of the debian forums, there's a thread titled "New Bug: Google Chrome - Couldn't initliaze plug-in" The originator was describing something very similar to what I'm experiencing. The hero of that post asked whether his CPU supported SSE2 instructions. Sure enough

cat /proc/cpuinfo | grep flags 

 implied that my CPU doesn't. The poster also said he thought the 11.1.102.63 didn't have the problem which was affecting the latest version. I downloaded the archive, pulled out libflashplayer.so, and put it into /opt/google/chrome/plugins.

That solved the problem!