11/05/2012

Jelly Bean Leak for Verizon's Samsung Galaxy S III

Jelly Bean Leak for Verizon's Samsung Galaxy S III

On November 3rd, 2012, I saw that there was a Jelly Bean leak for Verizon's Samsung Galaxy S III published at the XDA Developer Verizon Galaxy S III Android Development Forum. I was so excited to try it, that I even downloaded the 800+ MB file from the [ROM][JB] - Stock Root De-Odex - I535VRBLI5 (vzw leak) thread on my battery while on a layover in Chicago O'hare. That night, after settling down a bit, I successfully installed the zip using the TeamWin's Recovery Project (installed from the GooManager app). 

Before attempting to load this custom ROM on the device, you are warned that you are voiding your warranty and face the risk of bricking your device if something goes wrong. You will need to have a Verizon Samsung Galaxy S III rooted, and have a custom recovery image installed in order to load the ROM. You will have to unlock the bootloader. You should backup the IMEI of your device, as it has been known to be corrupted upon installing custom ROMs. All of these topics are discussed in threads in the XDA Developer Verizon Galaxy S III Android Development Forum. Please read the threads carefully and backup your IMEI and current ROM to your external SD card, so everything can hopefully be restored in the event of a problem.

What's new?

Jelly Bean definitely feels faster and smoother with almost no lag noticeable. If you do a factory reset, you'll notice that new helpful tips appear more often than in Ice Cream Sandwich. I found out the hard way that performing a factory reset does erase the internal SD card, so be sure to put any of your backups on the external SD card, or copy them to your computer for safe keeping.

While Google made numerous changes in Jelly Bean, what I noticed was the following:

Notifications

The date and time are now clearly displayed at the top of the notification shade. The display brightness slider and auto checkbox are displayed below the toggles. The notifications from SMS and MMS now show the full message, if possible, and other apps show more detail than before. Now, if you press-hold, then the App Info can be displayed to take you to manage the application.

Camera

The camera now includes the following effect filters: Cold Vintage, Warm Vintage, Posterize, Solarize, Green Point, Blue Point, Red-yellow Point, Washed Out, Black and white, Sepia, and Negative. These filters are applied in real-time as the image is recorded or displayed.

The shooting mode for the camera now has an improved HDR mode and a new Low light mode, which allows for much better indoor shots.

Camcorder

The camcorder now permits video recordings to be paused, resumed, or stopped. The camcorder supports the same filters as the camera.

Pop Up Video

When playing back a video in the Video Player Pop Up, the video can be paused and re-sized up to the width of the screen in portrait mode.

Lock Screen Menu

The menu that appears when you press the power button now has a much more functional layout, particularly for switching sound modes.

Keyboard

The Swype keyboard is now the default. There is also a Samsung keyboard and Google voice typing available.

What's custom?

This ROM has a couple of notable modifications, the Google Now application instead of S Voice, and it seems to be configured to use global networks.

Conclusions

After running this leaked ROM for the last couple of days, I'm glad that I loaded it because it is more visually appealing and works faster than the stock ROM. The improved camera and camcorder make the biggest difference to me, but I also really like the expanded notifications and quick access to control the display brightness. I am quite pleased with it's stability. Only when executing Gscripts to enable Google Wallet, did I have any Activity Not Responding (ANR) issues. I was able to get the hacked version of Goggle Wallet to work, though. Also, the Extra Apps for Samsung S III installed fine.

I haven't spent too much time with it yet on the road, so I haven't had a chance to really put it's battery performance to the test, but from what little time I've not had it connected to my computer, it doesn't seem to drain very quick.

9/22/2012

iPhone 5 makes people act like Apple Zombies as Jimmy Kimmel shows

Apple Fans act like Zombies

Watch "First Look: iPhone 5 on YouTube from the Jimmy Kimmel Show
Some people are just going to think the new iPhone is the best no matter how wrong they are about the facts. Watch these people fawn over an iPhone 4S thinking it is the new iPhone 5!

But here is why the Samsung Galaxy S III is better than an iPhone 5

9/21/2012

Why the Samsung Galaxy S III is superior to the iPhone 5

Why the Samsung Galaxy S III is superior to the iPhone 5

  1. Bigger display - not only is the display bigger, but it is smarter. The front facing camera checks for your face and if it sees it, then it will not cause the display to shut off due to a timeout. Even though Apple has a slightly higher pixel per inch (PPI) density, it is imperceptible to the user unless the device is only a inch or two from the user. Only apps specifically designed for the iPhone 5 will even be able to use the full screen, and most apps will appear letter-boxed.
  2. S IIIiPhone 5
    720 x 1280640 x 1136 
    4.8 inch4.0 inch
    306 ppi326 ppi
    Full screen appsLetter-boxed apps

  3. Battery Life - batteries are easily exchanged by the user, and many options are available for purchasing them, including even larger batteries. Also, even the reported talk time on an iPhone is less, probably due to it's smaller capacity.
  4. S IIIiPhone 5
    User swappableNot user servicable
    7.98Wh5.45Wh

  5. Internal RAM - the S III (in the USA) has twice as much RAM available which allows the user to be able to have more applications loaded simultaneously in memory.
  6. S IIIiPhone 5
    2 Gb1 Gb

  7. Internal Storage - while the S III does not yet have a model with 64 Gb of internal storage available, one is planned for the future. Apple charges twice as much per Gb for increasing the memory beyond the 16 Gb of the standard model.
  8. S IIIiPhone 5
    16 Gb ($99-199)16 Gb ($199)
    32 Gb ($249)32 Gb ($299)
    64 Gb (planned)64 Gb ($399)

  9. External Storage - Only Samsung gives the user the freedom to add external storage. This permits being able to effectively expand the storage of the device to much more than than Apple offers. At this time, the maximum storage on the S III is 64 Gb external + 32 Gb internal, for a total of 96 Gb. Eventually, a total of 128 Gb might be available from Samsung.
  10. S IIIiPhone 5
    16, 32, 64 Gb micro SDNot Available

  11. NFC - Near Field Communications (NFC) allows the user to communication with point of sale devices to make payments, initiate transfers of data, and automate actions by interacting with NFC tags.
  12. S IIIiPhone 5
    Included as part of standard batteryNot Available
    Available from 3rd party batteriesNot Available

  13. Open Ecosystem - whether it's to watch movies, listen to music, or get apps, Apple forces the user to get their media and apps from Apple. This is the biggest difference between not just the S III, and the iPhone 5, but between any Android device versus any Apple iOS device. Even if Apple were to make a device as good as or even better than the S III, I would not buy an Apple device for this reason.
  14. AndroidiOS
    Any app store allowedOnly Apple App store
    Apps are able to be user installedNot allowed
    Music and Video DRM freeOnly permitted from iTunes

Conclusion

Apple has failed to innovate and create a device with the iPhone 5 that is superior to the Samsung Galaxy S III, or many other top-end Android devices. Their offering of added 4G LTE and a larger screen is something I had on a Droid Bionic more than one year ago. Their replacement of Google Maps and YouTube apps with a buggy and less sophisticated Apple Maps, and the expectation that you will watch YouTube in a browser just shows how they further want to block their users from anything not Apple. Their continuing litigation over ridiculous "innovations" like rounded rectangles, and obvious touch screen gestures and responses just shows how void of any real innovation Apple has become.

So, unless you pledge allegiance to the being part of Apple trying to take away your freedom, the choice is obvious. It does not take a "Genius" to see that the Samsung Galaxy S III is superior to the iPhone 5 in the many ways that really matter to the user. For that matter, Android offers many other devices better than the new iPhone 5, just take a look at some of the other devices offered by Samsung, Motorola, LG, Pantech, and HTC.

If you aren't brainwashed and fall to your knees at the alter of Apple, then you'll find that the Samsung Galaxy S III is not only a far better device for the price, but you'll be free from the Apple prison of what they call an ecosystem, which is nothing more than vendor lock-in at outrageous prices for what they tell you is what you want, but not what really matters.

Regardless, as Jimmy Kimmel shows, too many people are always ready to believe that the newest from Apple is the best when it isn't: iPhone 5 Apple Zombies

8/25/2012

Extra Apps for Samsung Galaxy S III

Extra Apps for Samsung Galaxy S III

With all the amazing apps on the Samsung Galaxy S III, it may be hard to believe, but Samsung has even more apps available that will work on this device. In order to be able to install these apps, first you need to go to http://www.samsungapps.com. If you don't already have a Samsung user account, then sign up, otherwise, sign in. Next, if you click the Support link, then there will be a sidebar on the left that will allow you to install the Samsung Apps app

Here's the wrinkle, the Galaxy S III is not listed, but if you download the app for the phone (not the tablet), it works! Once this application is installed on the device, you can use it to install the other apps. To see the ones specifically designed by Samsung, click the More Services tile in the lower right corner. Here's the list of the apps that you will find:
  • Photo editor - crop, resize, decorate, or add special effects
  • Kies Air - manage your device from your broswer
  • Application monitor - a widget to display the number of open apps and start Task Manager
  • MiniDiary - make notes, add photos and locations on the go
  • KiesCast - podcast manager for audio and video
  • S Health - tracks your activities, blood glucose, blood pressure, food, and weight 
  • My Story - provides templates to create media rich correspondence
  • Readers Hub - ebook reader that won't work if you have rooted your device
  • Family Story - enables sharing with just family of photos, messages, and events
  • Flipboard - innovative browser for social sites like Facebook and Twitter
Update: I'm sure there is many more other good apps to be found at SamsungApps.com. One other good one that I also found is Video maker, which allows you to decorate a video with a frame and add voiceovers.

Gone Google Again: Apps To Play

Gone Google Again: 

Apps To Play

Most of my apps are Google integrated. Of course, GPS Map has totally Gone Google. Over the last few days, I've created another Android app that has gone Google again! My newest Gone Google app is Apps To Play, and it integrates only with the Google Play Store app, or a browser at this point.

This app is intended to make searching the Google Play Store for Android apps easier. Starting with some of the URIs found at https://developer.android.com/distribute/googleplay/promote/linking.html, it creates an intent to let you start either a browser or the Google Play Store app. Unlike the Google Play Store app, it permits searching directly by developer. For some reason, trying to search the Google Play Store app for the Best Selling in Games collection fails, but it succeeds in the browser.

One of the features that makes using the app convenient is that it stores in a database any unique searches that are typed in the AutoCompleteTextView for app classpath, developer, and keyword searches. I've made it even easier to search for "Google, Inc." as the developer, as well as "WrightRocket", by populating the database used for the AutoCompleteTextView developer names.

I considered populating the database used for the AutoCompleteTextView app classpaths with all the Google applications, but there are too many to be practical. Some also may not be available in certain markets, or even available from the Play Store. Anyway, here are the ones that I have installed with google in their classpath that I suspect are from Google:

com.froogloid.kring.google.zxing.client.android
com.google.android.apps.adk2
com.google.android.apps.androidify
com.google.android.apps.authenticator2
com.google.android.apps.blogger
com.google.android.apps.books
com.google.android.apps.chrometophone
com.google.android.apps.currents
com.google.android.apps.docs
com.google.android.apps.enterprise.dmagent
com.google.android.apps.finance
com.google.android.apps.gesturesearch
com.google.android.apps.giant
com.google.android.apps.googlevoice
com.google.android.apps.iosched
com.google.android.apps.magazines
com.google.android.apps.maps
com.google.android.apps.offers
com.google.android.apps.orkut
com.google.android.apps.panoramio
com.google.android.apps.plus
com.google.android.apps.reader
com.google.android.apps.schemer
com.google.android.apps.shopper
com.google.android.apps.translate
com.google.android.apps.tvremote
com.google.android.apps.unveil
com.google.android.apps.uploader
com.google.android.backup
com.google.android.feedback
com.google.android.gm
com.google.android.googlequicksearchbox
com.google.android.gsf
com.google.android.gsf.login
com.google.android.location
com.google.android.maps.mytracks
com.google.android.marvin.intersectionexplorer
com.google.android.marvin.talkback
com.google.android.music
com.google.android.partnersetup
com.google.android.setupwarlock
com.google.android.setupwizard
com.google.android.stardroid
com.google.android.street
com.google.android.syncadapters.bookmarks
com.google.android.syncadapters.calendar
com.google.android.syncadapters.contacts
com.google.android.talk
com.google.android.tts
com.google.android.videos
com.google.android.voicesearch
com.google.android.youtube
com.google.android.ytremote
com.google.earth
com.google.zxing.client.android

To find the apps by Google, to get going Gone Google yourself, use the Developer search for Google Inc. Not missing an opportunity to promote my own applications, however, I did populate the database with the app classpaths for my own applications:

com.appspot.wrightrocket.GPSMap
com.appspot.wrightrocket.GPSMapPro
com.wrightrocket.appstoplay
com.appspot.wrightrocket.amazing
com.appspot.wrightrocket.kmlkmz
com.appspot.wrightrocket.timeit
com.wrightrocket.amazingmap
com.wrightrocket.appstoplay
com.wrightrocket.kmlkmz
com.wrightrocket.theshowfree
com.wrightrocket.theshow


So, go get Apps To Play on Google Play! 
Then, use it to easily find the Android apps you want, and Go Google! 

Disclaimer: I am only paid by Google in the form of sales from my Android apps, the advertising revenue generated from them, and by this and other websites that feature Google AdMob or AdSense ads.

8/15/2012

WrightRocket's Raspberry Pi Links

WrightRocket's Raspberry Pi Links

While I mostly reference the links to sites I find relevant to the Raspberry Pi by looking at my Delicious bookmarks, I thought I'd make a post sharing some my links about the Raspberry Pi. Please comment below to suggest other ones to add!

Raspberry Pi Foundation




This is the main place to visit. This is where the Raspberry Pi originated. They publish relevant information on a regular basis. You can find images to download to install onto your SD card to be able to start up your RPi at this site.

Broadcom


They manufacture the SoC that powers the Raspberry Pi. This page features details about the Broadcom 2835.

http://www.broadcom.com/products/BCM2835

Raspbian

Raspbian is now the official OS for the Raspberry Pi. Raspbian was built based upon Debian, but optimized for the Raspberry Pi.

http://www.raspbian.org/

R-Pi Hub at Elinux

There is a great deal of information to be found about the Raspberry Pi at Elinux's R-Pi Hub. The have all kinds of beginner's guides, but my favorite is the information that the have about the hardware.

http://elinux.org/R-Pi_Hub

PuppyArch


PuppyArch is the Raspberry Pi version of the Puppy Linux distribution which derives from Arch Linux.    There is an image to download and instructions, but I've not tried it yet.

http://puppylinux.org/wikka/PuppiArch

QtonPi

QtonPi allows for Qt application development on the Raspberry Pi.

http://qt-project.org/wiki/Qt-RaspberryPi


AdaFruit

Accessories and hardware to go with the Raspberry Pi including cases, breakout boards, displays, and more.


Element14

A distributor of the Raspberry Pi and accessories.

Farnel

Another distributor of the Raspberry Pi and accessories.

SparkFun

Electronics parts, breakout boards and kits are featured at Sparkfun.

8/04/2012

Building Omxplayer for Raspbian on the Raspberry Pi

Building Omxplayer for Raspbian on the Raspberry Pi

This version of the omxplayer, is nearly identical to the one I published for Debian on the Raspberry Pi, except that it can be built for Raspbian. The same github repository serves to build omxplayer for both Raspbian and Debian. To configure the build for one or the other, the RASPBIAN variable must be set as described below in the Makefile.include.

This means that the primary differences between this and the default build of omxplayer still are:
  • Default output is HDMI (no need for -o hdmi)
  • Clears the screen and doesn't output anything unless there is an error
  • Makefiles have been customized  to perform a native build on the Raspberry Pi
  • There is the ability to install or uninstall using the Makefiles
  • There is the ability to make sources or make sources-clean to download or remove the firmware and ffmpeg dependencies
  • Everything installs under /usr/local
  • It is possible to install this pre-built omxplayer for Raspbian Wheezy or Debian Squeeze

Preparing to Build Omxplayer

  • First, make sure your firmware is up-to-date, as described in Keeping Your Raspberry Pi Fresh:
    • pi@raspberrypi:~$ sudo apt-get update && sudo apt-get upgrade
  • Install software needed to perform the update:
    • pi@raspberrypi:~$ sudo apt-get install ca-certificates git-core binutils libboost1...-dev libva1 libpcre3-dev
  • Download the script:
    • pi@raspberrypi:~$ sudo wget https://raw.github.com/Hexxeh/rpi-update/master/rpi-update
  • Copy the script to /usr/local/bin:
    • pi@raspberrypi:~$ sudo cp rpi-update /usr/local/bin/rpi-update
  • Make the script executable:
    • pi@raspberrypi:~$ sudo chmod +x /usr/local/bin/rpi-update
  • To compile this successfully, use a 240/16MB RAM split between system and GPU:
    • pi@raspberrypi:~$ sudo rpi-update 240
    • pi@raspberrypi:~$ sudo reboot
Next, make sure proper ownerships are in place, go to the local src directory, and clone the git repository for my omxplayer fork:
  • pi@raspberrypi:~$ sudo chown pi:pi /usr/local/src/
  • pi@raspberrypi:src $ cd /usr/local/src
  • pi@raspberrypi:src $ git clone https://github.com/wrightrocket/omxplayer
At this point, the pre-built omxplayer could also be installed on your system if you are using Raspbian Wheezy, Debian Wheezy or Debian Squeeze. If you wish to skip compiling omxplayer, and use a pre-built version, complete the next step, and then skip to using omxplayer:
  • sudo /usr/local/src/omxplayer/install-raspbian-wheezy
or 
  • sudo /usr/local/src/omxplayer/install-debian-wheezy
The Debian Wheezy build has been tested to work on both Wheezy and Squeeze.

Building the Omxplayer

Before building, be sure to set update the Makefile.include file for the RASPBIAN variable. If building under Debian, then RASPBIAN=0 is appropriate. If building under the Raspbian OS, then update this file where RASPBIAN=1. The RASPBIAN variable determines whether hardfp or softfp is used.
  • If you are building this under Raspbian, and not Debian, then use vi, vim, nano, leafpad or some other editor to modify the RASPBIAN variable at the top of the /usr/local/src/omxplayer/Makefile.include file to set RASPBIAN=1.
Even after getting the configuration right for building, my first few attempts failed because of insufficient RAM. This is the reason a different RAM split is used during the build process than when using the player. The build sequence is:
  • Change to the directory where the source code is located
    • cd /usr/local/src/omxplayer/
  • Next, the firmware and ffmpeg sources will be downloaded. The firmware is about 427 MB and ffmpeg is about 60MB. This step took about 16 minutes on my connection.
    • make sources
  • The longest part of the process is compiling the ffmpeg libraries. Under Raspbian this step took about the same amount of time as under Debian. This step took about 131 minutes.
    • make -f Makefile.ffmpeg 
  • After the libraries are built, then they are stripped and copied to the /usr/local/src/omxplayer/ffmpeg_compiled directory. This step is very quick.
    • make -f Makefile.ffmpeg install
  • Now, omxplayer is ready to be compiled. It should only take about 6 minutes.
    • make
  • The last step of building should create a /usr/local/src/omxplayer/omxplayer-dist.tar.gz that will be used to install omxplayer and the ffmpeg libraries.
    • make dist



Finally, install omxplayer:

  • sudo make install

Using the Omxplayer

  • To use omxplayer, the system must allocate at least 64MB of RAM for the GPU. Run the script and make sure there is a 192/64 Mb of RAM split between the system and GPU. A split of 128/128 can also be used:
    • pi@raspberrypi:~$ sudo rpi-update 192
    • pi@raspberrypi:~$ sudo reboot
  • To play videos, just execute the omxplayer script
    •   omxplayer --help
    • Options :
      -h / --help print this help
      -a / --alang language audio language : e.g. ger
      -n / --aidx index audio stream index : e.g. 1
      -o / --adev device audio out device : e.g. hdmi/local
      -i / --info dump stream format and exit
      -s / --stats pts and buffer stats
      -p / --passthrough audio passthrough
      -d / --deinterlace deinterlacing
      -w / --hw hw audio decoding
      -3 / --3d switch tv into 3d mode
      -y / --hdmiclocksync adjust display refresh rate to match video
    • pi@raspberrypi:~$ omxplayer LMFAO.mp4

7/22/2012

Raspbian Optimizes Raspberry Pi

Raspbian Optimizes Raspberry Pi


If you haven't checked back in at Raspberry Pi Foundation lately, you might not have noticed that there is a new recommended download for the default operating system for the Raspberry Pi. That new Linux distribution is called Raspbian.

Raspbian is also based upon Debian, but has over 35,000 software packages rebuilt to be optimized for the Raspberry Pi architecture. Depending upon what you are doing with your Raspberry Pi, this means that could have up to a 41% increase in performance.

The omxplayer, which allows viewing HD videos, comes pre-installed in this image of the Raspbian operating system. I would not recommend compiling my fork of the omxplayer for this distribution at this time, as this image uses floating point calculations differently. I have not yet tested my version of omxplayer with this distribution.

The following are instructions detail how I installed Raspian using Fedora (Linux). Putting the image of Raspian on a SD card is very similar to how other operating system images is done. There is no reason to try to expand the file system manually, as that is automated is the raspi-config provided in Raspbian.

Installing Raspian on the Raspberry Pi

By default, on the first boot it runs sudo raspi-config which is somewhat helpful except for a couple of problems. You can run this later to make further adjustments.

Running sudo raspi-config allows you to perform many common tasks like expanding the filesystem, or updating the software. However, the keyboard layout and ssh options did not work correctly for me. Other items like changing the pi user's password and resizing the filesystem were useful.

In order to get my keyboard layout right, I still found it necessary to perform:
sudo apt-get install console-data
or if I want to change settings I would use:
sudo dpkg-reconfigure keyboard-configuration


In order to get the ssh server to work, I had to do:
sudo apt-get purge openssh-server
sudo apt-get install openssh-server


Since I was out of town last week, I haven't had too much time to play with Raspbian yet, just a few hours this weekend, but so far it looks good! Please feel free to comment about your experiences with it!


After trying out Raspbian, I do find it to feel faster for operations. One big problem for me was that the included omxplayer did not work for me! I've been hard at work at getting an omxplayer build to work with the hard instead of softfp handling. So far, I've had one successful build.

UPDATE: I have now published a post on Building Omxplayer for Raspbian on the Raspberry Pi, which  allows you to either install a pre-built omxplayer that works well, or to build it yourself from source.


ModMyPi for the Raspberry Pi

ModMyPi for the Raspberry Pi


The case from https://www.modmypi.com/ finally arrived! The two pieces of plastic fit together well very nicely. Above you see the top side in red, you can also choose white, black, blue and green. The Raspberry Pi board fits firm inside the case. All but one of the ports is very easily accessed. I found the power port to be slightly recessed making it slightly more difficult to align and connect correctly.

The Top Side

Visually, there is access to the GPIO pins through small diagonal slots above them. I imagine I could easily cut the slots above the GPIO pins for full access. Slots cut to look like a power icon, and several vertical slots exist to allow sight of the status LEDs. 

The Bottom Side


The underside of the ModMyPi case has seven holes in the center in a circular pattern with two more spread out close to the edge of the long horizontal axis in the center of the vertical axis. The center group of holes could be used to provide ventilation if the two outer holes were mounted on something like the standoffs used on the bottom of computer cases to mount motherboards to the case.
Inside the bottom are plastic standoffs, so the board does not sit directly on the plastic.

ModMyPi 

I had looked into buying this case at the time that it was still going to be 3D printed. They had so many orders that they used injection moulding instead. The strong ABS plastic pieces fit together well, and I can always take the top off if I need more access. They have five different colors to choose from for both the top and bottom. Their site https://www.modmypi.com/ has all the accessories you need, as well as start-up kits. However I have no affiliation with them, other than being their first time customer.
I was very impressed by how they communicated throughout the whole process of changing the manufacturing technique as well providing estimated shipping dates. They also help support the Raspberry Pi Foundation with the sale of stickers and according to their website, "ModMyPi LTD has pledged to donate 5% of all our profits to the Raspberry Pi Foundation."

So, all in all, I'm very pleased that my Raspberry Pi has a case that is portable and functional for casual use. I'm already imagining the ultimate experimentation case or expansion board, or...


7/15/2012

Building Omxplayer for Debian on the Raspberry Pi

Building Omxplayer for Debian on the Raspberry Pi

UPDATE: I have now published a post on Building Omxplayer for Raspbian on the Raspberry Pi, which should be referenced now for building omxplayer on either Raspbian or Debian.This post does contain some useful links and background information that you still may find useful.

NOTE: There is a new default operating system for the Raspberry Pi that includes omxplayer. The following post, assumes that you are using the original Debian image for the SD card image of your operating system. To learn more, please see my post Raspbian Optimize Raspberry Pi.
If you want a media player that takes advantage of the GPU of the Raspberry Pi, then building omxplayer is one solution. This solution allows you to run a standard Debian operating system, but be able to take advantage of hardware accelerated video decoding. So far, this has been tested using the original Debian build for the Raspberry Pi called squeeze.

There are other ways to play hardware accelerate videos as I've mentioned in Playing HD videos in Debian on the Raspberry Pi, and OpenElec for the Raspberry Pi. This solution allows you to download the source code for omxplayer and be able to tweak it if you want to be able to do that, download the source code for ffmpeg and adjust it according to your needs, and download and use the current firmware available for the Raspberry Pi.

Omxplayer was built to be able to create XMBC for the Raspberry Pi. One implementation of XMBC is OpenElec for the Raspberry Pi. I forked a repository from https://github.com/huceke/omxplayer to make my own version of omxplayer. Here are some key differences:

  • Default output is HDMI (no need for -o hdmi)
  • Clears the screen and doesn't output anything unless there is an error
  • Makefiles have been customized  to perform a native build on the Raspberry Pi
  • There is the ability to install or uninstall using the Makefiles
  • There is the ability to make git or make git_clean to download or remove the firmware and ffmpeg dependencies
  • Everything installs under /usr/local
Be sure that you have expanded the file system, or have /usr/local/src mounted on another device besides the default root file system. My post, A bigger slice of Raspberry Pi, covers how to expand the file system, make a swap partition and how to activate it.

Also, you need to make sure all the software and firmware is updated, as discussed in my post Keeping Your Raspberry Pi Fresh.

Build omxplayer using Debian Squeeze on the Raspberry Pi

  • These instructions are very similar to what is shown on my github repository: http://github.com/wrightrocket/omxplayer. Instructions at that site may be updated more frequently than this blog post.
  • Don't startx, either use the console or ssh into the system.
  • Install dependencies for build
    • sudo apt-get install libpcre3-dev libboost-dev git fbset
  • Configure the build directory permissions and change to it
    • sudo chown pi:pi /usr/local/src
    • cd /usr/local/src
  • Get the source code for the player, ffmpeg and the Raspberry Pi firmware. Depending on the speed of your Internet connection, then this might not take more than 5 or 10 minutes if you've got a fast connection, or else you might wish that you did. 
    • git clone https://github.com/wrightrocket/omxplayer.git
    • cd /usr/local/src/omxplayer/
    • make sources
git clone https://github.com/raspberrypi/firmware.git
Cloning into firmware...
remote: Counting objects: 9517, done.
remote: Compressing objects: 100% (5218/5218), done.
remote: Total 9517 (delta 4998), reused 7998 (delta 3489)
Receiving objects: 100% (9517/9517), 391.44 MiB | 1.09 MiB/s, done.
Resolving deltas: 100% (4998/4998), done.
git clone git://git.videolan.org/ffmpeg.git ffmpeg;
Cloning into ffmpeg...
remote: Counting objects: 234992, done.
remote: Compressing objects: 100% (55205/55205), done.
remote: Total 234992 (delta 184984), reused 228269 (delta 179406)
Receiving objects: 100% (234992/234992), 59.52 MiB | 737 KiB/s, done.
Resolving deltas: 100% (184984/184984), done.
cd ffmpeg; git checkout master; git checkout 13a7bd70c8d94c5a46c14e7ac23a170b77eff52e
Already on 'master'
Checking out files: 100% (794/794), done.
Note: checking out '13a7bd70c8d94c5a46c14e7ac23a170b77eff52e'.

  • Start the ffmpeg build process, which takes forever! Not actually, the first time I ran it it took about 140 minutes on a Class 6 SD card. After upgrading to a faster Class 10 SD card, it only took about 123 minutes. Expect between two to three hours for this part to complete.
    • time make -f Makefile.ffmpeg
      • first, the configure process for ffmpeg should run
      • next, just a couple of libavdevice files are made
      • followed by many items in alphabetical order, and much like the making of laws:
      • Important milestone, cheers!
Here's the time that was reported, using a non-overclocked Raspberry Pi and a Class 6 sd card, about 2 hours and 20 minutes.

real    140m28.435s
user    132m8.420s
sys     3m32.930s

Here's the time that was reported, using a non-overclocked Raspberry Pi and a Class 10 sd card, only about 2 hours.
real    123m9.197s
user    119m56.500s
sys     2m4.130s

  • After ffmpeg builds, install these libraries, and then start the omxplayer build process, which only takes about 6 minutes
    • time make -f Makefile.ffmpeg install
    • time make
strip omxplayer.bin
real 6m11.814s
user 5m56.810s
sys 0m8.860s


After the build process has completed, you are ready to install omxplayer
  • Make the file that is able to be distributed because this is built with GPL enabled, omxplayer-dist.tar.gz
    • make dist
  • If  make dist succeeded, then you are ready to install omxplayer
    • sudo make install



7/08/2012

Python on the Raspberry Pi: Roshambo

Python on the Raspberry Pi: Roshambo


While I was doing Python on the Rasberry Pi: GPIO, I came up with an idea. I wanted to use six GPIO pins for output, and three GPIO pins for input from a button. I have not yet wired this up, but I spent part of a day writing some Python code that would be the game to play with these three buttons, Roshambo.

Git the Code

In order to have access to all of the Python examples in this post, and more, you will need to have git installed, and clone my PythonOnTheRaspberryPi repository.

  • If you don't have the program git installed, then install it with:
    • sudo apt-get install git
  • Clone my PythonOnTheRaspberryPi repository:
    • git clone https://github.com/wrightrocket/PythonOnTheRaspberryPi.git
    • cd PythonOnTheRaspberryPi

Roshambo Interactive

Here's a short interactive demonstrating a dictionary named gameD storing and retrieving key and value pairs. The random module's choice function is demonstrated to show how a random selection of a certain key could be done, and to use it's seed function for better randomization. The function didPlayerWin(player, program) is pasted into the session, and it is imported from the rps.py module with the statement: from rps import didPlayerWin. This function shows how the logic works to determine which weapon won in a meeting between the player and the program.

pi@raspberrypi:~/PythonOnTheRaspberryPi$ python
Python 2.6.6 (r266:84292, Dec 27 2010, 21:57:32) 
[GCC 4.4.5 20100902 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> gameD = {}
>>> gameD['r']='Rock'
>>> gameD['p']='Paper'
>>> gameD['s']='Scissors'
>>> print gameD
{'p': 'Paper', 's': 'Scissors', 'r': 'Rock'}
>>> gameD['s']
'Scissors'
>>> gameD.keys()
['p', 's', 'r']
>>> gameD.values()
['Paper', 'Scissors', 'Rock']
>>> gameD.items()
[('p', 'Paper'), ('s', 'Scissors'), ('r', 'Rock')]
>>> import random
>>> random.seed()
>>> # seed() is used for better randomization
... 
>>> random.choice(gameD.keys())
'p'
>>> random.choice(gameD.keys())
'r'
>>> random.choice(gameD.keys())
's'
>>> random.choice(gameD.keys())
'p'
>>> random.choice(gameD.keys())
'p'
>>> def didPlayerWin(player, program):
...     ''' determine if player beats program '''
...     if player == 'r':
...         if program == 'r':
...             return 'tie: rock meets rock'
...         elif program == 's':
...             return 'win: rock crushes scissors'
...         else:
...             return 'lose: paper covers rock'
...     elif player == 's':
...         if program == 'r':
...             return 'lose: rock crushes scissors'
...         elif program == 's':
...             return 'tie: scissors meets scissors'
...         else:
...             return 'win: scissors cut paper'
...     elif player == 'p':
...         if program == 'r':
...             return 'win: paper covers rock'
...         elif program == 's':
...             return 'lose: scissors cut paper'
...         else:
...             return 'tie: paper meets paper'
...     else:
...         ''' catch all for testing '''
...         return 'error: for unknown reason'
... 
>>> mypick = 'r'
>>> programChoice = random.choice(gameD.keys())
>>> didPlayerWin(mypick, programChoice)
'lose: paper covers rock'
>>> programChoice
'p'
>>> gameD[programChoice]
'Paper'
>>> del didPlayerWin # deletes the function or name from namespace
>>> from rps import didPlayerWin # you must have downloaded or created rps.py 
>>> mypick = 's'
>>> programChoice = random.choice(gameD.keys())
>>> programChoice
's'
>>> didPlayerWin(mypick, programChoice)
'tie: scissors meets scissors'

Rock, Paper, Scissors Game

As the game might be better known as Rock, Paper, Scissors, there are two modules available at my github repository that implement this game: rps.py and roshambo.py

rps.py

Very straightforward example of implementing the Rock, Paper, Scissors game using functions.
Uses a class to create object instances to represent the player's and the program's random choice. The rps class objects have a magical __cmp__ method that is automatically called when comparisons are made between two object instances like userObject > programObject.

Dictionaries are used to store key and value pairs for tracking the name or actions that a particular instance of an object like userObject has assigned to it. If the userChoice is 'r', then  userObject = rps(userChoice) creates a rps object which represents a rock.  For example, the key 'r' is used in the rpsTypeDict to be able to retrieve the name 'Rock' by using self.rpsTypeDict[self.rpsType] in the magical __str__ method that is used whenever the object is referenced as a string or printed.

Rock, Paper, Scissors, Lizard, Spock Game

There are two other modules which implement the more advanced game of Rock, Paper, Scissors, Lizard, Spock: roshambobigbang.py and roshambobigbang_solution.py.
Invented by Sam Kass, All hail Sam Kass!, the game of ROCK PAPER SCISSORS SPOCK LIZARD, was referred to on the Big Bang Theory several times, so I decided to name the file after the original game with the name of the television series added to it. I had initially noticed that the name of the game in Wikipedia is referred to as ROCK PAPER SCISSORS LIZARD SPOCK, which is why my code refers to the weapons in that order.

This example builds upon the previous roshambo, but extends the game to Rock, Paper, Scissors, Lizard, Spock. The game can be automated where the player's choice of weapon is also randomly selected. In order to keep track of the different actions of the weapons, as they meet other weapons, a dictionary within a dictionary is used. Statistics are also reported for the choice of weapon by the player and the program. A matrix of how many times each weapon met another weapon is also reported. This matrix is also represented by dictionaries within a dictionary. There are two challenges to the viewer of the code which would help to make the code more dynamic and flexible.

This solution to the two challenges presented in roshambobigbang.py is nearly identical to roshambobigbang.py except that the way the statistics and distribution matrix are printed.

Thanks!

Thanks to Sam Kass and the Wikipedia for having the information and images about these games available:
http://www.samkass.com/theories/RPSSL.html
http://en.wikipedia.org/wiki/Rock-paper-scissors
http://en.wikipedia.org/wiki/Rock-paper-scissors-lizard-Spock
http://en.wikipedia.org/wiki/File:Rock_paper_scissors.jpg
http://en.wikipedia.org/wiki/File:Rock_Paper_Scissors_Lizard_Spock_en.svg
http://en.wikipedia.org/wiki/File:Pierre_ciseaux_feuille_l%C3%A9zard_spock_aligned.svg

7/04/2012

Python on the Raspberry Pi: GPIO

Python on the Raspberry Pi: GPIO

If you want to experiment with GPIO on the Raspberry Pi, then be warned there is a danger to the Raspberry Pi. Please follow these instructions at your own risk. I make no warranty as to the correctness of the connections described, but they did work correctly for me without damaging my Raspberry Pi.

Understanding GPIO on the Raspberry Pi

One of the compelling things about the Raspberry Pi is that it includes GPIO pins. The Introduction to  Embedded Programming site has a great overview of GPIO, and how to wire various circuits. What can be confusing about the GPIO pins on the Raspberry Pi is how to locate them. The GPIO pins in the P1 header are the easiest to access, and will be the ones that will be referenced in this post on how to do basic output and input using them.

Reference Material

There is a pdf datasheet and a schematic hosted at RaspberryPi.org. The datasheet describes how GPIO works in detail, starting at page 89. 

The R-Pi_Hub for the Raspberry Pi has  also has several documents.

Referencing Pins

If you notice, in the first table in http://elinux.org/RPi_BCM2835_GPIOs there are two columns RPi connection, and RPi signal name. These are important to understand if you want to program a particular pin to perform a certain function. What I find most useful is the image on the page http://elinux.org/RPi_Low-level_peripherals shown below. If you are unsure as to what you are looking at locate P1 on the Raspberry Pi. It is next to P1-01. There are several methods to refer to a pin:
  • RPi Connection Method:
    • This refers to a physical pin on the board on the P1 header
    • Pins are numbered within the header from 1 to 26
    • If you look at the under side of the connector, the pin with a square pad is pin 1, or P1-01
    • The diagram shows the position of P1-01, P1-02, P1-25, and P1-26 just outside the white box
    • The pins in the bottom row have odd numbers P1-01 through P1-25
    • The pins in the top row have even numbers P1-02 though P1-26
    • For the person making a connection, this method makes the most sense. 
      • Locate a header like P1
      • Locate pin 1 by checking the underside of the connector for the square pad
      • Check diagram for correct numbering of pins
      • Count the position to the pin that you want to reference
      • For example,to access the functionality of GPIO18, or PCM_CLK, locate P1-12.
    • By default, the RPi.GPIO Python module references physical pin numbers like 12 for GPIO18.
  • WiringPi Method:
    • This method refers to the pin referenced in wiringPi functions
    • wiringPi functions are analogous to Arduino GPIO functions   
    • The author of wiringPi that has a table with the pin names and numbers
    • There is also a WiringPython Module based upon wiringPi
    • According to the wiringPi table, P1-12 (GPIO18) is referred to as pin 1.
  • GPIO Number Method:
    • This method refers to a pin by the GPIO number Broadcom gave it
    • This method makes the most sense in the implementation of the software
    • This method is independent of a specific physical implementation 
    • Reference the pin by the signal name, such as GPIO18, or 18.
    • The RPi.GPIO Python module can reference these names: GPIO.setmode(GPIO.BCM)
    • The WiringPython Module can also reference these names: wiringPiGpioMode(True)
    • This is the method that I prefer for any code I write

So What's The Confusion?

Depending on which library you are using, and what mode it is in, then the numbers or names used to reference pins may vary. However, with each of these libraries, it is possible to set the mode to reference the GPIO number, and then they all reference the same number. Let's take a simple example. 

An example using a LED connected

A LED cathode(-) is connected to a 270 Ohm resistor, which is then connected to ground on physical pin P1-06. At least, this ground pin is not referenced in any of the programs. The LED anode(+) is connected to physical pin P1-12, which is the GPIO18. As we will see, there are several ways to refer to this pin.

Using Python to control GPIO for output

There are a couple of Python modules to control the GPIO pins. The  RPi.GPIO Python module by default uses the physical pin number, but shown can refer to the GPIO pin. Likewise, the WiringPython Module use a different scheme to refer to pin numbers, but can be configured to use GPIO pin numbers. This module has more capabilities, and is based upon the wiringPi library.

Starting up Python for GPIO

First of all, make sure that both the RPi.GPIO Python module and the WiringPython Module modules installed. Second, due to root access being necessary to be able to read or write to the GPIO files, use sudo  to start Python

pi@raspberrypi:~/PlayingWithPython$ sudo python
Python 2.7.3 (default, Jun 18 2012, 16:19:55) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 

RPi.GPIO Python module
>>> import RPi.GPIO as GPIO
# By Default References Physical 12 number
... 
>>> GPIO.setup(12, GPIO.OUT)
>>> GPIO.output(12, True)
>>> GPIO.output(12, False)
# If setmode(GPIO.BCM), then reference GPIO number
... 
>>> GPIO.setmode(GPIO.BCM)
>>> GPIO.setup(18, GPIO.OUT)
>>> GPIO.output(18, True)
>>> GPIO.output(18, False)

>>> import wiringpi
>>> # initialize the module
... 
>>> wiringpi.wiringPiSetup()
0
>>> # reference wiringPi pin by default
... 
>>> INPUT=0
>>> OUTPUT=1
>>> PWM=2
>>> wiringpi.pinMode(1, OUTPUT)
>>> wiringpi.digitalWrite(1, True)
>>> wiringpi.digitalWrite(1, False)
>>> # Change to reference GPIO numbers
... 
>>> wiringpi.wiringPiGpioMode(True)
>>> wiringpi.pinMode(18, OUTPUT)
>>> wiringpi.digitalWrite(18, True)
>>> wiringpi.digitalWrite(18, False)
>>> # wiringpi also support PWM mode only on GPIO18 or wiringPi pin 1
...
>>> wiringpi.pinMode(18, PWM)
>>> # pwmWrite(pin, 0) is off
...
>>> wiringpi.pwmWrite(18, 0)
>>> wiringpi.pwmWrite(18, 256)
>>> wiringpi.pwmWrite(18, 512)
>>> # pwmWrite(pin, 1023) is full power
...
>>> wiringpi.pwmWrite(18, 1023)
>>> wiringpi.pwmWrite(18, 0)

An example using a Switch and LED connected

A simple two wire switch is used in this example. One wire is then connected to ground on physical pin P1-06. Update: Also use a 270 Ohm resistor between ground and the first wire, as to provide extra protection. The other wire is connection to signal GPIO7 on physical pin P1-26. The LED is connected as in the previous example.

pi@raspberrypi:~/PlayingWithPython$ sudo python
Python 2.7.3 (default, Jun 18 2012, 16:19:55) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 


>>> import RPi.GPIO as GPIO

>>> # display variables and functions in GPIO namespace
... 
>>> dir(GPIO)
['BCM', 'BOARD', 'IN', 'InvalidChannelException', 'InvalidDirectionException', 'InvalidModeException', 'OUT', 'WrongDirectionException', '_BCM', '_ExportedIds', '_GPIO_PINS', '_GetValidId', '_MODE', '_MODES', '__builtins__', '__doc__', '__file__', '__name__', '__package__', '__path__', '_unexport', 'atexit', 'input', 'os', 'output', 'setmode', 'setup']
>>> # set the mode to use GPIO numbers
... 
>>> GPIO.setmode(GPIO.BCM)
>>> # set up the GPIO to read input
... 
>>> GPIO.setup(7, GPIO.IN)
>>> # read switch initial position
... 
>>> GPIO.input(7)
False
>>> # read switch after changing positions
... 
>>> GPIO.input(7)
True
>>> GPIO.input(7)
False
>>> # use the switch to toggle the LED
... 
>>> # setup GPIO18 for output
... 
>>> GPIO.setup(18, GPIO.OUT)
>>> # loop forever checking if switch is on or off
... 
>>> while True:
...     if GPIO.input(7):
...             GPIO.output(18, True)
...     else:
...             GPIO.output(18, False)
... 
# Press CTRL-c to exit the loop

>>> import wiringpi
>>> dir(wiringpi)
['__builtins__', '__doc__', '__file__', '__name__', '__package__', '_newclass', '_object', '_swig_getattr', '_swig_property', '_swig_repr', '_swig_setattr', '_swig_setattr_nondynamic', '_wiringpi', 'digitalRead', 'digitalWrite', 'pinMode', 'pullUpDnControl', 'pwmWrite', 'serialClose', 'serialDataAvail', 'serialGetchar', 'serialOpen', 'serialPutchar', 'serialPuts', 'shiftIn', 'shiftOut', 'wiringPiGpioMode', 'wiringPiSetup']
>>> INPUT=0
>>> OUTPUT=1
>>> wiringpi.wiringPiSetup()
0
>>> wiringpi.wiringPiGpioMode(True)
>>> wiringpi.pinMode(18, OUTPUT)
>>> wiringpi.pinMode(7, INPUT)
>>> while 1:
...     if wiringpi.digitalRead(7):
...             wiringpi.digitalWrite(18, True)
...     else:
...             wiringpi.digitalWrite(18, False)
... 
# Press CTRL-c to exit the loop

In and Out

This post only discusses how to use the GPIO pins for reading input or sending output. Hopefully, the references provided made it clear how to refer to a specific pin using both the RPi.GPIO and wiringpi Python modules. While there are many other possible functions for these GPIO pins, at least how to connect a LED for observing output, or a switch for observing input have been covered.

Update: There is now available at https://github.com/wrightrocket/PythonOnTheRaspberryPi a file called blinkgpio18.py, which also demonstrates the LED connected in these examples.

About Me - WrightRocket

My photo

I've worked with computers for over 30 years, programming, administering, using and building them from scratch.

I'm an instructor for technical computer courses, an editor and developer of training manuals, and an Android developer.