Tuesday, 28 August 2012

Nexus Q in a (little for now) more depth...

This post will continue to grow as I play around with the Nexus Q, so for the first while it might be like a minefield of thoughts but it may help someone else while I'm busy playing.... All the below are used at your own risk, if you turn the very nice Nexus Q into a paperweight don't blame me, the following worked on mine...

So far I only have Linux instructions, Windows users -> 1a. Install Linux

Rooting the Nexus Q and adding apps

1. Install the Nexus Q app on a tablet/phone supporting it, this may be an issue if your using a non-US account
2. Within the Nexus Q app setup your Nexus Q if you haven't done so yet, then select the device in the app home screen (mine is called "Living Room") and tap on Advanced, ensure you have USB debugging enabled (this also opens up port 4321, which telnet or nmap (eg. nmap -p 4321 192.168.1.185) can confirm for you
3. Download fastboot from: http://koushikdutta.blurryfox.com/G1/
4. Become root user and place fastboot executable in /bin/ for easy access, stay logged in as root, many commands below require you to have root access...
5. You will also need adb from the Android SDKs from http://developer.android.com/sdk/index.html (the adb application is in the platform-tools directory)
 5a. Make a symbolic link for adb to /bin/
6. Plug your Nexus Q into a USB port on your system and run:
 6a. adb start-server (from the platform tools directory in the Android SDK)
 6b. adb devices (should show your device: eg. List of devices attached AW1xxxxxxxx    device)
 6c. adb reboot bootloader (should turn the Nexus Q's lights red)
 6d. fastboot-linux-i386 devices (should show your device again, eg. AW1xxxxxxxx     fastboot)
 6e. fastboot-linux-i386 oem unlock (within 5 seconds run: fastboot-linux-i386 oem unlock_accept if you agree to the "world of hurt" message, hehe)
 6f. After fastboot finishes you should have the last two lines as (INFOdone and OKAY) and your Nexus should turn blue (If not I hope you don't have a nice new paperweight...)
 6g. Download the file: http://www.bliny.net/downloads/nexusq-boot.img (The image allows for ro.secure=0 ie. allowing remount)
 6h. Make some coffee, your nerves are probably a bit in need of some!
Nexus Q after reboot into bootloader

7. Open the Nexus Q app on your client device, you should have to re-setup it in the app, enable the USB debugging option again
 7a. adb reboot bootloader (once again your device's lights should all turn red)
 7b. fastboot-linux-i386 boot nexusq-boot.img (should show: downloading 'boot.img'... OKAY and then booting... OKAY, device lights should be blue again)
 7c. adb remount (should reply: remount succeeded)
8. Download http://oss.reflected.net/jenkins/6581/cm-9-20120819-NIGHTLY-n7000.zip
  8a. Unzip the file, it should have the folders and files in required below and step 9
  8b. adb push ./app/Superuser.apk /system/app
  8c. adb push ./xbin/su /system/xbin
  8d. adb shell chmod 06755 /system/xbin/su
9. Now you should be ready to install some apk's on the Nexus Q
 9a. adb push ./app/Browser.apk /system/app
 9b. adb install ./app/Trebuchet.apk
10. Start the app launcher up: adb shell "am start com.cyanogenmod.trebuchet/.Launcher" (if you have a bluetooth mouse/keyboard this should work, mine is coming in the post at present...)

About in Nexus Q

Keyboard and Mouse - Under dev... not working yet but in the meantime:

The Nexus Q has a Micro AB USB port which supports USB OTG (On-The-Go), if you plug it into your computer with a normal cable it will act like a normal peripheral, using a normal Micro USB cable to hub will result in the hub simply not working... You need to buy or make a USB OTG cable, this is exactly what you need to be able to use your mouse/keyboard on the Nexus Q. To make one (I made one because the shops were closed and I wanted to play ;-) ... you need some electronic skills though):

1. Carefully break/cut open the micro connector
2. Using a multimeter identify each pin, I opened my hub up and used the end point to identify each pin on the connector
3. Pin 4 of the 5 pins on the micro connector is the one you need to solder to pin 5 (GND pin)
4. Check all your pins for shorts, plug in and hope for the best!

The USB port in host mode seems to ignore USB devices, I'm working on this part too...



More commands that may be of interest:

Connecting to the Nexus Q via network: adb connect 192.168.1.185:4321
Reboot the device: adb reboot
Tail Android Logfile: adb logcat
Open Settings: adb shell am start -a android.settings.SETTINGS
Open Browser: adb shell am start -a android.intent.action.MAIN -n com.android.browser/.BrowserActivity
Open Google Play: adb shell am start -a android.intent.action.MAIN -n com.android.vending/.AssetBrowserActivity
Up: adb shell input keyevent 19
Down: adb shell input keyevent 20
Menu: adb shell input keyevent 1
Home: adb shell input keyevent 3
Back: adb shell input keyevent 4
Enter: adb shell input keyevent 23

More codes that can be used with adb shell input keyevent:

0 - KEYCODE_UNKNOWN
1 - KEYCODE_MENU
2 - KEYCODE_SOFT_RIGHT
3 - KEYCODE_HOME
4 - KEYCODE_BACK
5 - KEYCODE_CALL
6 - KEYCODE_ENDCALL
7 - KEYCODE_0
8 - KEYCODE_1
9 - KEYCODE_2
10 - KEYCODE_3
11 - KEYCODE_4
12 - KEYCODE_5
13 - KEYCODE_6
14 - KEYCODE_7
15 - KEYCODE_8
16 - KEYCODE_9
17 - KEYCODE_STAR
18 - KEYCODE_POUND
19 - KEYCODE_DPAD_UP
20 - KEYCODE_DPAD_DOWN
21 - KEYCODE_DPAD_LEFT
22 - KEYCODE_DPAD_RIGHT
23 - KEYCODE_DPAD_CENTER
24 - KEYCODE_VOLUME_UP
25 - KEYCODE_VOLUME_DOWN
26 - KEYCODE_POWER
27 - KEYCODE_CAMERA
28 - KEYCODE_CLEAR
29 - KEYCODE_A
30 - KEYCODE_B
31 - KEYCODE_C
32 - KEYCODE_D
33 - KEYCODE_E
34 - KEYCODE_F
35 - KEYCODE_G
36 - KEYCODE_H
37 - KEYCODE_I
38 - KEYCODE_J
39 - KEYCODE_K
40 - KEYCODE_L
41 - KEYCODE_M
42 - KEYCODE_N
43 - KEYCODE_O
44 - KEYCODE_P
45 - KEYCODE_Q
46 - KEYCODE_R
47 - KEYCODE_S
48 - KEYCODE_T
49 - KEYCODE_U
50 - KEYCODE_V
51 - KEYCODE_W
52 - KEYCODE_X
53 - KEYCODE_Y
54 - KEYCODE_Z
55 - KEYCODE_COMMA
56 - KEYCODE_PERIOD
57 - KEYCODE_ALT_LEFT
58 - KEYCODE_ALT_RIGHT
59 - KEYCODE_SHIFT_LEFT
60 - KEYCODE_SHIFT_RIGHT
61 - KEYCODE_TAB
62 - KEYCODE_SPACE
63 - KEYCODE_SYM
64 - KEYCODE_EXPLORER
65 - KEYCODE_ENVELOPE
66 - KEYCODE_ENTER
67 - KEYCODE_DEL
68 - KEYCODE_GRAVE
69 - KEYCODE_MINUS
70 - KEYCODE_EQUALS
71 - KEYCODE_LEFT_BRACKET
72 - KEYCODE_RIGHT_BRACKET
73 - KEYCODE_BACKSLASH
74 - KEYCODE_SEMICOLON
75 - KEYCODE_APOSTROPHE
76 - KEYCODE_SLASH
77 - KEYCODE_AT
78 - KEYCODE_NUM
79 - KEYCODE_HEADSETHOOK
80 - KEYCODE_FOCUS
81 - KEYCODE_PLUS
82 - KEYCODE_MENU
83 - KEYCODE_NOTIFICATION
84 - KEYCODE_SEARCH
85 - TAG_LAST_KEYCODE

Credits:

1. http://forum.xda-developers.com/showthread.php?p=28484300
2. http://forum.xda-developers.com/showthread.php?t=1209567


Linux CPU flag checking for 64bit and virtualization!

This might save you some time, the easiest way to determine if a system supports 64bit and virtualization in Linux is to look at the output of: cat /proc/cpuinfo

The line(s) your looking for like something like this:
flags    : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt lm 3dnowext 3dnow rep_good nopl extd_apicid pni lahf_lm cmp_legacy

Depending on your hardware you may have many flag lines... the interesting flags which you need to look out for:

lm - 64bit support - (Long Mode - 64bit Extensions, AMD AMD64 or Intel EM64T)
vmx - Inter Virtualization - (Virtual Machine eXtensions)
svm - AMD Virtualization - (Secure Virtual Machine)

If the flags above appear you have support the the respective CPU feature. The easier way (but harder to remember) is to run:

64bit check: egrep -c ' lm ' /proc/cpuinfo
Virtualization check: egrep -c '( vmx | svm )' /proc/cpuinfo

The output above counts how many times the specified flag(s) appear, anything more than 0 indicates you have support.


Wednesday, 22 August 2012

Nexus Q in South Africa

I found a Nexus Q on a local auction site last week, after the initial shock passed of seeing one locally, I jumped into action and before long had a courier company at my door!

The local seller seems to have tested the device briefly as it's in a brand new condition and must have found out with a shock that it isn't supported in South Africa yet after paying thousands to import it....

I was however keen on getting it to work and getting it at a bargain price was all the more reason!

Before I could start playing I found myself at a nearby gadget store buying a micro HDMI to DVI converter (it comes with a branded micro HDMI to the usual larger HDMI plug - Type A - cable), a converter for the US plug the power supply (100 to 240 Volt) comes with and 4 banana plugs...

The feel of the device itself is amazing, it almost feels alien to hold it and it definitely has an unexpected weight to it!

I'm still however not to sure how well the volume control (the top half of the device can rotate a full 360 degrees while pushing it down mutes the sound) will survive general use and abuse, especially during a social event as mentioned in the intro video for the Nexus Q. Especially as everyone so far that finds the device between all the gadgets I have is immediately temped to pick it up by grasping the volume control part head-on...

The banana plugs were also a surprise as I haven't seen them much the last while. I only had stereo mini jacks and RCA connectors in my office (all my speakers are pretty much the same, not exactly an audiophile although I'm sure Vienna Acoustics speakers with banana plugs would have been great!). I'm pretty sure many users would have to go out and buy a cable to convert the banana's to something else...
Being a huge fan of Android (as you can see to the left, hehe) welcoming the Nexus Q to the family was a no-brainer!

Although the device has received many negative reviews (many with merit), the Nexus Q really has a nice design (if the volume control is solid...?) and has great hardware specs, especially for a media streamer...

The software side however really leaves one with this "what the heck is this" feeling, it's like watching a great movie only to find the budget ran out while they were working on the most important, to me in any case, end part!

I was expecting a proper Android device like layout with proper interface etc. boy was I in for a surprise!

When my uncle came close to the Nexus Q with his  Samsung Galaxy S3 it lit up and vibrated with joy, very cool indeed!

By not being in the US of course Google Play prevented the software from being installed on the first try, leaving the Q in it's welcome screen mode, effectively a paper weight!

Luckily getting past this problem involved a bit of crafty geek work after which setting up the Nexus Q was a breeze! Watching movies and music first uploaded to the cloud isn't much of a turn on for me, really sucks in fact as Google has assumed the world is well connected which always the case! Effectively leaving me with a YouTube streaming device with limited features, although I have a few plans to improve the device.

Cost wise - I would have been really upset if I paid the full price for this device... especially considering that I could whack my tablet or Android dongle into the same micro HDMI port and without effort connect the stereo mini jack for a great full featured multimedia experience without waiting for each item to stream and re-stream with each view...

Ideally the next step for me would be to get a proper working Android version on the device. Ultimately I would have appreciated a device from Google with a smartphone like Android on and additional apps for the media streaming parts. Hopefully once Google have improved the Nexus Q and start shipping it again the software on the device will give the power back to the user!

Google Nexus Q playing a YouTube video in South Africa


Monday, 20 August 2012

Network Engineering at Best?

Sooooo what do you do when your out in the field and realize that you've forgotten your belt in the rush to get working on a network job...?

I managed to get into the same pickle a few weeks back and being a network guy I figured what better than a makeshift belt from a piece of old Cat 5e cable... besides a bit of discomfort while pulling cables through a ceiling it did the job quite well!

Version 2.0 is below, only problem being you need to crimp a RJ45 when you lose weight and find a new piece of Cat 5e if you gain some!

I have however moved back to the trusty old belt but figured I'd share the experience!

Saturday, 18 August 2012

I found some really reliable fans!

I got the chance today to open up a server rack at a client that I've been eager to open for a good few years... I've always wanted to find out what brand of fan could survive a harsh environment 24/7 for the past 4+ years without failing...

The rack itself receives very little maintenance, lives in a busy school office with temperatures at times exceeding 35°C (95°F) and basically only gets looked at when a problem arises.
The rack itself is maintained by another company, a pity as I would love to get it in a better state!

So the best fans I have seen in a very long time and would highly recommend is from a company called FullTech (http://www.fulltech.com.tw/)

Ironically at the same time I was playing around I found a busted fan in one of my devices (the device is only about 2 years old) in the exact same rack... The fan in this case was so full of dust it simply stopped and was overheating, even trying to push the fan blades resulted in little if any movement...


Tuesday, 14 August 2012

Asus Zenbook Prime UX31A Unboxing!

My uncle recently purchase a brand new Asus Zenbook Prime UX31A on Amazon, saving more than $300 when compared to the best available local price. Asus have taken great care to ensure the box is properly padded for transportation and in this case luckily survived the 8600+ mile journey in the cargo hold of a commercial airline...

The Zenbook ships with a standard 19 volt power supply (which has the mini version of a Windows license sticker on it, I was temped to load Linux for my uncle but unfortunately he wasn't to keen on the idea...), a USB to ethernet converter, and convenient carry pouch.

Asus has really put effort into making the Zenbook look great - from the very nice metal finish of the body to illuminated keyboards. Additionally adding the pouch and USB to ethernet converter is great gesture on their part as I'm sure other companies would have excluded them as paid accessories...

While we received the Zenbook completely discharged we were up and running in no time (after finding the correct converter!)

The 1920 x 1080 resolution is definitely impressive! I was however at first concerned about white looking a bit to yellow for my liking... this however turned out to just be a gamma corrected profile which was enabled by default for the Intel graphics card and is easily toggled to a different profile.

We also compared the size difference between the Zenbook and Macbook Air (photo to the left and below). The Macbook Air remains a great device but the Zenbook managed to convince one of the most avid Apple fans I know to switch over to using the Zenbook instead....

Personally I still only own a normal i5 notebook as I'm not convinced that Ultrabooks are worth the it at their current retail price, although I'm sure they will become a future standard...
Macbook Air vs Asus Zenbook Prime
Asus Zenbook Prime on top of a Apple Macbook Air

Saturday, 4 August 2012

Linux "iostat" command...

I recently discovered the "iostat" command while debugging a slow database input/output problem... If you have a large amount of database reads/writes the iostat command can tell you how your disks are performing which in turn has a huge influence your a busy database...

You can install iostat on Ubuntu machines using:


sudo apt-get install sysstat


Command for a specific disk eg /dev/sda and updated every second:
iostat -dmx /dev/sda 1

Command for a quick once off overview of all disks:
iostat -dmx  (you can add space separated disks here too, eg. sda sdb)



The arguments used above:

-d (device utilization report)
-m (display in MB)
-x (extended statistics)



Sample output:


The %util column is the first one you'll want to keep an eye on as the server is actively being used. Basically it shows us how saturated the controller is for the specific device, if this percentage is constantly high the controller is working hard to keep up with the read/write requirements and could be a good indication that you maybe need to re-evaluate the server's hardware to accommodate the IO...

The other columns of the report as per the man page:


rrqm/s - The number of read requests merged per second that were queued to the device.
wrqm/s - The number of write requests merged per second that were queued to the device.
r/s - The number (after merges) of read requests completed per second for the device.
w/s - The number (after merges) of write requests completed per second for the device.
rsec/s (rkB/s, rMB/s) - The number of sectors (kilobytes, megabytes) read from the device per second.
wsec/s (wkB/s, wMB/s) - The number of sectors (kilobytes, megabytes) written to the device per second.
avgrq-sz - The average size (in sectors) of the requests that were issued to the device.
avgqu-sz - The average queue length of the requests that were issued to the device.
await - The average time (in milliseconds) for I/O requests issued to the device to be served. This includes the time spent by the requests in queue and the time  spent  servicing them.
r_await - The  average time (in milliseconds) for read requests issued to the device to be served. This includes the time spent by the requests in queue and the time spent servicing them.
w_await - The average time (in milliseconds) for write requests issued to the device to be served. This includes the time spent by the requests in queue and the time spent servicing them.
svctm - The  average service time (in milliseconds) for I/O requests that were issued to the device. Warning! Do not trust this field any more.  This field will be removed in a future sysstat version.
%util - Percentage of CPU time during which I/O requests were issued to the device (bandwidth utilization for the device). Device saturation occurs when this value is close to 100%.


Thursday, 2 August 2012

MySQL to CSV quick one-liner

MySQL to CSV quick one-liner syntax example:

SELECT * INTO OUTFILE '/tmp/result1.csv' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' ESCAPED BY '\\' LINES TERMINATED BY '\n' FROM USERS WHERE USERNAME LIKE 'A%';

Raspberry Pi

I recently got my hands on a Raspberry Pi (Model B) and immediately started playing around with it...

First impressions - amazingly small device (exactly the size of a business card and slightly larger than an Arduino). The Pi has 256MB of RAM, 700MHz Broadcom BCM2835 ARM processor, and a GPU capable of 1Gpixel/s!

I was skeptical at first about getting my own but ordered my own shortly after playing around with this Raspberry Pi....

The composite port is also a very nice to have, overall the Raspberry Pi seems like a great option for embedded like scenarios (Kiosks come to mind), enthusiasts and would work a charm in school IT classes, perhaps helping to bring back some fun while learning how to program!

Software wise - Many Raspberry Pi (nice list here) ready images are available for download and can be copied over to the SD card using something like dd in Linux or Win32DiskImager in Windows, some even have a full on installer like the Fedora Remix.

I'm busy playing around with Android ICS on Pi with limited success. The memory available on the Pi (256MB) poses a problem as the memory requirements of Android ICS is 340MB (as per the documentation). Previous versions of Android have been reported to work but appear a bit sluggish... I'll continue the attempt and keep this blog updated!
My "Wish List" for the next model, even if at a slightly higher cost, or maybe they could have a high end line?
  • 256MB of memory is simply to little use the board effectively for all the projects I have in mind... if they could just increase it to double the size at least...
  • CPU is easily overpowered, especially with quad core ARM processors already available, a single 700MHz isn't enough
  • Wireless, ethernet port is a great to have but wireless without a dongle would be an awesome addition
  • Additional booting options, eg. booting from something like USB flash drives etc. without it being a mission!



Quick Debian/Ubuntu Wireless from Terminal


To connect to a wireless network from command line can be a bit of a challenge I encountered recently on a Raspberry Pi device... The easiest way to go about it without many more commands:

Become root user or use sudo before each command below:

1. iwconfig  (Look for the device with IEEE 802.11, usually wlan0 or eth1)
2. nano /etc/network/interfaces
 2a. Add the interface found is part of the auto line, mine looks like this:
       auto lo eth1
 2b. Add the following to the file below the other lines:
       iface eth1 inet dhcp  (change eth1 if your interface differs)
       wpa-ssid aironet.onms.net (the wireless network name)
       wpa-psk JellyBean (The WPA-PSK or WPA2-PSK passphrase)


The above assumes the wireless setup is similar to most I've configured/seen out in the field, if yours is not drop a comment and I'll help you out!

To start the connection run: ifup eth1 (or your interface name)
To stop the connection run: ifdown eth1 (or your interface name)


Hope the above helps someone!