Sunday, November 25, 2012

RenderMode = direct required for camera in Adobe Air Android

I'll go over this one in reverse order to get the most relevant information in front of ya'll's eyeballs as fast as possible. (Oh yes I did just use a double contraction there.)

The Solution

When you want to get a raw, realtime image feed from the device camera in an Adobe AIR application on Android, you have to set the "renderMode" property in the app xml file to "direct" in order for it to work *at all*.

The Problem

If you don't set the renderMode property as such, when you are displaying the live camera image in your AIR app, you'll see something like this:
The gobbledeegook here has nothing to do with a turkey.

Just to be clear, I'm talking about the <renderMode>{someValue}</renderMode> node, which is a child of the <initialWindow> node in the AIR app xml file. To get things to work, "{someValue}" needs to be "direct."

As far as I can tell, I've come across this oh-so interesting behavior within a perfectly normal AIR application that I am running/developing/testing on my Android phone. These are the details on my app:
  • A Flex mobile app, running with installed AIR 3.5.
  • All UI layouts are in mxml.
  • In the code, the Camera/Video object instances are ending up added as a child to a <mx:UIComponent />.
  • My development device is a Galaxy S2 running Android 4.0.
Like I say, nothing too exotic going on there; seems like things should just work. I obviously had to go hunting when I first encountered this issue, but unfortunately I can't remember where I stumbled upon the idea to mess with the renderMode property. I'm aware it's possible this is specific to my device, version, etc. of Android.

But, Hopefully this will help someone out there!

Sunday, November 11, 2012

Gettin' wifi to work on my Raspberry Pi

Lately I've been geeking out with my Rapsberry Pi, which I've had for about a month now. I've now got all the accessories that I think I'm gonna need for it. Check out the setup:

Good fun for all nerds in the land
My most recent addition was a wifi dongle. I got a dongle with the Ralink 5370 chipset in it, which seems to be pretty popular in Raspberry Pi land. This is the adapter I got and the site where I purchased:

Ralink 5730 Dongle on

(Word to the wise though, it took 3 weeks for my order to get to me. Shipping costs were free, but that was a tough wait. You might want to pay to speed shipping up or find another dongle from another site.)

I didn't know what it would be like to get the dongle working, but as it turns out, it's very easy. Here's some notes on my experiences:
  • As it turns out, if you've burned your Pi distro image anytime probably within the last 6 months or sooner, you've got more or less what you need to get the Ralink and probably many other chipsets working.
  • This post had the info I needed to get things working:
  • In short, you can remove anything related to "wlan0" and just put in what is in step 8 of that post. 
  • But! know what type of encryption you have on your wifi router. After logging in to my router I found out it was WPA-PSK, and the lines related to "wireless-*****" were not relevant. Al posted the way to modify the interfaces file - remove the "wireless-*****" lines and instead put:

    wpa-ssid <yourssid>
    wpa-psk <yourkey>

    Which means that only 4 lines are required in the interfaces file to get the dongle working.
  • I use a Logitech wireless keyboard when I'm directly working on the Pi; you can sort of see its little dongle in the bottom USB port in my picture. Interestingly, when I had both the wifi dongle and keyboard dongle in the standard Pi USB ports, the keyboard wouldn't work. I'm thinking the wifi radio signal was drowning out the keyboard signal. Moving the wifi dongle over to the small hub I've got made things work.
And with that, my Pi is now happily connecting to the internet, at least when in terminal mode. I can ssh to it and everything. Best of luck as you attempt to get wifi working on your Pi!