tag:blogger.com,1999:blog-42191900228187870332024-02-07T01:21:03.862-05:00ddurdleTalking about
<a href="/search/label/pi">Raspberry Pi</a>, <a href="/search/label/Linux">Linux</a>
and
<a href="/search/label/XBMC">XBMC</a>.Anonymoushttp://www.blogger.com/profile/16677545615031598278noreply@blogger.comBlogger59125tag:blogger.com,1999:blog-4219190022818787033.post-17770549484101647262014-12-08T10:53:00.003-05:002014-12-08T10:53:48.465-05:00BTRFS - One Year LaterIt was a year ago when I decided to give BTRFS a try. Prior, I was using primarily EXT4 partitions, with a few XFS partitions on really slow HDs (4200rpm).<br />
<br />
It was also about a year ago that I started using LXC (Linux Containers). I needed a way to maintain multiple LXCs while reducing disk storage overhead. Initially, this is what caught my attention for BTRFS. BTRFS provided a typical journaled Linux filesystem a keen to EXT4, but provided "snapshot" and "cloning" a keen to QCOW2 with KVM. I could maintain multiple LXC containers, and let them share common files, reducing disk consumption. With BTRFS, I could clone or snapshot LXC instances and avoid duplication -- only worry about storing the changes between instances. There are not many filesystems that provide this ability while still maintaining properties associated with a typical EXT filesystem and avoid using a file container like QCOW2. I immediately started using a BTRFS filesystem for storing all my LXC instances.<br />
<br />
Since my LXC usage was recreational and non-critical, I experimented with subvolumes, snapshots (including read-only), compression and a few other features of BTRFS. Having encountered no stability or reliability issues, in the summer of 2014, I decided to give BTRFS a trial run as the primary filesystem for a new Linux Thinkpad. BTRFS proved beneficial for me for LXC, and the snapshot functionality could equally provide me benefits from effortlessly backing up and rolling back Linux upgrades in the future. Prior, whenever I moved to new update packs (distro upgrades) in LMDE (Linux Mint Debian Edition), I would create a clonezilla backup -- obviously an offline process, that required me to boot up with a clonezilla image to perform the backup. I've had to rollback upgrades previously, for all kinds of reasons.<br />
<br />
Like I typically do, I cloned a Linux EXT4 image of a working system (using Clonezilla) to the new system. I utilized the BTRFS tools to convert the EXT4 image to a BTRFS filesystem. Since the conversion process doesn't modify the data itself (only the inodes or meta data), it was a relatively quick process (mere minutes) and provides an equally quick process to rollback the filesystem back to EXT4. I even (successfully) tested the rollback.<br />
<br />
It was around this time I had my first BTRFS data disaster. Ironically, it had nothing to do with the new system but on an existing system where I was using BTRFS only for LXC storage. I had previously encountered situations where I would find myself with my LXC storage mounted in "read only". A reboot would cure the issue, but I wasn't sure what was triggering the situation. I was convinced that hibernating the system while LXC were running may have been causing the issue, so I modified my hibernation scripts to explicitly freeze any running LXC instances prior to hibernating.<br />
<br />
One day when the problem had surfaced, I decided to resolve the issue by remounting the BTRFS subvolumes as read-write. This proved disastrous.<br />
<br />
When simply unmount and remounting in rw failed, I decided to try using the BTRFS fsck equivalent to examine the filesystem and fix any errors. There were reported errors with the BTRFS structure, later which I determined to be false, but I attempted to fix these issues. <b>That was my first mistake</b>. I was not aware that the BTRFS filesystem repair utilities are wildly experimental and inherently will corrupt and cause further problems. Warnings throughout the net, reiterate not to use btrfsck to try to repair filesytems. Why does the tool exist, I cannot be certain, but definitely one day the tool may provide some kind of meaningful function. My use of the tool led to a corrupt BTRFS root filesystem, which could no longer be mounted. By virtue that the root filesystem was corrupt, all subvolumes were inaccessible and considered lost.<br />
<br />
I had later determined that my BTRFS filesystem was never initially damaged or corrupt (at least, prior to running btrfsck). I discovered that whenever I had encountered that my BTRFS had been mounted or remounted as read-only had only occurred after shutting down an LXC. I quickly realized that the mount scripts installed in some of the init.d routines on a number of my LXC were "successfully" causing my BTRFS subvolumes (or root filesystem itself) to unmount and remount in ro. I had not seen this behaviour with EXT4. And because I don't usually shutdown my LXCs without rebooting the host itself, the issue was rarely triggered. So, the issue was never caused or contributed to hibernating the host. By simply not shutting down the LXC (use halt or leave them running and let them stop when the host shutsdown) or by removing/disabling these mount scripts, the problem was resolved. I have not encountered the issue since.<br />
<br />
I was very lucky in the disastrous scenario. I had lost the entire filesystem hosting all my LXCs on one system, but because I had used the send/receive functionality in BTRFS to "clone" or backup my LXCs from the system to a central hard drive, I was able to simply "receive" backups of the filesystems back onto the drive. My LXCs don't contain data, themselves, so the instances are fairly static. The disaster let me at least validate recovery of the filesystems from backups.<br />
<br />
But from the disaster and my other day-to-day experience with BTRFS on various systems for LXC storage and on the newly setup laptop using BTRFS as the primary drive, here is my list of cautions when using BTRFS:<br />
<br />
<b>1) BTRFS is considered "stable" but is still being highly developed.</b><br />
For this reason, use the most current "stable" kernel as you can. I would not consider using anything less than 3.13 for day-to-day use, and definitely nothing less than 3.10. If you don't have other issues or reasons to not use 3.15, I would highly recommend 3.15 be your day-to-day kernel release. The most current BTRFS changes are in 3.15 and there has been a considerable amount of enhancements and fixes that might prevent unnecessary issues.<br />
<br />
<b>2) "Stable" but not necessarily "production" ready.</b><br />
Considering the repair tools themselves are destructive, I would not use this filesystem for "data" storage. For example, I would not use these filesystems to store primary or sole backups of data. I continue to use EXT3 and EXT4 with it's journaling and widely reliable and stable filesystem tools (such as fsck). Generally, my "data drives" are mirrored across different hardware to account for hardware failure. When proper processes are followed (performing clean dismounts and syncs), I haven't encountered a filesystem corruption issue that journaling could not resolve. When that day occurs, the fact I maintain mirror devices will hopefully assist with recovery. Accounting for the fact that these tools can be considered not production ready for BTRFS, you have no recourse to address filesystem corruption caused by software error, human error or hardware failure. Even with mirroing, it is plausible that if your only recourse is to restore your data, there is a higher probability of a double-failure, where both mirrors fail, when using a filesystem that doesn't provide for reliable recovery. Thusly, on systems where there is constant turn of data, I would also not recommend BTRFS. On systems such as laptops for the primary operating system filesystem, as long as you have backups of the filesystem on other devices to restore from, I would recommend you do included BTRFS for your consideration. However, if these systems are critical, where downtime is not tolerable, I would approach with caution. If you are using the filesystem on a primary laptop while traveling, I would make sure a copy of the filesystem or alternative filesystem be accessible either on a memory key or flash device. If you are traveling (where obviously you may not have your backup drives with you) and unfortunately encounter an issue with your filesystem for which you can't boot or mount your system, you'll need that alternative boot device.<br />
<br />
<b>3) Don't treat subvolumes within the same device as your sole-backups.</b><br />
If you create subvolume snapshots and store them on the same root filesystem, then don't considered these backups. They'll prove worthwhile for rolling back changes on your primary filesystem, but if you encounter a hardware failure or corrupt your root filesystem, your subvolumes will serve no purpose.<br />
<br />
<b>4) Mount subvolumes only, wherever possible.</b><br />
Instead of mounting your root filesystem to access your subvolumes, consider only mounting your subvolumes. Human errors such as a "rm -rf *" on your root filesystem will take out all your subvolumes, but the same human error when performed on a subvolume will only affect the subvolume itself. Likewise, if you encounter a bug or other filesystem corruption, if only your subvolume is mounted at the time, the risk to the root filesystem (and thus, other independent subvolumes) should be unaffected.<br />
<br />
<b>5) Use send/receive to store mirror copies of your subvolumes to other devices.</b><br />
When backing up, generate a read-only snapshot (snapshots are essentially free in terms of disk storage), and send these snapshots to a suitable BTRFS filesystem stored on a separate disk. Space-saving properties are maintained when transmitting your backups. Use these read-only snapshots as a reference point. Create your read-write filesystems as snapshots of these.<br />
<br />
<b>6) Track your snapshots and subvolumes by using logical naming and track hierarchies in a text file.</b><br />
If you are creating a lot of subvolumes, performing a lot of snapshots and sending/receiving (cloning) your filesystems across multiple systems, it is smarter to ensure the subvolumes and snapshots include references in their name such as source and date. Also, I recommend tracking this to a text file, to track which subvolume originated from which snapshot and is shared with which systems. As you start having branches distributed among multiple targets, it'll be harder to trace the origin of a particular subvolume in the future. I store this information in a text file typically found in the root filesystem so that I don't rely on memory or tracing through output from tools to familiarize or validate the origin of any given subvolume.<br />
<br />
<b>7) Use compress with lzo whenever possible.</b><br />
When comparing performance with EXT4, BTRFS can sometimes perform "on par" but generally can be 3x slower in some real-world situations. The ability to have inherent compression in the filesystem, coupled with the "lighter' lzo compression algorithm, a BTRFS drive will perform better than EXT4. Your individual situation needs to be evaluated to determine if the benefits of BTRFS will outweigh the performance risks. Understanding under what situations BTRFS will perform well is critical. Generally in random read-write scenarios (most predominately on filesystems housing databases), BTRFS will under perform to EXT4 by up to 3x. Compression in this case provides little or no benefit because the data tends to be in a state not suitable. In cases where data is primarily read, BTRFS with lzo compression will outperform EXT4. In situations such as a primary filesystem for a Linux distro on a laptop, you are generally reading and loading programs, so the benefits of BTRFS will outweigh the costs.<br />
<br />
<b>8) Understand how the benefits <i>will</i> <i>actually</i> help you.</b><br />
For example, of the benefits of BTRFS that I haven't touched on is built in filesystem checksum tracking. This means the filesystem has a means of checking for corruption from such bit rot, etc. On an EXT4 filesystem, bits that have changed, files that have become corrupt from reasons other than from journal errors or apparently hardware failures, is detectable as the filesystem tracks the checksum of files. Although bit rot is not new, it is increasingly becoming more common as society moves to cloud-storage (where bits are stored elsewhere and can be lost or distorted from transmision) and to SSD or other flash devices where data corruption is not caused by traditional hardware failures such as heads smashing into platters, or loss of magnetic polarity / or magnetic interference, but by memory chips failing, electrical interference, wear-and-tear on the chips themselves or by software error/bugs in the controllers managing the data on the SSD devices. But you have to understand what the benefit really is. Bit rot on a EXT4 filesystem will most likely not occurring unless you access the data file and realize it is corrupt (if you even realize it). It could be as simple as a corrupt number being incorrect on a spreadsheet or an "artifact" in a media file. You may not realize the data is corrupt (and if you backup the corrupt data to another device, your backup will become corrupt). You would have to exert ongoing effort to track checksum values on files and determine which changes in checksum values are due to valid file changes and those introduced by bit rot. However, like on EXT4, identifying bit rot is only part of the solution. On an EXT4 filesystem, you would replace the corruption with a "known good" version of the file that is stored elsewhere. Likewise, the checksum benefit in BTRFS is the same. It does not provide a means to fix corruption, only the means of detecting it. Throwing away your backups because your filesystem can detect bit rot corruption does not mean it will provide you a means to automatically repair the bit rot. There is a difference between <i>perceived</i> benefit and <i>actual</i> benefit.<br />
<br />
My year-long experiment with BTRFS has been successfully and for reasons already explored in previous posts or ones to be explored in future posts, I'll continue to expand my use of BTRFS in the years to come.Anonymoushttp://www.blogger.com/profile/16677545615031598278noreply@blogger.com1tag:blogger.com,1999:blog-4219190022818787033.post-51358883460306985632014-08-27T22:04:00.000-04:002014-08-27T22:05:25.068-04:00Linux Mint Debian Edition (LMDE) UP8 on Thinkpad X131e<br />
I recently acquired a Thinkpad X131e. It's the 3372-3FU, which is the AMD -- meaning AMD CPU, ATI Radeon HD <span style="background-color: white; color: #545454; font-family: arial, sans-serif; font-size: x-small; line-height: 20px;">7340</span>, and Broadcom wifi. I'm used to Intel-based systems and Nvidia Optimus systems (with Intel as fallback).<br />
<br />
Having previously used a system with broadcom wifi chipset, I knew I would need to load some non-free, closed-source wifi drivers on this new system.<br />
<br />
<h3>
Getting Started</h3>
I replaced a Thinkpad X61t (tablet) system for this system. The Thinkpad X61t had my standard LMDE install with Update Pack 8. It had a Intel CPU (core 2 duo), Intel Centrino wireless and OCZ Vertex 3 60-SSD.<br />
<br />
I thought I would at least be able to transplant the SSD and boot into my install (perhaps with no wifi and fallback to default drivers for video).<br />
<br />
My first challenge was with the SSD.<br />
<br />
<h3>
Low Profile Drive</h3>
<div>
I had completely neglected that the industry created a new and shorter kind of 2.5" hard drive standard. The drives are 7mm tall versus the standard 9.5mm. My 2 year-old OCZ Vertex 3 drive would not fit in this Thinkpad X131e, that apparently uses the "low profile" 7mm standard drives.</div>
<div>
<br /></div>
<div>
I realized by looking at the SSD case, that most of the cases was likely just "filler". What stopped me from finding out was a "warranty void" sticker. Having still 1 year warranty on the drive, I decided to go for it, and void my warranty -- if the drive dies, I'll be eager to replace it by a larger drive anyways. Opening up the drive, I realized my intuition was correct -- the SSD consisted of a slim board (no bigger than 5mm in depth). I kept the bottom of the case for protection from the board ever meeting contact with the metal bottom of the laptop, and placed a plastic insulator sheet adapted from an old 2.5" HD caddy on the top side of the drive (to avoid the top portion making contact with the laptop case door). Warranty issue aside, the SSD issue was resolved.</div>
<div>
<br /></div>
<div>
<h3>
Wifi causes Linux to hang at startup</h3>
</div>
<div>
I quickly realized that upon bootup that I couldn't make it past the init.d startup scripts without the laptop completely hanging. I did a trial-and-error, disabling the startup services (by starting up in recovery mode, dropping me to a root prompt before the services start up). In the /etc/init.d directory, you can simply remove the execute permission on startup services that you suspect are causing the issue, and then trial-and-error until you find the offending service. I realized quickly that it was the networking service causing issues, and shortly after that, the wifi in particular. To allow me to at least boot up the system with ethernet, I needed to completely disable wifi. It was not sufficient to log onto the BIOS and disable the Wireless LAN antenna. I found I needed to go to IO Port Access and disable Wireless LAN. Upon doing this, I was able to boot up with a network connection (over ethernet).</div>
<div>
<br /></div>
<div>
<h3>
Installing broadcom wifi drivers</h3>
</div>
<div>
<br /></div>
<div>
Fairly simple to do. With a proper working internet connect over ethernet, I was able to run:</div>
<div>
<br /></div>
<div>
sudo apt-get install broadcom-sta-dkms</div>
<div>
<br /></div>
<div>
This downloaded and installed the kernel modules for the broadcom wifi.</div>
<div>
<br /></div>
<div>
<div>
Broadcom STA is a binary-only device driver to support the following IEEE</div>
<div>
802.11a/b/g/n wireless network cards: BCM4311-, BCM4312-, BCM4313-,</div>
<div>
BCM4321-, BCM4322-, BCM43224-, BCM43225-, BCM43227-, and BCM43228-based</div>
<div>
hardware.</div>
</div>
<div>
<br /></div>
<div>
After re-enabling Wireless LAN in IO Port Access, I was able to boot up with a wifi connection.</div>
<div>
<br /></div>
<div>
<h3>
Xserver fails</h3>
</div>
<div>
With xorg not understanding AMD/ATI graphics with a regular install (get the error No Screens Found on startup of xorg/xserver), I realized I needed to install some working graphic drivers. </div>
<div>
<br /></div>
<div>
Avoiding the debate over installing the latest open-source drivers or the closed-source proprietary drivers, I decided to opt for the proprietary which happen to be fairly up-to-date.</div>
<div>
<br /></div>
<div>
I made my first mistake by trying to install the ATI Catalyst 14.10 and 14.20 beta drivers from the Linux section on the ATI website. The installer installs the drivers successfully, but the installer isn't actually doing anything. Trying to run the buildpkg manual method with the software fails, and you end up going in an endless loop of troubleshooting. I wasted a day after realizing I simply won't be able to use the installer method as its designed to only install to a 32-bit system, whereas I'm using a 64-bit install.</div>
<div>
<br /></div>
<div>
I decided to use the Debian repository instead. I already had the non-free directive in my apt source.list file. I simply followed the instructions found on the Debian Wiki for ATI (<a href="https://wiki.debian.org/ATIProprietary">https://wiki.debian.org/ATIProprietary</a>). </div>
<div>
<br /></div>
<div>
Making sure I already had the linux-headers for my kernel installed (uname -a showed 3.11-5.dmz.1-liquorix-amd64, so I ensured I had the linux-headers installed by running sudo apt-get install linux-headers-3.11-5.dmz.1-liquorix-amd64). Next I installed the ATI drivers by running:</div>
<div>
<br /></div>
<div>
sudo apt-get install fglrx-driver</div>
<div>
<br /></div>
<div>
After the kernel driver installs, you need to have the installer configure xorg to understand how to work with ATI. You would run:</div>
<div>
<br /></div>
<div>
sudo aticonfig --initial</div>
<div>
<br /></div>
<div>
Apparently, if the kernel module fails to build/install/load, the aticonfig changes to xorg are sufficient enough to get X windows to load with a fallback graphic driver. It will be a display with a slow refresh rate with other performance factors, but it will load. I realized that the version included with Update Pack 8 doesn't compile the module properly for the Linux Kernel 3.13 that I had installed. Apparently ATI announced it does not yet support Linux Kernel > 3.11. I did find references to patches people have created to get the kernel modules to build on 3.14, etc, but to deal with that on another day, I decided to just use Linux Kernel 3.11. I was able to successfully build and load the ATI Catalyst 13 Beta drivers in the Linux Mint Debian Edition Update Pack 8 repository. Backlight adjusting via function key was working properly with the proper module loaded -- on the fallback, the backlight function keys don't work, a sign you are falling back. </div>
<div>
<br /></div>
<div>
<div>
Now, if you boot up the system, you should have wifi and proper working X windows.</div>
</div>
<div>
<br /></div>
<div>
With the proper driver loaded, 3D acceleration is supported (and the ATI control panel will work). The command <span style="background-color: white; color: #333333; font-family: UbuntuRegular, Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 14px; line-height: 18px;">fglrxinfo </span>will return a GL version number. When fallback driver is active, you won't receive a GL number with <span style="background-color: white; color: #333333; font-family: UbuntuRegular, Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 14px; line-height: 18px;">fglrxinfo. </span>Further<span style="color: #333333; font-family: UbuntuRegular, Ubuntu, Bitstream Vera Sans, DejaVu Sans, Tahoma, sans-serif;"><span style="font-size: 14px; line-height: 18px;">, with the proper drive loaded, if you perform a lsmod, there will be a </span></span>fglrx driver loaded.</div>
<div>
<br /></div>
<div>
<br /></div>
<h3>
Additional Notes</h3>
<div>
After some reading, I decided to add the directive "nomodeset" to my grub.cfg.</div>
<div>
<br /></div>
<div>
Compiz wouldn't load correctly (window manager crashed, windows displayed without a window manager, etc). I expected compiz to work with a near-latest ATI proprietary driver installed and loaded (with 3D kernel module compiled and loaded). I did read that the latest open-source ATI driver SHOULD have compiz support also working when the Mesa GL lib is also loaded. Naturally you cannot have both open and closed source drivers installed on the system at the same time. Once I have things stable, I will troubleshoot further.</div>
<div>
<br /></div>
<div>
<h3>
Hibernation/Suspend</h3>
<h2>
<span style="font-size: small;"><span style="font-weight: normal;">I use pm-suspend and pm-hibernate setup with laptop tools on all my systems. Both fail to suspend or hibernate the system. I can suspend and resume successfully by running as root:</span></span></h2>
</div>
<div>
<span style="font-size: small;"><span style="font-weight: normal;">echo "mem" > </span></span>/sys/power/state</div>
<div>
<br /></div>
<div>
The same trick for hibernation, </div>
<div>
<br /></div>
<div>
<div>
<span style="font-size: small;">echo "disk" > </span>/sys/power/state</div>
</div>
<div>
<br /></div>
<div>
results in a system that cannot thaw from hibernation properly. Running the hibernate command does work though.</div>
<div>
<br /></div>
<div>
Therefore, I use the following two commands</div>
<div>
<br /></div>
<div>
to suspend:</div>
<div>
<div>
<span style="font-size: small;">echo "mem" > </span>/sys/power/state</div>
</div>
<div>
<br /></div>
<div>
to hibernate:</div>
<div>
hibernate</div>
<div>
<br /></div>
<div>
<br /></div>
Anonymoushttp://www.blogger.com/profile/16677545615031598278noreply@blogger.com0tag:blogger.com,1999:blog-4219190022818787033.post-83857871874923614732014-06-24T12:57:00.001-04:002014-06-24T12:57:10.185-04:00Adding exFAT support for LinuxI recently stumbled across a need to store > 4GB files on my 32GB microSD card. It naturally came formatted in FAT32 and I needed to keep compatibility with a device that requires FAT32 or exFAT format types.<br />
<br />
exFAT does support file sizes > 4GB, so I needed to reformat the card, but I noticed that Linux Mint Debian Edition (LMDE) or Debian, doesn't support exFAT natively out-of-the-box.<br />
<br />
To gain support, install exfat-fuse exfat-utils<br />
<br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">sudo apt-get install exfat-fuse exfat-utils</span><br />
<br />
<br />
Then, to format your microSD card (or other device):<br />
<br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">sudo mkfs.exfat /dev/mmcblk0p1</span>Anonymoushttp://www.blogger.com/profile/16677545615031598278noreply@blogger.com0tag:blogger.com,1999:blog-4219190022818787033.post-56411813152932485492014-06-20T00:52:00.003-04:002014-06-20T00:52:51.209-04:00Rejuvenating the DLINK DNS323 NAS with alt f <br />
I've purchased three of the DLINK DNS323 over the years. I retired the units a number of years ago because of the issues discussed below.<br />
<br />
<h3>
Problematic support for 4k sector sizes</h3>
The user needs to format drives that use 4k sector sizes in a firmwae image that supports it (which is the last, 1.10), but the community of users have pointed out various bugs and issues with 1.10, suggesting users not use this firmware on an ongoing basis. Therefore, for the purposes of formating (and properly aligning the sectors on these drives), it is recommended the user ugprade their firmware to 1.10 and immediately downgrade to 1.08 after formatting. You just need to setup the drives on a supported firmware -- you don't have to actually persist using that firmware.<br />
<br />
<h3>
No support for EXT4</h3>
No sense staying with EXT3 when journaling is significantly better in EXT4.<br />
<br />
<h3>
No support for hard drives > 2.2TB (such as 3TB drives)</h3>
With the official firmware updates retired, no new hard drives will ever be supported officially.<br />
<br />
<h3>
No GPT partition tables (only MBR)</h3>
Along the reasons of not supporting newer, larger hard drives.<br />
<div>
<br /></div>
<h3>
Formatting the wrong drive bug</h3>
Although DLINK recognized the problem in earlier firmware images and says they corrected it, I personally encountered the issue when a pre-existing drive was formatted by the firmware instead of the selected new drive, despite both drives having different sizes, different manufacturers and different models -- therefore, not a mistaking the identify of the correct drive to format.<br />
<br />
<br />
Last year I came across alt f, a free alternative firmware for these NAS units. I flashed it on one of the NAS units and never looked back. It really breaths life into these old units. I've been making use of my obsolete and retired NAS units.<br />
<br />
The primary features that stand out for me are:<br />
<br />
<ul>
<li>Support for EXT4</li>
<li>Support for GPT</li>
<li>Support for larger/newer hard drives (3TB, 4TB, etc)</li>
<li>Use pre-existing hard drives without reformatting or modifying the partition tables</li>
<li>Support for NTFS drives in the left and right bay (in addition to USB)</li>
<li>RAID that includes support for drives over the USB port</li>
<li>ffp package support builtin</li>
</ul>
<br />
<div>
I've put together a video walkthrough below of alt f firmware.</div>
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<object class="BLOGGER-youtube-video" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" data-thumbnail-src="https://ytimg.googleusercontent.com/vi/_fDgtOKJGyM/0.jpg" height="266" width="320"><param name="movie" value="https://youtube.googleapis.com/v/_fDgtOKJGyM&source=uds" /><param name="bgcolor" value="#FFFFFF" /><param name="allowFullScreen" value="true" /><embed width="320" height="266" src="https://youtube.googleapis.com/v/_fDgtOKJGyM&source=uds" type="application/x-shockwave-flash" allowfullscreen="true"></embed></object></div>
<br />Anonymoushttp://www.blogger.com/profile/16677545615031598278noreply@blogger.com1tag:blogger.com,1999:blog-4219190022818787033.post-55118841088077653592014-06-19T21:00:00.000-04:002014-06-19T21:00:17.475-04:00USB Logitech microphone support in Kazam on LinuxI had an issue where my USB Logitech microphone would not show up in the Kazam Screencast application. Linux sound record could see the microphone, and I could record audio through sound recorder from the microphone, but Kazam could not.<br />
<br />
I ended up creating a loopback Pulse Audio device using:<br />
<br />
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">pactl load-module module-null-sink sink_name=Virtual1 </span></blockquote>
<blockquote>
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">pactl load-module module-loopback latency_msec=1 sink=Virtual1 </span></blockquote>
<br />
In Kazam, I would select Sound from speakers (not sound from microphone):<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhKdn6AEZFBK9p-V1rDyvcJ246CoaGVfLSlvik-pEHt8uo_wBIR4L5YoVQoSTUriJnPnd7Bja_NmPmoZvxN2EVPlBOp30t0KkIfl4WsqRzekc4s6-FhR-Tu8TWeiuJ3Ix-6n0TCCemWftMK/s1600/image2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhKdn6AEZFBK9p-V1rDyvcJ246CoaGVfLSlvik-pEHt8uo_wBIR4L5YoVQoSTUriJnPnd7Bja_NmPmoZvxN2EVPlBOp30t0KkIfl4WsqRzekc4s6-FhR-Tu8TWeiuJ3Ix-6n0TCCemWftMK/s1600/image2.png" height="309" width="320" /></a></div>
<br />
<br />
In preferences, for Speakers, select the microphone. <br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjVleCcGaf9LfG7SSGv_wwQu464YrH-mvCS3er8zS1HgqHRjlRfqShPsPefFc7UQFr3SbjUTJ8jq8hG5amiMeXoo3w9vVb_8SDTlu4Q8nekc9N-9KRrr2hRqsnh95enfTdpMNI5lTWDsEQa/s1600/image2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjVleCcGaf9LfG7SSGv_wwQu464YrH-mvCS3er8zS1HgqHRjlRfqShPsPefFc7UQFr3SbjUTJ8jq8hG5amiMeXoo3w9vVb_8SDTlu4Q8nekc9N-9KRrr2hRqsnh95enfTdpMNI5lTWDsEQa/s1600/image2.png" height="175" width="320" /></a></div>
<br />
<br />
Now the sound recording will be relayed through the microphone to Kazam. There won't be any speaker output, so there will be no feedback.<br />
<br />
<br />Anonymoushttp://www.blogger.com/profile/16677545615031598278noreply@blogger.com1tag:blogger.com,1999:blog-4219190022818787033.post-67207904006628646662014-06-04T20:09:00.001-04:002014-06-16T13:18:25.021-04:00Which filesystems I use and whyI've been frequently asked which filesystems I prefer. I decided to put together a post discussing my filesystems of choice and general analysis of the criteria.<br />
<br />
<h3>
Windows VMs/KVMs etc</h3>
Obvious choice is <b>NTFS</b>. In KVM, the NTFS filesystem is stored in a QCOW2 container (allowing the filesystem to be easily resized/extended and snapshots/clones reduce data storage consumption).<br />
<br />
<h3>
Raspberry Pi / Beagle Bone Black / Cubieboard</h3>
read-only <b>EXT4</b> with journaling off<br />
<br />
I generally turn journaling off (by running<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> tune2fs -O ^has_journal /dev/sda</span>) to preserve the flash and SD write health of my media. I have literally killed genuine SanDisk premium SD cards with "active" Raspberry Pi systems that had journaling on.<br />
<br />
I prefer to make my partitions read-only, with using tempfs to store writes. If I want write to be persistent, I store the data on a secondary EXT4 writable partition. However, the root and boot partitions, I keep read-only unless I'm performing an upgrade on the system. By keeping the filesystem as read-only, I avoid corrupting the SD card with bad writes caused by bad power sources, overclocking or improper shutdown. I found even with reliable power sources, no overclocking and always ensuring safe shutdown, my SD card would become corrupt over time (just generally less often -- say over 6 months instead of 6 weeks, but corrupt neither-less). I have seen several exhaustive tests done by other Raspberry Pi users that conclude the same -- that only read-only filesystems on SD cards will prevent corruption.<br />
<br />
<h3>
Debian-based Linux Systems on SSD</h3>
<div>
<b>EXT4 </b></div>
<div>
<br /></div>
<div>
I use the mounting parameters <span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">rw,errors=remount-ro,user_xattr,noatime,discard</span> that reduce unnecessary update of inodes when accessing files. The <span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;">discard</span> enables TRIM support and should be enabled for as long as your drive supports it (<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">hdparm -I /dev/sda | grep TRIM</span>). If you enable <span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;">discard</span> and your drive doesn't support it, you'll have data loss.</div>
<div>
<br /></div>
<div>
EXT4 has better support than previous versions (EXT2, EXT3), even though there is increased journaling in EXT4 (that can reduce the lifespan of SSD drives). If you have frequent writes and have means to mitigate the risk of data loss in system crashes/etc, then consider turning journaling off (<span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;">tune2fs -O ^has_journal /dev/sda</span>).</div>
<div>
<br /></div>
<div>
I reduce the amount of writes to SSD by using various tempfs (stored in RAM) for logging, tmp and caching. I use the <span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">find -mtime</span> command to identify files that are frequently written to (in most cases, for unnecessary reasons). I then schedule startup, suspend/hibernate and shutdown routines that sync these tempfs to disk. I store everything from system logs and google chrome / Mozilla configuration and cache directories to RAM.</div>
<div>
<br /></div>
<div>
<h3>
Debian-based Linux Systems on slow hard drives</h3>
<div>
<b>XFS</b></div>
<div>
<b><br /></b></div>
<div>
I have one Sony VAIO system that uses a 1.8" 4200rpm SATA hard drive. A really slow hard drive benefits from the speed advantages of XFS. One should note that data loss can become and issue for system crashes/etc. You can consider mounting the XFS filesystem as read-only, and use tempfs to store writes to be synced to disk in a safe fasion (similar to the Raspberry Pi setup).<b> </b></div>
</div>
<div>
<h3>
<b><br /></b></h3>
<h3>
<b>Linux Containers / LXC and Linux Based VMs/KVMs</b></h3>
<b>BTRFS </b><br />
<b><br /></b>
<br />
<div>
For any system that you use kernel 3.9 or greater, you should consider using BTRFS to store your operating system. BTRFS allows you to "snapshot" and clone your LXC/VM with minimum data duplication. Similar to QCOW2 (in KVM) and snapshots in VMware, BTRFS will help you reduce your LXC/VM disk consumption. </div>
</div>
<div>
<br /></div>
<div>
<h3>
<b>NAS units (such as DNS 323)</b></h3>
<b>EXT4 with SAMBA and NFS</b><br />
<div>
<br /></div>
<div>
I use alt-f firmware on my DNS 323 units, so my NAS units do support EXT4. A lot of older NAS units or DNS 323 units running on official firmware, may not support EXT4. In those cases I use EXT3, and as I upgrade firmware on the NAS or replace it with a more capable NAS, I convert to EXT4. The journaling of EXT4 provides the best means of preventing data loss besides moving to a filesystem such as BTRFS or ZFS. My NAS units, even with modern open-source and community driven firmware like alf-f, does not support BTRFS or ZFS due to hardware limitation (memory and CPU required to support "tomorrow's filesystems"). I mitigate risk of data loss due to corruption by maintaining offline mirror drives for each NAS drive.<br />
<br />
Samba shares enabled for sharing with Windows and XBMC on Raspberry Pi and NFS for mounting the drives on Linux systems.</div>
</div>
<div>
<br /></div>
<h3>
Comments about BTRFS and ZFS</h3>
<div>
I really believe that BTRFS and ZFS will be the filesystems for the future. BTRFS is highly being developed on and is meant to share a lot of the benefits and features of ZFS but without the licensing restrictions. If you have situations/applications where you can't run newer versions of the Linux kernel, then you should avoid BTRFS -- it's always best to only use BTRFS on systems with at least kernel 3.9. </div>
<div>
<br /></div>
<div>
ZFS is an Oracle created filesystem that has great data integrity (to guard against bit rot and data corruption), built in encryption and compression and data deduplication (great for snapshoting and cloning). ZFS has been ported to Linux using either native kernel modules or by FUSE. There are licensing issues as ZFS isn't licenses under GPL, and therefore, the implementation has stripped out features and is not as stable as the original Sun Solaris implementation. Being that the original Oracle implementation is 64-bit, the linux native kernel modules are only compiled for amd64, so if you need to support 32-bit systems, you should not consider ZFS. Further, ZFS needs a fair amount of RAM (4GB) to manage. Also, if you often run/use the latest Linux kernel versions, you may have issues as you have to wait for the native kernel modules to be updated for your kernel release -- due to licensing restrictions, they don't come bundled with the kernel, so you need to wait for the support community to update the modules afterwards. I've been using kernel 3.13 for 6+ months, and I still don't have ZFS kernel modules that work on my kernel version.<br />
<br />
ZFS also has embedded support for Samba and NFS -- that is, the filesystem can be automatically shared, without any additional configuration, simply by enabling sharesmb or sharenfs.</div>
<div>
<br /></div>
<div>
BTRFS is a good compromise to ZFS -- to gain some of the features without dealing with some of the problems. Both would be considered "non-production" at this point. Don't store critical data on them without having good mechanisms in place to safe guard against being inflicted by bugs that often pop-up in bleeding-edge development work.</div>
<div>
<br /></div>
<div>
<br /></div>
Anonymoushttp://www.blogger.com/profile/16677545615031598278noreply@blogger.com2tag:blogger.com,1999:blog-4219190022818787033.post-41152772460344847482014-06-03T18:02:00.000-04:002014-06-03T18:05:23.815-04:00Map Suspend & Hibernate to shortcut keysOne of the issues I recently encountered when upgrading to Linux Mint Debian Edition (LMDE) Update Pack 8 (UP8) is the loss of functionality of the suspend and hibernate keys. At first I was under the impression that it was just an issue on my Thinkpad, but I discovered the issue existed on all the system that I upgraded. It's a known issue and was identified in this bug: <a href="https://bugs.launchpad.net/linuxmint/+bug/1276678">https://bugs.launchpad.net/linuxmint/+bug/1276678</a><br />
<br />
There might be other workarounds to resolving the issue, but I took this as a good opportunity to finally mapping out a new suspend/hibernate key combination that I could use across all my systems. The FN-F4 for suspend and FN-F12 may be universal on all Thinkpads, but my Vaio and Ultrabook use different suspend and hibernate keys, thus my finger-memory sometimes slips up.<br />
<br />
To tackle both problems, I decided create a common shortcut key for each function across all my systems. Because the FN keys tend to be tied to hardware routines, I settled on SHIFT+F4 for suspend and SHIFT+F12 for hibernate.<br />
<br />
The first step to tackle was writing a suspend and hibernate script that could be invoked by my user ID without having to provide a sudo password.<br />
<br />
I added the following two lines to my <span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">/etc/sudoers</span> file.<br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"><br /></span>
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">durdle t420-ssd = (root) NOPASSWD: /usr/sbin/pm-hibernate</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">durdle t420-ssd = (root) NOPASSWD: /usr/sbin/pm-suspend</span><br />
<div>
<br /></div>
<div>
Substitute <span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">durdle</span> with your user ID, and <span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">t420-ssd</span> with our hostname.</div>
<div>
<br /></div>
<div>
You may find that you need to change the file <span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">/etc/sudoers </span> to have write permissions before you can edit it (doing a <span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">chmod 740 /etc/sudoers </span>before updating the file and a <span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;">chmod 440 /etc/sudoers </span>after updating the file, will do the trick).</div>
<div>
<br /></div>
<div>
Next, I decided to create shortcut scripts in my ~/bin/ folder. This will allow me to quickly suspend and hibernate from the command line and allow me to easily tie the two routines to the <a href="http://code.google.com/p/autokey/">Autokey</a> program.</div>
<div>
<br /></div>
<div>
My two scripts resemble as follows:</div>
<div>
<br /></div>
<div>
<div>
~/bin/hibernate.sh </div>
<div>
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">sudo /usr/sbin/pm-hibernate</span></div>
</div>
<div>
<br /></div>
<div>
<div>
<div>
~/bin/suspend.sh </div>
<div>
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">sudo /usr/sbin/pm-suspend</span></div>
</div>
<div>
<br /></div>
</div>
<div>
If you can't use the pm-hibernate or pm-suspend programs to hibernate or suspend, you can substitute your equivalent calls. Or if you need to add wrappers around them, these shell scripts are the place to put them. Previous to kernel 3.13, my Vaio need some additional system calls before calling pm-hibernate, in order to ensure a proper hibernate. I place those calls in my hibernate.sh.</div>
<div>
<br /></div>
<div>
I use a program called <a href="http://code.google.com/p/autokey/">Autokey</a> for various shortcuts and keyboard macros. If you don't normally use <a href="http://code.google.com/p/autokey/">Autokey</a>, you will need to ensure that it starts up on boot up. You can do this by calling it in your "Startup Applications" list.</div>
<div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgsSMvsBroSk_JPWllImidTSvLPn-zFzmw4w4TN21bP4AGZPBNBifZmDFZU0TuzgT-iaeUg0MsG_lU00zHvgdMPPfPmJHwlKOZA0XfCtmF-YEtA9oqCvrFwijmt1KmMYvYWYJCYNCetYFmx/s1600/autokey.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgsSMvsBroSk_JPWllImidTSvLPn-zFzmw4w4TN21bP4AGZPBNBifZmDFZU0TuzgT-iaeUg0MsG_lU00zHvgdMPPfPmJHwlKOZA0XfCtmF-YEtA9oqCvrFwijmt1KmMYvYWYJCYNCetYFmx/s1600/autokey.png" height="266" width="320" /></a></div>
<br />
<br /></div>
<div>
The program is fairly self explanatory. You will create two new scripts, enter the following, substituting your username in, and then assigning the Hotkey <shift>+<f4> and Hotke <shift>+<f12>:</div>
<div>
<br /></div>
<div>
for suspend:</div>
<div>
<div>
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">import os</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">os.system('/home/durdle/bin/suspend.sh')</span></div>
</div>
<div>
<br /></div>
<div>
<div>
for hibernate:</div>
<div>
<div>
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">import os</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">os.system('/home/durdle/bin/hibernate.sh')</span></div>
</div>
</div>
<div>
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"><br /></span></div>
<div>
<div>
That's it! Now when you press SHIFT+F4, your system should suspend and when you press SHIFT+F12, your system should hibernate, all without entering a password.</div>
<div>
<br /></div>
<div>
</div>
</div>
Anonymoushttp://www.blogger.com/profile/16677545615031598278noreply@blogger.com0tag:blogger.com,1999:blog-4219190022818787033.post-11284246402127766502014-04-08T19:54:00.003-04:002014-04-08T19:54:31.285-04:00Fixing ipod touch / iphone support in LMDE after Update Pack 8Since upgrading to Update Pack 8 (UP8) in Linux Mint Debian Edition (LMDE), I'm no longer able to mount my ipod Touch 2G 3.1.3 or iphone 3GS 6.1.4. Both devices used to appear as a mounted device when plugged in, and I could use gtkpod to sync to. Since the upgrade, when I plug in either device, I get a DBUS timeout error. The devices appear as unmounted, and when I try mount them via caja, I get a DBUS timeout error.<br />
<br />
dmeg has the following output:<br />
<br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"><span style="background-color: white; color: #333333; line-height: 18.1875px;">usb 6-1: new high-speed USB device number 3 using ehci-pci</span><br style="background-color: white; color: #333333; line-height: 18.1875px; margin: 0px; padding: 0px;" /><span style="background-color: white; color: #333333; line-height: 18.1875px;">usb 6-1: New USB device found, idVendor=05ac, idProduct=1294</span><br style="background-color: white; color: #333333; line-height: 18.1875px; margin: 0px; padding: 0px;" /><span style="background-color: white; color: #333333; line-height: 18.1875px;">usb 6-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3</span><br style="background-color: white; color: #333333; line-height: 18.1875px; margin: 0px; padding: 0px;" /><span style="background-color: white; color: #333333; line-height: 18.1875px;">usb 6-1: Product: iPhone</span><br style="background-color: white; color: #333333; line-height: 18.1875px; margin: 0px; padding: 0px;" /><span style="background-color: white; color: #333333; line-height: 18.1875px;">usb 6-1: Manufacturer: Apple Inc.</span><br style="background-color: white; color: #333333; line-height: 18.1875px; margin: 0px; padding: 0px;" /><span style="background-color: white; color: #333333; line-height: 18.1875px;">usb 6-1: SerialNumber: <<>></span><br style="background-color: white; color: #333333; line-height: 18.1875px; margin: 0px; padding: 0px;" /><span style="background-color: white; color: #333333; line-height: 18.1875px;">ipheth 6-1:4.2: Apple iPhone USB Ethernet device attached</span><br style="background-color: white; color: #333333; line-height: 18.1875px; margin: 0px; padding: 0px;" /><span style="background-color: white; color: #333333; line-height: 18.1875px;">usbcore: registered new interface driver ipheth</span><br style="background-color: white; color: #333333; line-height: 18.1875px; margin: 0px; padding: 0px;" /><span style="background-color: white; color: #333333; line-height: 18.1875px;">IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready</span><br style="background-color: white; color: #333333; line-height: 18.1875px; margin: 0px; padding: 0px;" /><span style="background-color: white; color: #333333; line-height: 18.1875px;">pool[5534]: segfault at 300000003 ip 00007fc287ff8cd6 sp 00007fc283ffbc50 error 6 in libimobiledevice.so.4.0.1[7fc287fed000+1a000]</span><br style="background-color: white; color: #333333; line-height: 18.1875px; margin: 0px; padding: 0px;" /><span style="background-color: white; color: #333333; line-height: 18.1875px;">pool[5558]: segfault at 300000003 ip 00007f61bd848cd6 sp 00007f61b984bc50 error 6 in libimobiledevice.so.4.0.1[7f61bd83d000+1a000]</span></span><br />
<span style="background-color: white; color: #333333; font-family: 'Lucida Grande', 'Trebuchet MS', Verdana, Helvetica, Arial, sans-serif; font-size: 13px; line-height: 18.1875px;"><br /></span>
<span style="background-color: white; color: #333333; font-family: 'Lucida Grande', 'Trebuchet MS', Verdana, Helvetica, Arial, sans-serif; font-size: 13px; line-height: 18.1875px;">I found a solution posted at </span><a href="http://beautifulajax.dip.jp/?p=536">http://beautifulajax.dip.jp/?p=536</a>.<br />
<br />
In a nutshell, I downloaded the following 4 files:<br />
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"><br />libusbmuxd1_1.0.7-2_amd64.deb<br />libimobiledevice2_1.1.1-4_amd64.deb<br />fuse-utils_2.9.0-2+deb7u1_all.deb<br />ifuse_1.0.0-1+b1_amd64.deb </span></blockquote>
from:<br />
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">https://packages.debian.org/en/wheezy/ifuse<br />https://packages.debian.org/en/wheezy/fuse-utils<br />https://packages.debian.org/en/wheezy/libimobiledevice2<br />https://packages.debian.org/en/wheezy/libusbmuxd1</span></blockquote>
Install by each of the 4 by running dkpg, such as:<br />
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"><br /></span><span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">sudo dpkg -i libusbmuxd1_1.0.7-2_amd64.deb </span><span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">sudo dpkg -i libimobiledevice2_1.1.1-4_amd64.deb </span><span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">sudo dpkg -i fuse-utils_2.9.0-2+deb7u1_all.deb </span><span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">sudo dpkg -i ifuse_1.0.0-1+b1_amd64.deb </span></blockquote>
<br />
Create a mount point, such as <span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">/mnt/iphone</span>:<br />
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">sudo mkdir /mnt/iphone<br />sudo chmod 777 /mnt/iphone/</span></blockquote>
<br />
To mount the iphone / ipod touch, connect the device and run:<br />
<br />
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">ifuse /mnt/iphone/</span></blockquote>
<br />
To unmount the iphone / ipod touch, run:<br />
<br />
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">umount /mnt/iphone/</span></blockquote>
<br />
<br />
<br />
<br />
<br />
<div>
<br /></div>
Anonymoushttp://www.blogger.com/profile/16677545615031598278noreply@blogger.com0tag:blogger.com,1999:blog-4219190022818787033.post-47316964027607633612014-04-08T19:43:00.003-04:002014-04-08T19:43:53.494-04:00Fixing Disappearing Network Manager from LMDE after Update Pack 8One of the issues I witnessed on one of my Linux Mint Debian Edition (LMDE) system, after performing Update Pack 8 was that the network icon<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiTmrl3EaTBAg8mkY8wEVQ8EOovhrFuVaMPsJ26d0hlyAPkjgul27G_7ZleOkh1PCYMXP6DmVAYHPqdvHCUhYPlwnKEqyR2btYGQF5bzkonl5zMQgcWDoMdnufE6MzQ4mjaWDM69y5OB6Ox/s1600/nm-applet.png" imageanchor="1" style="clear: left; display: inline !important; float: left; margin-bottom: 1em; margin-right: 1em; text-align: center;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiTmrl3EaTBAg8mkY8wEVQ8EOovhrFuVaMPsJ26d0hlyAPkjgul27G_7ZleOkh1PCYMXP6DmVAYHPqdvHCUhYPlwnKEqyR2btYGQF5bzkonl5zMQgcWDoMdnufE6MzQ4mjaWDM69y5OB6Ox/s1600/nm-applet.png" /></a><br />
would disappear from the notification bar. This would make it extremely difficult to manually switch between access points (automatic was fine and transparent, such as if you need to connect to a new access point, or select a particular hot spot among multiple known/saved access points.<br />
<br />
The notification icon is actually a program called <span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">nm-applet</span>.<br />
<br />
When I started it manually, it would exit with the following error:<br />
<br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">** (nm-applet:27520): WARNING **: Could not initialize NMClient /org/freedesktop/NetworkManager: Rejected send message, 2 matched rules; type="method_call", sender=":1.92" (uid=1000 pid=27520 comm="nm-applet ") interface="org.freedesktop.DBus.Properties" member="GetAll" error name="(unset)" requested_reply="0" destination="org.freedesktop.NetworkManager" (uid=0 pid=4075 comm="/usr/sbin/NetworkManager ")</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">** Message: applet now removed from the notification area</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">** Message: applet now embedded in the notification area</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">** Message: applet now removed from the notification area</span><br />
<br />
The issue is that<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> /etc/dbus-1/system.d/org.freedesktop.NetworkManager.conf</span> gets reset with Update Pack 8.<br />
<br />
To resolve the issue, make a backup of the file <span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">/etc/dbus-1/system.d/org.freedesktop.NetworkManager.conf</span> and modify the file by replacing all of the <i>deny</i> entries with <i>allow</i>. Easiest way is to open <span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">vi</span>, and enter <span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">:%s/deny/allow</span> to automatically switch all the occurrences. Next time you reboot, nm-applet will stay alive. You'll also be able to manually start <span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">nm-applet</span> in the meanwhile.Anonymoushttp://www.blogger.com/profile/16677545615031598278noreply@blogger.com0tag:blogger.com,1999:blog-4219190022818787033.post-78013780211144535592014-03-07T20:38:00.002-05:002014-03-07T20:38:55.064-05:00Debugging XBMC PluginsI've been learning XBMC plugin development over the past few months. I thought it would be a good time to review my remote debugging configuration. When I had started setting up a debugging environment, I discovered the information available was fragmented and obsolete.<br />
<br />
A helpful source is <a href="http://wiki.xbmc.org/index.php?title=HOW-TO:Debug_Python_Scripts_with_Eclipse">HOW-TO:Debug Python Scripts with Eclipse</a>. I will refer to it throughout.<br />
<h3>
Development Environment (IDE)</h3>
<div>
<br /></div>
<div>
You can do a lot with just using gedit (with it's python syntax highlighting). But when things get more complicated, you'll need a place to debug. An IDE that I've used before, on Java and Perl projects, was Eclipse. Eclipse has a PyDev plugin available, that can be easily installed through the Updates (Help...Install New Software), which is required to add Python integrated functionality to Eclipse. Because I didn't have Eclipse installed on my particular current system, I decided to opt for downloading LiClipse instead. It is "lightweight" and has PyDev already installed. You'll need a Python interpreter installed -- not an issue on most Linux systems. XBMC also uses your native Linux Python interpreter.</div>
<div>
<br /></div>
<div>
Refer to section 2 in <a href="http://wiki.xbmc.org/index.php?title=HOW-TO:Debug_Python_Scripts_with_Eclipse">HOW-TO:Debug Python Scripts with Eclipse</a> for setting up PyDev within XBMC.</div>
<div>
<br /></div>
<h3>
Setup Workspace</h3>
<div>
I have all my XBMC plugins located in a particular development folder named development/xbmc. I simply setup my workspace to this folder. For each plugin, represented by single subfolder for each (such as XBMC-pluginname), I simply go to File -> New, PyDev Project. Give the project the appropriate name (XBMC-pluginname), select Python for Project type. Select Grammar Version 2.7. For Interpreter, select Default. Click on the "Click here to configure an interpreter not listed". In the upper right pane, click the Quick Auto-Config, which will configure an interpreter for you. If you have multiple Python Interpreters installed, repeat until the required version is created.</div>
<div>
<br /></div>
<div>
Before clicking the Finish button, change the radio button to "Don't configure PYTHONPATH (to be done manually later on)".</div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMh68-xyO97p27FTM0a3SKwtFhtzNqDpdvuxdFMwWSpDvQ6dGW4yLFrv8DZy5mT9WHMQkrG4kQd_HdY6dQqDy0Og15FCyRhARecTIAWnweW2RfGMcVUJiTYauNWsSCiBCRd928Gk7W_sBh/s1600/pydev.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMh68-xyO97p27FTM0a3SKwtFhtzNqDpdvuxdFMwWSpDvQ6dGW4yLFrv8DZy5mT9WHMQkrG4kQd_HdY6dQqDy0Og15FCyRhARecTIAWnweW2RfGMcVUJiTYauNWsSCiBCRd928Gk7W_sBh/s1600/pydev.png" height="320" width="220" /></a></div>
<div>
<br /></div>
<div>
Refer to section 3 in <a href="http://wiki.xbmc.org/index.php?title=HOW-TO:Debug_Python_Scripts_with_Eclipse">HOW-TO:Debug Python Scripts with Eclipse</a> for more assistance. This part of the Wiki is out-of-date, however.</div>
<div>
<br /></div>
<h3>
Setup Pysrc (for remote-debugging)</h3>
<div>
If you want to remote-debug your plugin (that is step through your code while running), you will need to do some further setup. First, you need to locate the pysrc library files that came with your PyDev install. If you do a (find . | grep pysrc) from within your Eclipse install, you should find them located in plugins org.python.pydev_3... folder. Mine were located at ./plugins/org.python.pydev_3.3.3.201401272005/pysrc/.</div>
<div>
<br /></div>
<div>
Next, you'll need to find the global library location for you Python interpreter. You can do so by running the following:</div>
<div>
<br /></div>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">python -c "from distutils.sysconfig import *; print(get_python_lib())"</span></blockquote>
<div>
My path was <span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">/usr/lib/python2.7/dist-packages</span>. Copy the pysrc folder into this noted folder (you'll need to be root). </div>
<div>
<br /></div>
<div>
You'll also need to create an empty file called <span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">__init__.py </span>within this pysrc folder ( <span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">/usr/lib/python2.7/dist-packages/pysrc</span>). This will allow XBMC transverse into it.</div>
<div>
<br /></div>
<h3>
Modify Your XBMC Plugin</h3>
<div>
To enable remote-debugging to your application, you will need to add some code to your plugin (say into your default.py, below the import statements). Code I've put in mine resemble this:</div>
<div>
<br /></div>
<blockquote class="tr_bq">
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">try:</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"> remote_debugger = addon.getSetting('remote_debugger')</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> remote_debugger_host = addon.getSetting('remote_debugger_host')</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"></span></blockquote>
</blockquote>
<br />
<blockquote class="tr_bq">
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"> # append pydev remote debugger</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> if remote_debugger == 'true':</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> # Make pydev debugger works for auto reload.</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> # Note pydevd module need to be copied in XBMC\system\python\Lib\pysrc</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> import pysrc.pydevd as pydevd</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> # stdoutToServer and stderrToServer redirect stdout and stderr to eclipse console</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> pydevd.settrace(remote_debugger_host, stdoutToServer=True, stderrToServer=True)</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">except ImportError:</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> sys.stderr.write("Error: " + "You must add org.python.pydev.debug.pysrc to your PYTHONPATH.")</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> sys.exit(1)</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">except :</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> pass</span></blockquote>
</blockquote>
<div>
The code will look for the parameter "remote_debugger" and "remote_debugger_host" in your settings.xml file. If neither is found, an exception will be thrown, and the debugging will be disabled. This will allow you to maintain one version of your code. You could use a constant variable instead, but then you'd need to set it somewhere. I see others implementing a variable like REMOTE_DEBUG and then setting it True or False in the same class, but if you forgot to switch it to False, and push your code out, it'll fail if someone deploys it. I found my approach elegant, as the debugger code will be inactive unless the user adds the following two lines to their settings.xml:</div>
<div>
<br /></div>
<div>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> <setting id="remote_debugger" value="true" /><br /> <setting id="remote_debugger_host" value="localhost" /></span></blockquote>
</div>
<div>
<br /></div>
<div>
The <span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;">remote_debugger_host </span>allows you to use a remote system for debugging, rather than using the same machine. This allows you to debug your plugin on a Raspberry Pi and debug it using your laptop. If you are debugging on the same device (laptop running XBMC), then you can leave this as localhost. Otherwise, change it to your IP of your debugging machine.</div>
<div>
<br /></div>
<div>
The above code was adapted from <a href="http://wiki.xbmc.org/index.php?title=HOW-TO:Debug_Python_Scripts_with_Eclipse">HOW-TO:Debug Python Scripts with Eclipse</a> .</div>
<h3>
<br /></h3>
<h3>
Raspberry Pi for Debugging</h3>
<div>
<br /></div>
<div>
Just like you setup pysrc earlier on your computer, if you want to run your plugin from a device, such as Raspberry Pi, to remote-debug, you'll need to copy the pysrc folder, found earlier, to your Raspberry Pi. Follow the same steps under Setup Pysrc, copying the source folder from your computer with Eclipse or LiClipse installed, to your device. In my case, my Raspberry Pi used the same dist-packages folder (so I copied to <span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;">usr/lib/python2.7/dist-packages/pysrc</span>).</div>
<div>
<br /></div>
<div>
You may need to add port 5678 to your computer's firewall to allow inbound connections from your debugging device.</div>
<div>
<br /></div>
<div>
<br /></div>
<h3>
Adding PyDev Debugger to your View</h3>
<div>
<br /></div>
<div>
There are several ways of accomplishing this. I prefer going to Window -> Customize Perspective, selecting Command Groups Availability and checkboxing "PyDev Debug". This will add a PyDev menu with the buttons "Start Debug Server" and "Stop Debug Server" to my Eclipse menu.</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<h3>
Actually Doing the Remote-Debugging...</h3>
</div>
<div>
<br /></div>
<div>
<div>
To start the debugger, I flip to Debug Perspective, and then click the Start Debug Server from PyDev menu. In the Debug Server window, you'll see "Debug Server at port: 5678". </div>
</div>
<div>
<br /></div>
<div>
Now you can open XBMC. If you have the remote-debugger code added to your plugin AND have the remote_debugger and remote_debugger_host set in settings.xml, if you try to load the plugin in XBMC, it should try to communicate to the Eclipse debugger. If it fails to connect to the debugger, it'll push a 110 Connection Failed to the xbmc.log file. If you see a "You must add org.python.pydev.debug.pysrc to your PYTHONPATH" error, that means the pysrc isn't accessible on your XBMC device (did you add the pysrc folder to the dist-packages folder? did you include an empty <span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;">__init__.py </span> file within that directory?).</div>
<div>
<br /></div>
<div>
If it is working, XBMC should "halt" while your debugger is passed control. In the Debug panel, you should see an unknown with MainThread show up. This represents the session running on your XBMC device. You can now step through the code using standard debugging techniques. You can also simply "Resume" (F8) to continue running to completion the plugin.</div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxDDgwKbwss3K1hsHEg9jQyN0TZvTb-JFBLAHVFI2XPFBbwrIv5AUKeRRJ7IvoWkc8E3n-9UeKUdIDA5ekhHXVBKavuMYyKtRhBLsyQehnGEJo4OmKHbqJq6_sDrmxXSUxa9gzTeLXqZqv/s1600/Debug.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxDDgwKbwss3K1hsHEg9jQyN0TZvTb-JFBLAHVFI2XPFBbwrIv5AUKeRRJ7IvoWkc8E3n-9UeKUdIDA5ekhHXVBKavuMYyKtRhBLsyQehnGEJo4OmKHbqJq6_sDrmxXSUxa9gzTeLXqZqv/s1600/Debug.png" /></a></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
Refer to <a href="http://wiki.xbmc.org/index.php?title=HOW-TO:Debug_Python_Scripts_with_Eclipse">HOW-TO:Debug Python Scripts with Eclipse</a> for further advise on debugging.</div>
<div>
<br /></div>
<div>
Have fun :) </div>
<div>
<br /></div>
Anonymoushttp://www.blogger.com/profile/16677545615031598278noreply@blogger.com0tag:blogger.com,1999:blog-4219190022818787033.post-57851012514545200722014-01-21T14:22:00.002-05:002014-01-21T14:22:50.498-05:00Re-purposing Old SD Cards for Booting a Raspberry Pi off USBMy server pi machine has a SanDisk Ultra 32GB card for which has a standard Raspbian install. I found shortly after putting the system together, that I found it more stable to run the linux directly off the attached USB hard drive (for which I always mount). I created a linux OS-partition on the USB drive (size 16GB). I rsynced the OS from the SD card to the USB OS-partition.<br />
<br />
The design of the Raspberry Pi insists on booting off the SD card. Once the system is bootstrapped, it can boot of USB or SD card. The bootstrap partition is very small (59MB). There is no sense using a full 32GB card just for bootstrapping.<br />
<br />
I found an old 32MB (yes, Megabytes) micro-SD card and an even smaller, 16MB SD card. The bootstrap partition on the standard image 32GB card is actually 18MB. However, with inspection, I noticed there is a 9MB kernel_emergency boot image contained on it. I would hazard a guess that this boot image would be booted from as a "safe-mode" option if an upgrade (or other activity) causes the default kernel boot image to become inoperable (the default kernel boot image is only 2.8MB). If I exclude the kernel_emergency boot image, I'll be able to fit the partition on the SD card without an issue.<br />
<br />
<h2>
Backup the Data off the 32GB SD Card</h2>
<br />
Looking at the data from the 32GB SD card:<br />
<br />
Disk /dev/mmcblk0: 31.9 GB, 31914983424 bytes<br />
4 heads, 16 sectors/track, 973968 cylinders, total 62333952 sectors<br />
Units = sectors of 1 * 512 = 512 bytes<br />
Sector size (logical/physical): 512 bytes / 512 bytes<br />
I/O size (minimum/optimal): 512 bytes / 512 bytes<br />
Disk identifier: 0x00014d34<br />
<br />
Device Boot Start End Blocks Id System<br />
/dev/mmcblk0p1 8192 122879 57344 c W95 FAT32 (LBA)<br />
/dev/mmcblk0p2 122880 62333951 31105536 83 Linux<br />
<br />
The MBR is stored at /dev/mmcblk0, the bootstrap partition is a FAT partition (/dev/mmcblk0p1), and the linux OS-partition is /dev/mmcblk0p2.<br />
<br />
Reminder that the <span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">dd</span> command will most likely require root access -- so run them as root or use sudo. When copying an OS-partition, as I've done below, run the <span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">rsync</span> using root or use sudo, to ensure all the root-restricted files are transfered.<br />
<h3>
Backup the MBR</h3>
<br />
The first step is to backup the MBR off the 32GB SD card.<br />
<br />
This can be accomplished by running dd:<br />
<br />
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">dd if=/dev/mmcblk0 of=/u01/sd_pi_mbr.iso bs=512 count=1</span></blockquote>
The MBR is actually a 512MB sector at /dev/mmcblk0. This is where the boot sector is, along with the partition table. Depending on the card reader you are using, it'll either appear as the preceeding device, but it could also appear as a /dev/sda, etc device. Run<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> fdisk -l</span> to verify the device [<span style="background-color: red; color: yellow;">ensure that you are not selecting the wrong device</span>].<br />
<br />
A little background information on the MBR. The bootstrap part of the MBR is contained in the first 446 bytes (this explains one of the restore commands that follows). The partition table data is stored in the proceeding 64 bytes (unless the destined SD card is identical in size and partition layout, we won't restore this part of the MBR). The MBR signature is the last 2 bytes (again, the destined SD card is identical in size and partition layout, we won't restore this part of the MBR).<br />
<br />
<h3>
Backup the Bootstrap Partition</h3>
<div>
<br /></div>
<div>
The second step is to backup the bootstrap partition off the 32GB SD card.</div>
<div>
<br /></div>
<div>
This can be accomplished by running dd:<br />
<br />
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">dd if=/dev/mmcblk0p2 of=/u01/sd_pi_boot.iso</span></blockquote>
In my case, I'll be modifying the existing bootstrap to exclude the kernel_emergency.img. Therefore, I ended up mounting <span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;">/dev/mmcblk0p1</span> and copy the contents of the filesystem to a folder called sd_pi_boot, excluding the kernel_emergency.img. The resulting is a folder < 10MB in size, which will clearly fit on my 16MB SD card.<br />
<br /></div>
<div>
<h3>
Backup the OS-Partition</h3>
</div>
<div>
You'll need to copy the OS-partition over to the eventual destination device eventually. In my case, it'll be a USB hard drive, and not the SD card. You can either use dd to take a backup of the image (<span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;">dd if=/dev/mmcblk0p2 of=/u01/sd_pi_os.iso</span>) or you can copy the files. I've copied it to the destination location using rsync. I could also make a image backup and restore of the filesystem using dd and then resize the partition to occupy the entire destination partition size, but I find it faster and with fewer steps to just mound the filesystem on the SD card and using the <span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">rsync -avix</span> command to create a mirror copy of the filesystem [<i>reminder to use root or sudo</i>].</div>
<div>
<br /></div>
<div>
<br /></div>
<h3>
Format and Partition the Destination SD Card</h3>
<br />
The first step is to ready your SD card. Format the card with a MBR using a Disk Utility to <span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">fdisk</span>. Then create a FAT partition on the card using the same tool (in my case with the 16MB card, I create a partition the full size of the card).<br />
<br />
<h3>
Restore the MBR</h3>
<br />
The next step is to restore the MBR onto the new SD card.<br />
<br />
This can be accomplished by running dd:<br />
<br />
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">dd if=/u01/sd_pi_mbr.iso o</span><span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;">f=/dev/mmcblk0</span><span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"> bs=446 count=1</span></blockquote>
Take note of the bs parameter of 446. Because the new card is of different size (and different partition sizes) then the original, we restore the "bootstrap" part of the MBR only -- we don't want to overwrite the partition table or MBR signature that we created in the proceeding step.<br />
<br />
<div>
<h3>
Restore the OS-Partition to your USB device [or other destination]</h3>
</div>
<div>
You'll need to copy the OS-partition over to the eventual destination device. In my case, it'll be a USB hard drive, and not the SD card. Either use <span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">dd</span> to restore the filesystem image or use the <span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">rsync -avix</span> command to create a mirror copy of the filesystem from your backup [<i>reminder to use root or sudo</i>].</div>
<h3>
Restore the Bootstrap Partition</h3>
<div>
<br /></div>
<div>
The next step is to restore the bootstrap partition.</div>
<div>
<br /></div>
<div>
This can be accomplished by running dd:<br />
<br />
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">dd i</span><span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;">f=/u01/sd_pi_boot.iso o</span><span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">f=/dev/mmcblk0p2</span></blockquote>
In my case, I'll be modifying the existing bootstrap to exclude the kernel_emergency.img. Therefore, I use copy over the files from a backup folder sd_pi_boot instead of using <span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">dd</span>.</div>
<div>
<br /></div>
<div>
I end up with a bootstrap partition containing the following files:</div>
<div>
<br /></div>
<div>
<div>
bootcode.bin cmdline.txt config.txt fixup_cd.dat fixup.dat fixup_x.dat issue.txt kernel.img start_cd.elf start.elf start_x.elf</div>
</div>
<div>
<br /></div>
<div>
<div>
<h3>
Modify the OS-Partition Boot Parameter</h3>
</div>
</div>
<div>
<br /></div>
<div>
<div>
<br class="Apple-interchange-newline" />
On the resulting SD card, I need to instruct the bootstrap where to load the OS-partition on boot up. These startup details are contained in the file <span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">cmdline.txt</span>.</div>
<div>
<br /></div>
<div>
The original file contains the following:</div>
<div>
<br /></div>
<div>
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait</span></div>
<div>
<br /></div>
<div>
The OS-partition, more formally known as the root partition, is noted as <span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;">/dev/mmcblk0p2</span>, which was the original location. This parameter will need to be updated with the new destination. In my situation, I restored this to a USB hard drive. It was not the primary partition on the drive (as it was added after the drive was originally partitioned). Therefore, in my case, the partition is <span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;">/dev/sda3. </span>If it is your primary partition on the first hard drive connected to the Raspberry Pi, then it'll most likely be <span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;">/dev/sda1 </span>instead.</div>
<div>
<br /></div>
<div>
My resulting <span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">cmdline.txt</span> is as follows:</div>
<div>
<br /></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;">dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/sda3 rootfstype=ext4 elevator=deadline rootwait</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"><br /></span></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
That's it! Now perform a <span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">sync</span> command (to ensure the write buffers are flushed to the SD card when you eject it), and then safely unmount the partitions on the SD card and eject the SD card from your computer. Plug it into the Raspberry Pi along with your USB hard drive [or other device containing your new OS-partition]. When you power on the Pi, it should start accessing the partition containing your OS-partition within 3 seconds of receiving power. In my case, my system is headless (without screen), so I use the LEDs to confirm what is happening. I notice the hard drive LED starts blinking read (as opposed to green) within 2 seconds of the Pi being powered on, validating that I've done everything properly, and that the Raspberry Pi was able to read the new SD card, boot using the MBR, and bootstrap using the bootstrap partition, and begin booting off the OS-partition. If you don't see the same result, validate firstly by examining the screen for any errors. Most likely your cmdline.txt isn't linking to the OS-partition properly. If you receive SD-card errors, first validate the structure of the SD-card is correct, and that you didn't eject/unmount before the changes were written completely to the card.</div>
</div>
<div>
<br /></div>
Anonymoushttp://www.blogger.com/profile/16677545615031598278noreply@blogger.com1tag:blogger.com,1999:blog-4219190022818787033.post-18738146339661056272013-12-24T10:05:00.002-05:002013-12-24T10:05:49.969-05:00Moving to KVM from VMware [day 19 of 20-days-of-posts series]<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<br /></div>
<b style="font-weight: normal;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b><br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">I'm a long time VMware Workstation user. I've been using the product since VMware Workstation version 5.</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">I use VMware for various purposes, including:</span></div>
<div dir="ltr" style="margin-bottom: 0pt; margin-top: 0pt;">
</div>
<ul>
<li><span style="font-family: Arial;"><span style="font-size: 15px; line-height: 17px; white-space: pre-wrap;">gaining experience with middleware products -- such as installing Oracle RAC across multiple instances, practicing concepts of load balancing, failover and replication</span></span></li>
<li><span style="font-family: Arial;"><span style="font-size: 15px; line-height: 17px; white-space: pre-wrap;">setting up development environments for compiling and debugging in heterogeneous environments (OS X for apple development, emulators for android, etc)</span></span></li>
<li><span style="font-family: Arial;"><span style="font-size: 15px; line-height: 17px; white-space: pre-wrap;">for running legacy Windows-only applications (the list grows shorter by the day)</span></span></li>
</ul>
<br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">I've tried to make the transition to the open-source <a href="http://www.linux-kvm.org/">KVM</a> (Kernel-based Virtual Machine) as seamless as possible.</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: Arial; font-size: 15px; line-height: 1.15; white-space: pre-wrap;">As a product offering, VMware is a much more mature (well, given it has many years on KVM) and more user friendly experience. With that said, the potential for KVM long-term is very interesting to me. It does have the possibility and movement to eventually eclipse VMware.</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">As I go along, I've tried to make things as close to resembling the ease of VMware as close as possible.</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><b>KVM vs Qemu</b></span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><b><br /></b></span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">You'll see the two terms often intermixed. Qemu came first and uses emulation to power virtual machines. KVM uses isolation but there is no emulation --guest are isolated from eachother and from the host, but the processing is routed through the same kernel that boots up your Linux host [if you haven't realized yet, KVM is a Linux-only solution -- images from VMware can be exported to KVM and vice-versa]. KVM also requires your have a CPU that supports virtualization (vx-d) -- which also means your host needs to be 64bit (although not all 64bit systems have virtualization support).</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span></div>
<h2>
<span style="font-family: Arial;"><span style="font-size: 15px; line-height: 17px; white-space: pre-wrap;"><b>Installation:</b></span></span></h2>
<div dir="ltr" style="margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: Arial;"><span style="font-size: 15px; line-height: 17px; white-space: pre-wrap;"><br /></span></span></div>
<div dir="ltr" style="margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: Arial;"><span style="font-size: 15px; line-height: 17px; white-space: pre-wrap;">One of the advantages of KVM over VMware is the ease of installation. The Kernel automatically always contains the most up-to-date drivers for KVM. Unlike with VMware where kernel updates often require hacking VMware kernel modules to make them compatible with Kernel changes, any new Kernel will always contain everything needed to start using KVM.</span></span></div>
<div dir="ltr" style="margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: Arial;"><span style="font-size: 15px; line-height: 17px; white-space: pre-wrap;"><br /></span></span></div>
<div dir="ltr" style="margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: Arial;"><span style="font-size: 15px; line-height: 17px; white-space: pre-wrap;">To install KVM in a Debian-based distribution, use </span></span><span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small; white-space: pre-wrap;">apt-get</span><span style="font-family: Arial;"><span style="font-size: 15px; line-height: 17px; white-space: pre-wrap;"> and install </span></span><span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small; white-space: pre-wrap;">kvm:</span></div>
<div dir="ltr" style="margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: Arial;"><span style="font-size: 15px; line-height: 17px; white-space: pre-wrap;"><br /></span></span></div>
<blockquote class="tr_bq">
<span style="vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">sudo apt-get install kvm</span></span></blockquote>
<div>
<span style="font-family: Arial; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;">To install a GUI based manager install </span><span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small; white-space: pre-wrap;">virt-manager:</span></div>
<div dir="ltr" style="margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: Arial;"><span style="font-size: 15px; line-height: 17px; white-space: pre-wrap;"><br /></span></span></div>
<blockquote class="tr_bq">
<span style="vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">sudo apt-get install virt-manager</span></span></blockquote>
<div>
<span style="vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"><br /></span></span></div>
<span style="font-family: Arial; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;"></span>To get a lot of the ease-of-use features that VMware has, such as copy-and-paste between host and guest, install <a href="http://www.spice-space.org/download/binaries/spice-guest-tools/">Spice Guest tools</a> in the guest system.<span style="font-family: Arial; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<blockquote class="tr_bq">
<a href="http://www.spice-space.org/download/binaries/spice-guest-tools/" style="line-height: 1.15; text-decoration: none;"><span style="color: #1155cc; font-family: Arial; font-size: 15px; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">http://www.spice-space.org/download/binaries/spice-guest-tools/</span></a></blockquote>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: Arial; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;"></span></div>
To make use of these host and guest integrated tools (which closely resemble VMware guest tools), you'll need to make the following changes in the KVM configuration for the guest image:<br />
<br />
<ul>
<li>change Video type to <span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">QXL</span></li>
<li>add <span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">Controller Virtio Serial</span>, model Default</li>
<li>change Display to <span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">spice</span></li>
</ul>
<br />
<b><br /></b>
<h2>
<b><span style="font-size: small;">Issues:</span></b></h2>
<br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Some of the issues I've noted:</span></div>
<div dir="ltr" style="margin-bottom: 0pt; margin-top: 0pt;">
</div>
<ul>
<li><span style="font-family: Arial;"><span style="font-size: 15px; line-height: 17px; white-space: pre-wrap;"><b>USB Default vs USB 2 support</b></span></span></li>
</ul>
<br />
<blockquote class="tr_bq">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">The default USB controller will default to USB 1.1 support. You need to remember to change it from USB Default to USB 2. A caution about USB 2 support -- you won't be able to pause the guest (memory to disk file) for a guest using this controller type. You'll get some obtuse error, but the origin of the error is traced back o the USB 2 controller supplied with KVM.</span></blockquote>
<blockquote class="tr_bq">
The USB 2 support is limited to Windows 7 or later guests, including Linux.</blockquote>
<blockquote class="tr_bq">
It is almost best to delete USB altogether if you are not planning on plugging in USB devices into the guest.</blockquote>
<div dir="ltr" style="margin-bottom: 0pt; margin-top: 0pt;">
</div>
<ul>
<li><span style="font-family: Arial;"><span style="font-size: 15px; line-height: 17px; white-space: pre-wrap;"><b>Forget about iOS device support with iTunes</b></span></span></li>
</ul>
<br />
<blockquote class="tr_bq">
<span style="font-family: Arial; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;">No matter of fiddling with drivers will get iTunes to successfully detect your iOS device. The OS will see the device, you'll see the device drivers are loaded, but no matter how much you fiddle with it, iTunes will simply never see the iOS device even if the OS has no issue seeing the device. Use VMware if you need to manage iOS devices.</span></blockquote>
<br />
<ul>
<li><b style="font-family: Arial; font-size: 15px; line-height: 17px; white-space: pre-wrap;">Forget about hoping to install OS X</b></li>
</ul>
<br />
<br />
<blockquote class="tr_bq">
<span style="font-family: Arial; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;">It is a well known fact that the support is simply not there to correctly boot up a OS X guest. The issues are many and never ending. Perhaps someday. Use VMware if you need to install OS X.</span></blockquote>
<br />
<ul>
<li><b>Remember to select Architecture i686 if you are installing a 32bit guest</b></li>
</ul>
<blockquote class="tr_bq">
<span style="font-family: Arial; font-size: 15px; white-space: pre-wrap;">If you are using a 32bit guest, there is no need to have the architecture type as x86_64. Having it set to x86_64 will simply prevent you from loading the image on a 32bit guest without hacking the configuration file to force i686 support.</span></blockquote>
<br />
<ul>
<li><b>Pausing a guest (memory to disk) will often render spice tools useless</b></li>
</ul>
<blockquote class="tr_bq">
<span style="font-family: Arial;"><span style="font-size: 15px; white-space: pre-wrap;">Pausing a guest and resuming it at a later time has some lingering problems. Most often the instance will freeze. It is not a hard freeze, and pausing and unpausing the image sequentially will cause the virtual machine to kick back in. However, the spice tools (to copy and paste between guest and host) tend to stop working (until after system reboot)</span></span></blockquote>
<br />
<h3>
<b>Snapshots:</b></h3>
<br />
KVM has a concept of snapshots that are not the same as VMware.<br />
<br />
In VMware, I've used snapshots often to create "reference points" for my VMs, so that at a later time I can easily "flash back" to the previous snapshot in time.<br />
<br />
In KVM, a snapshot is a running instance that you can perform any changes on it that you want, but when you shutdown the instance, all the changes are lost. So inessential, if you want to play around and try something that is potentially destructive, you would use a snapshot so that your original VM is not affected.<br />
<br />
VMware snapshots are very similar to VMware cloning. Cloning is supported in KVM, and therefore, there are manual means to emulating VMware's snapshot behaviour.<br />
<br />
<h3>
KVM - Creating snapshots using cloning: </h3>
<br />
<span style="background-color: white; color: blue;">background information:</span><br />
<li><span style="color: blue;">images are stored in /var/lib/libvirt/images</span></li>
<li><span style="color: blue;">image configuratin files are stored in /etc/libvirt/qemu</span></li>
<li><span style="color: blue;">qcow2 is the image type that I recommend using (easiest to clone, to extend, to manage etc)</span></li>
<div>
<br /></div>
<div>
0) Probably a good idea to close virt-manager.</div>
<div>
1) Create a cloned copy of an image:</div>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"><span style="vertical-align: baseline; white-space: pre-wrap;"><span style="vertical-align: baseline;"><span style="color: #101010;">sudo qemu-img create -f qcow2 -b /var/lib/libvirt/images/<vm name></span></span></span><span style="color: #101010; vertical-align: baseline; white-space: pre-wrap;">.qcow2 /var/lib/libvirt/images/</span><span style="color: #101010; white-space: pre-wrap;"><vm name>-<snapshot-name></span><span style="color: #101010; white-space: pre-wrap;">.qcow2</span></span></blockquote>
2) Copy image configuration file:<br />
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">cd /etc/libvirt/qemu/<br />copy <vm name>.xml <vm name>=<snapshot-name>.xml</span></blockquote>
3) Edit configuration file created in #2 by modifying the name of <vm name><span style="color: #101010; font-family: Verdana; font-size: 15px; line-height: 15px; white-space: pre-wrap;">.qcow2 to </span><vm name>-<snapshot-name><span style="color: #101010; font-family: Verdana; font-size: 15px; line-height: 15px; white-space: pre-wrap;">.qcow2</span><br />
<span style="color: #101010; font-family: Verdana; font-size: 15px; line-height: 15px; white-space: pre-wrap;"><br /></span>
<span style="color: #101010; font-family: Verdana; font-size: 15px; line-height: 15px; white-space: pre-wrap;">We won't bother changing the name of the VM. Doing so would require us to generate a new UUID, which has further complications. Since the expectation is that I'd only have one instance of a snapshot running at a time, this is not a problem. Likewise in VMware, you can only run one snapshot at a time.</span><br />
<span style="color: #101010; font-family: Verdana; font-size: 15px; line-height: 15px; white-space: pre-wrap;"><br /></span>
<span style="color: #101010; font-family: Verdana;"><span style="font-size: 15px; line-height: 15px; white-space: pre-wrap;">Because we are not generating new UUID or modifying any other instance configuration, the snapshot would not require re-activation of a Windows guest.</span></span><br />
<br />
4) Load the snapshot definition:<br />
<blockquote class="tr_bq">
<span style="color: #101010; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">virsh define <vm name>-<snapshot-name></span></span><span style="color: #101010; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">.xml</span><span style="font-family: Verdana; font-size: 15px;"><br class="kix-line-break" /></span></span></blockquote>
<blockquote class="tr_bq">
<br /></blockquote>
Start virt-manager (you could also load the image directly with a <span style="color: #101010; font-family: 'Courier New', Courier, monospace; font-size: xx-small; white-space: pre-wrap;">virsh start <vm name>-<snapshot-name></span>). If you open the VM, you should see that the name is the same as the original, but if you look at the image file source, it should be <span style="color: #101010; font-family: 'Courier New', Courier, monospace; font-size: xx-small; white-space: pre-wrap;"><vm name>-<snapshot-name></span><span style="color: #101010; font-family: 'Courier New', Courier, monospace; font-size: xx-small; white-space: pre-wrap;">.qcow2</span>. This would be the instance loaded when you start the instance. If, instead, you want to load the original, you would run #4 again but providing the original .xml file. Note that like snapshots in VMware, once you move back to an older snapshot, snapshots afterwards become out of date and invalid. Therefore, if you are expecting to use multiple snapshots for an VM, you should fork them off the original instance and not off eachother. <br />
<br />
The data stored in the image of a snapshot is the changes (delta) that is incurred compared to the source image. Therefore, if you start your source image up and make changes to it, the deltas (or snapshots) may become invalid (you would get disk corruption errors starting up the snapshots).<br />
<br />
<h4>
Here's my way of managing images:</h4>
<br />
After creating a base image (consisting of an OS install), I just make enough modifications to get the instance working. I would save this instance as <span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"><vm name></span>.<br />
<br />
I create a snapshot called <span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"><vm name>-start</span>. I immediately make the original image, <span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"><vm name>.qcow2</span>, write protected (<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">chmod 444</span>). This would prevent any accidentally start ups. <br />
<br />
I apply all my customizations and make <span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"><vm name>-start </span>a good "starting image" for other images. I would have all my standard applications that I would require regardless of what an image would be used for (such as installing chrome). After I'm done, I would write-protect this image as well.<br />
<br />
At this point I would make snapshots based off <span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"><vm name>-start</span>. I could make multiple, each signifying its own purpose. I can swap between them by using the <span style="color: #101010; font-family: 'Courier New', Courier, monospace; font-size: xx-small; white-space: pre-wrap;">virsh define </span>command. Because all the snapshots are forked off <span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"><vm name>-start </span>as long as I don't start that snapshot (or its parent), then I won't have any problems invalidating any of my snapshots.<br />
<br />
If I have an instance called <span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"><vm name>-eclipse</span>, which houses say an eclipse development environment, if I ever wanted to make a major change to it that I want to try out, such as an SDK upgrade, I can create a snapshot of this snapshot called <span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"><vm name>-eclipse-updated</span>. I can play around with the new snapshot, test things out, and decide at the end to either keep the snapshot or toss it out. If I keep the new snapshot in replacement of the original, I go ahead and write-protect the <span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"><vm name>-eclipse</span> so that I don't accidentally start it up again.<br />
<br />
Because we are using qcow2, the images and their descendants will be relatively conservative on disk consumption (remember to not pre-allocate space) since the snapshots are all deltas of the original (duplication of data is a minimum).Anonymoushttp://www.blogger.com/profile/16677545615031598278noreply@blogger.com0tag:blogger.com,1999:blog-4219190022818787033.post-19584075940559711162013-12-23T22:43:00.000-05:002013-12-23T22:43:02.633-05:00 Making sodas with Primo Flavorstation [day 18 of 20-days-of-posts series]<a href="https://dl.dropboxusercontent.com/u/14855532/primo/IMG_20130523_223747_500.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="320" src="https://dl.dropboxusercontent.com/u/14855532/primo/IMG_20130523_223747_500.jpg" width="180" /></a><br />
I already owned a SodaStream system, but I figured I'd give this a try, since the price is right. A SodaStream canister is $30, so you can't go wrong getting a canister that is larger + a whole system for only $5 more.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<a href="https://dl.dropboxusercontent.com/u/14855532/primo/IMG_20130523_223758_473.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="320" src="https://dl.dropboxusercontent.com/u/14855532/primo/IMG_20130523_223758_473.jpg" width="180" /></a><br />
<br />
It doesn't carbonate into a 1L or 0.5L bottle like the SodaStream. Instead, it's more like the single cup coffee makers. I've found that it seems to hold about 355ml of water (my glass holds exactly 355ml, the same size as a can of soda). Adjust the FSS button to control the size of the bubbles, press the carbonate button a few times (until you hear the buzz sound), then with your glass on the tray, press down on the lever to dispense the soda into the glass. You can either then add any syrups (or like I do, have them already in the glass before you pore in the carbonated water).<br />
<br />
<br />
<br />
<br />
<a href="https://dl.dropboxusercontent.com/u/14855532/primo/IMG_20130523_223855_505.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="320" src="https://dl.dropboxusercontent.com/u/14855532/primo/IMG_20130523_223855_505.jpg" width="180" /></a><br />
The perks are that it comes with a CO2 canister that is a standard paintball canister (but beverage grade, not like it makes much of a difference). You pop on an adapter that lets you plug the canister into the system. You can get the 20oz canister (larger than SodaStream's 14.5oz) refilled anywhere canisters are refilled. You can also plug in any standard paintball canister into the adapter that plugs into the system. Added bonus, the system also comes with an adapter to screw onto any SodaStream canister, so if you can't find any paintball refill locations, you can always just buy yourself a SodaStream canister to use with the system.<br />
<br />
With the initial charge, I obtained 65L of carbonated beverage with a 20oz canister filled with 16oz of CO2. I've refilled the canister for $9 at a local homebrew store.<br />
<br />
<br />
The unit comes with two kinds of tank threads. A green one that will fit SodaStream canisters and a grey one that fits Primo canisters.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://dl.dropboxusercontent.com/u/14855532/primo/IMG_20130523_224512_885.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="https://dl.dropboxusercontent.com/u/14855532/primo/IMG_20130523_224512_885.jpg" width="320" /></a></div>
<br />
<br />
<br />
The machine makes great carbonated beverage with the level of carbonation and bubble-size controlled by two machine mechanisms.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://dl.dropboxusercontent.com/u/14855532/primo/IMG_20130523_223729_075.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="https://dl.dropboxusercontent.com/u/14855532/primo/IMG_20130523_223729_075.jpg" width="320" /></a></div>
<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://dl.dropboxusercontent.com/u/14855532/primo/IMG_20130523_223940_688.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="https://dl.dropboxusercontent.com/u/14855532/primo/IMG_20130523_223940_688.jpg" width="320" /></a></div>
<br />
<div style="text-align: center;">
Easy instructions from the manual.</div>
Anonymoushttp://www.blogger.com/profile/16677545615031598278noreply@blogger.com0tag:blogger.com,1999:blog-4219190022818787033.post-15104352911272728542013-12-23T21:25:00.003-05:002013-12-23T21:25:30.920-05:00PERL implementation of Google Drive (cross-platform) designed for Linux [day 17 of 20-days-of-posts series]<h1 style="border-bottom-color: rgb(221, 221, 221); border-bottom-style: solid; border-bottom-width: 1px; color: #333333; cursor: text; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 2.5em; line-height: 1.7; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 0px !important; padding: 0px; position: relative;">
PERL-pDrive</h1>
<div style="color: #333333; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 25px; margin-bottom: 15px; margin-top: 15px;">
A PERL implementation of Google Drive for cross-platform</div>
<div style="color: #333333; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 25px; margin-bottom: 15px; margin-top: 15px;">
<br /></div>
<div style="color: #333333; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 25px; margin-bottom: 15px; margin-top: 15px;">
A work in progress. </div>
<div style="color: #333333; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 25px; margin-bottom: 15px; margin-top: 15px;">
<br /></div>
<div style="color: #333333; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 25px; margin-bottom: 15px; margin-top: 15px;">
Currently the application can download all files in a Google Drive account and upload files listed in a list file.</div>
<div style="color: #333333; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 25px; margin-bottom: 15px; margin-top: 15px;">
move file on server</div>
<ul style="color: #333333; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 25px; margin: 15px 0px; padding: 0px 0px 0px 30px;">
<li>old path is cached; track by resourceID</li>
<li>need to move files</li>
<li>add hash of resourceIDs</li>
</ul>
<div style="color: #333333; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 25px; margin-bottom: 15px; margin-top: 15px;">
upload cache config console mode service mode -- wrapper multiple accounts</div>
<div style="color: #333333; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 25px; margin-bottom: 15px; margin-top: 15px;">
phase 2</div>
<ul style="color: #333333; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 25px; margin: 15px 0px; padding: 0px 0px 0px 30px;">
<li>OAUTH1</li>
<li>OAUTH2</li>
</ul>
<div style="color: #333333; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 25px; margin-bottom: 15px; margin-top: 15px;">
phase 3</div>
<ul style="color: #333333; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 25px; margin-bottom: 0px !important; margin-left: 0px; margin-right: 0px; margin-top: 15px; padding: 0px 0px 0px 30px;">
<li>google drive API / SDK m</li>
</ul>
Anonymoushttp://www.blogger.com/profile/16677545615031598278noreply@blogger.com0tag:blogger.com,1999:blog-4219190022818787033.post-75337862563576831022013-12-23T21:03:00.000-05:002013-12-23T21:03:44.833-05:00cacheStreamer for XBMC [day 16 of 20-days-of-posts series]<div style="color: #333333; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 25px; margin-bottom: 15px; margin-top: 15px;">
Cache Streamer Video add-on for XBMC</div>
<pre style="background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px; word-wrap: normal;"><code style="background-color: transparent; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: none; font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 12px; margin: 0px; padding: 0px; word-wrap: normal;">Streams a file down to a local storage file, and streams while the file downloads.
</code></pre>
<div style="color: #333333; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 25px; margin-bottom: 15px; margin-top: 15px;">
Originally developed to fix a HTTPS streaming issue in XBMC on the Raspberry Pi.</div>
<div style="color: #333333; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 25px; margin-bottom: 15px; margin-top: 15px;">
Supports [Tested on]: All XBMC 12, 12.2, and 13 including Raspberry Pi, Linux, Windows, OS X, Android, Pivos, iOS (including ATV2)</div>
<div style="color: #333333; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 25px; margin-bottom: 15px; margin-top: 15px;">
Current Version: v0.1.0</div>
<ul style="color: #333333; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 25px; margin-bottom: 0px !important; margin-left: 0px; margin-right: 0px; margin-top: 15px; padding: 0px 0px 0px 30px;">
<li>first public release</li>
</ul>
Anonymoushttp://www.blogger.com/profile/16677545615031598278noreply@blogger.com0tag:blogger.com,1999:blog-4219190022818787033.post-81547109934905429942013-12-23T20:57:00.000-05:002013-12-23T20:57:29.659-05:00tvScheduler for XBMC [day 15 of 20-days-of-posts series]<div style="color: #333333; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 25px; margin-bottom: 15px; margin-top: 15px;">
A tv scheduler add-on for XBMC</div>
<div style="color: #333333; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 25px; margin-bottom: 15px; margin-top: 15px;">
A video add-on for XBMC that enables playback of videos that are listed in a Google Spreadsheet.</div>
<div style="color: #333333; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 25px; margin-bottom: 15px; margin-top: 15px;">
Supports [Tested on]: All XBMC 12 and 12.2 including Linux, Windows, OS X, Raspberry Pi Android, Pivos, iOS (including ATV2)</div>
<div style="color: #333333; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 25px; margin-bottom: 15px; margin-top: 15px;">
The plugin uses the Google Spreadsheet API 3.</div>
<div style="color: #333333; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 25px; margin-bottom: 15px; margin-top: 15px;">
Getting Started: 1) download the .zip file 2) transfer the .zip file to XBMC 3) in Video Add-on, select Install from .zip</div>
<div style="color: #333333; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 25px; margin-bottom: 15px; margin-top: 15px;">
Before starting the add-on for the first time, either "Configure" or right click and select "Add-on Settings". Enter your fully-qualified Username (including @gmail.com or @domain) and Password.</div>
<div style="color: #333333; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 25px; margin-bottom: 15px; margin-top: 15px;">
FAQ:</div>
<div style="color: #333333; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 25px; margin-bottom: 15px; margin-top: 15px;">
Current Version: v0.1.0</div>
<ul style="color: #333333; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 25px; margin: 15px 0px; padding: 0px 0px 0px 30px;">
<li>first public release</li>
</ul>
Anonymoushttp://www.blogger.com/profile/16677545615031598278noreply@blogger.com0tag:blogger.com,1999:blog-4219190022818787033.post-62475566858501002822013-12-23T20:23:00.001-05:002013-12-23T20:23:13.262-05:00Monoprice 7-port USB Hub for Raspberry Pi [day 14 of 20-days-of-posts series]The <a href="http://www.monoprice.com/Product?c_id=103&cp_id=10307&cs_id=1030702&p_id=5328&seq=1&format=2">Monoprice 7-port USB hub</a> is Raspberry Pu friendly.<br />
<br />
The hub is powered by a 2amp power brick. The power brick is fairly slim -- in a power bar, it would prevent another brick being plugged into the plugs next to it, but it does provide enough clearing to allow someone to plug a power cable into adjacent plugs. The hub will provide enough power (1amp) to power the Pi. Unlike other high-powered USB hubs that I have tried, the hub will provide greater than 0.5amp to device connected to it even though there is no host connected to it. <b><u>This is critical</u></b>. A lot of other hubs I have tried, they will provide high-power to a USB device connected to the hub only if there is an established host connection to the hub. Therefore, if you try to connect a Pi to the hub, it is not able to provide enough power to the Pi to start it up because there is no host connected to the hub. The Pi needs to be powered up before it will establish a host connection with the hub.<br />
<br />
With the <a href="http://www.monoprice.com/Product?c_id=103&cp_id=10307&cs_id=1030702&p_id=5328&seq=1&format=2">Monoprice 7-port USB hub</a>, the hub will provide enough power the usb connections to power the Pi up even before the host connection is established. This is witnessed by a red light on the hub, which indicates it is powered on. When the Pi itself is powered on and started, blue lights will turn on the hub to indicate connections of those devices to the host have been established.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://dl.dropboxusercontent.com/u/14855532/hub/IMG_20131217_161034_152.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="https://dl.dropboxusercontent.com/u/14855532/hub/IMG_20131217_161034_152.jpg" width="320" /></a></div>
<br />
<br />
The hub also prevents backpowering over the USB host connect. This allow for a switch to actually work. Without this ability, the power switch would be futile as the Pi would become powered on automatically via the host connection between the Pi and hub when the hub gets powered on.<br />
<br />
The hub will provide 5 USB side connections and 2 USB top connections.<br />
<br />
The hub can be disassembled. The plastic case is easily removed.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://dl.dropboxusercontent.com/u/14855532/hub/IMG_20131217_161104_085.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="https://dl.dropboxusercontent.com/u/14855532/hub/IMG_20131217_161104_085.jpg" width="320" /></a></div>
<br />
The board could be integrated in your Raspberry Pi case design, as I have in my<a href="http://ddurdle.blogspot.com/2013/12/my-headless-raspberry-pi-server-day-5.html"> headless Pi server</a>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://dl.dropboxusercontent.com/u/14855532/pi-monster/IMG_20131217_121705_425.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="https://dl.dropboxusercontent.com/u/14855532/pi-monster/IMG_20131217_121705_425.jpg" width="320" /></a></div>
<br />
<br />
<br />Anonymoushttp://www.blogger.com/profile/16677545615031598278noreply@blogger.com2tag:blogger.com,1999:blog-4219190022818787033.post-2907296570530178812013-12-23T15:20:00.002-05:002013-12-27T21:44:10.651-05:00Overview of power switch options for the Raspberry Pi [day 13 of 20-days-of-posts series]A power switch was omitted in the design of the Raspberry Pi to keep costs down. There was no easy interface provided to add one either, but there are many different options. I had previously tackled the <a href="http://ddurdle.blogspot.com/2013/09/adding-power-switch-to-raspberry-pi.html">original topic in a previous post</a>, comparing a few options, including building your circuit.<br />
<br />
<div>
<b>Challenge: </b>The Raspberry Pi always remains powered-on as long as there is power coming in on the micro-USB power line. A shutdown/halt/poweroff command will shutdown the OS and leave the system in a powered on but idle state. The power consumption would be unchanged between idle and active on the Raspberry Pi. Further, to turn the system back on, the USB cable needs to be unplugged or the power supply needs to be unplugged (reset).<br />
<br />
Ideally we need....<br />
<br />
<ul>
<li>something that powers the raspberry pi off when it is shutdown (power consumption becomes negligible / < 0.5 W) [POWER OFF]</li>
<li>something that can trigger a clean software shutdown [CLEAN SHUTDOWN]</li>
</ul>
<div>
<br /></div>
</div>
<div>
Over the past few months since the <a href="http://ddurdle.blogspot.com/2013/09/adding-power-switch-to-raspberry-pi.html">original topic / post</a>, I've covered the following options:</div>
<div>
<ol>
<li><a href="http://ddurdle.blogspot.com/2013/09/adding-power-switch-to-raspberry-pi.html">make your own circuit</a>,</li>
<li><a href="http://ddurdle.blogspot.com/2013/12/using-usb-big-red-button-panic-button.html">repurpose a USB Big Red Button</a>,</li>
<li><a href="http://ddurdle.blogspot.com/2013/12/illuminated-and-rocker-style-power.html">illuminated and rocker-style power switches by Mausberry Circuits</a></li>
<li><a href="http://ddurdle.blogspot.com/2013/12/belkin-wemo-switch-as-raspberry-pi.html">WeMo [Insight] Switch by Belkin</a></li>
<li><a href="http://ddurdle.blogspot.com/2013/12/remotepi-board-power-ir-switch-day-11.html">RemotePi Board by MSL Digital Solutions</a></li>
</ol>
</div>
<div>
I've felt it was time to do a head-to-head comparison of the five options that were discussed in the previous posts.<br />
<br />
<b>Assumptions:</b><br />
<br />
<ul>
<li>all values are in USD; shipping costs and taxes are excluded throughout </li>
<li>measurements are based on a scale of 1 - 5</li>
</ul>
</div>
<table border="1" cellspacing="0">
<tbody>
<tr>
<th width="15%"></th>
<th width="17%">Build Your Own Circuit</th>
<th width="17%">USB Big Red Button</th>
<th width="17%">illuminated /<br />
rocker-style<br />
by <a href="http://www.mausberrycircuits.com/">Mausberry Circuits</a></th>
<th width="17%">WeMo Switch by Belkin</th>
<th width="17%">RemotePi Board<br />
by <a href="http://msl-digital-solutions.myshopify.com/">MSL Digital Solutions</a></th>
</tr>
<tr>
<td><span style="font-size: x-small;"><b>Product Page</b></span></td>
<td><span style="font-size: x-small;">n/a</span></td>
<td><a href="http://www.dreamcheeky.com/big-red-button">link</a></td>
<td><span style="font-size: x-small;"><a href="http://www.mausberrycircuits.com/products/illuminated-led-shutdown-switch">illuminated switch</a></span><br />
<span style="font-size: x-small;"><a href="http://www.mausberrycircuits.com/products/direct-plug-shutdown-switch-with-rocker">rocker switch</a></span><br />
<a href="http://www.mausberrycircuits.com/products/shutdown-switch-with-rocker"><span style="font-size: x-small;">generic USB switch</span></a><br />
<span style="font-size: x-small;"><a href="http://www.mausberrycircuits.com/products/shutdown-circuit-use-your-own-switch">custom switch</a></span></td>
<td><span style="font-size: x-small;"><a href="http://www.belkin.com/us/Products/home-automation/c/wemo-home-automation/">WeMo</a></span></td>
<td><span style="font-size: x-small;"><a href="http://msl-digital-solutions.myshopify.com/products/remotepi-board">RemotePI</a></span></td>
</tr>
<tr>
<td><b><span style="font-size: x-small;">Price</span></b></td>
<td>varies based on parts<br />
($ 5 - $ 40)</td>
<td>$ 1 - $ 7</td>
<td>$ 14 - $ 16</td>
<td>$ 50</td>
<td>$ 24 - $ 27</td>
</tr>
<tr>
<td><b><span style="font-size: x-small;">Integration </span></b></td>
<td>bulky setup</td>
<td>plug into free USB port</td>
<td><br />
3 jumper wires hooked upto GPIO</td>
<td>plug Pi USB power plug into</td>
<td>locks onto GPIO</td>
</tr>
<tr>
<td><b><span style="font-size: x-small;">Easy of Hardware Setup </span></b></td>
<td><span style="font-size: large;">1</span> / 5<br />
<span style="font-size: x-small;">- soldering required</span></td>
<td><span style="font-size: large;">5</span> / 5<br />
<span style="font-size: x-small;">- plug-and-play</span><br />
<span style="font-size: x-small;">- solder-free</span></td>
<td><br />
<span style="font-size: large;">4</span> / 5<br />
<span style="font-size: x-small;">- risk of causing damage if you place the cables on the wrong pins</span><br />
<span style="font-size: x-small;">- solder-free</span><br />
<br /></td>
<td><span style="font-size: large;">5</span> / 5<br />
<span style="font-size: x-small;">plugs in</span></td>
<td><span style="font-size: large;">5</span> / 5<br />
<span style="font-size: x-small;">- plugs in, screws on</span><br />
<span style="font-size: x-small;">- solder-free</span></td>
</tr>
<tr><td><b><span style="font-size: x-small;">Easy of Software Setup </span></b><br />
<br /></td>
<td><span style="font-size: large;">1</span> / 5<br />
<span style="font-size: x-small;">- requires writing your own app</span></td>
<td><span style="font-size: large;">2</span> / 5<br />
<span style="font-size: x-small;">requires installing apt-get packages, compiling and provided C code</span></td>
<td><span style="font-size: large;">4 </span>/ 5<br />
<span style="font-size: x-small;">- run switch.sh install</span><br />
<span style="font-size: x-small;">- default script had issue causing crashing Pi, <a href="http://ddurdle.blogspot.com/2013/12/modified-switchsh-for-raspberry-pi.html">some modification needed to code</a></span></td>
<td><span style="font-size: large;">2</span> / 5<br />
<span style="font-size: x-small;">- requires phone app</span><br />
<span style="font-size: x-small;">- firmware and app buggy</span></td>
<td><span style="font-size: large;">4</span> / 5<br />
<span style="font-size: x-small;">- run irswitch.sh install</span><br />
<span style="font-size: x-small;">- program power button on remote</span><br />
<span style="font-size: x-small;">- <a href="http://ddurdle.blogspot.com/2013/12/customizing-your-raspberry-pi-remote.html">setup lird.conf for remote</a></span></td>
</tr>
<tr>
<td><b><span style="font-size: x-small;">Reset Button</span></b><br />
<b><span style="font-size: x-small;">[hard reset]?</span></b></td>
<td>DEPENDS<br />
<span style="font-size: xx-small;">if intercepts power source</span></td>
<td><span style="font-size: large;">NO</span></td>
<td><span style="font-size: xx-small;">iluminated switch </span>NO<br />
<span style="font-size: xx-small;">rocker switch </span>YES</td>
<td><span style="font-size: large;">NO</span></td>
<td><span style="font-size: large;">NO</span></td>
</tr>
<tr>
<td><b><span style="font-size: x-small;">Safe Shutdown?</span></b></td>
<td><span style="font-size: large;">YES</span></td>
<td><span style="font-size: large;">YES</span></td>
<td><span style="font-size: large;">YES</span></td>
<td>NO<br />
<span style="font-size: xx-small;">(use some thought process around shutdowns)</span></td>
<td><span style="font-size: large;">YES</span></td>
</tr>
<tr>
<td><b><span style="font-size: x-small;">Power Consumption</span></b><br />
<b><span style="font-size: x-small;">[as measured by a <a href="http://en.wikipedia.org/wiki/Kill_A_Watt">kill-a-watt</a>] </span></b></td>
<td><span style="font-size: x-small;">negligible</span><span style="font-size: x-small;"> </span></td>
<td><span style="font-size: x-small;">negligible</span></td>
<td><span style="font-size: x-small;">negligible</span></td>
<td>1.5 - 2.5 W<br />
<span style="font-size: x-small;">just as much power as the Pi!</span></td>
<td><span style="font-size: x-small;">negligible</span></td>
</tr>
<tr>
<td><b><span style="font-size: x-small;">Completely Powers off Pi?</span></b></td>
<td>DEPENDS<br />
<span style="font-size: xx-small;">if intercepts power source</span></td>
<td><span style="font-size: large;">NO</span></td>
<td><span style="font-size: large;">YES</span></td>
<td><span style="font-size: large;">YES</span></td>
<td><span style="font-size: large;">YES</span></td>
</tr>
<tr>
<td><span style="font-size: x-small;"><b>Powers Pi by</b></span></td>
<td><span style="font-size: x-small;">GPIO, micro USB or USB </span><span style="font-size: xx-small;">(Pi rev B)</span></td><td><span style="font-size: x-small;">n/a</span></td>
<td><span style="font-size: x-small;">micro USB via micro USB</span></td>
<td><span style="font-size: x-small;">micro USB or USB port</span><span style="font-size: xx-small;"> (Pi rev B)</span></td>
<td><span style="font-size: x-small;">GPIO via micro USB</span></td></tr>
<tr>
<td><span style="font-size: x-small;"><b>Shutdown Scripts</b></span></td><td><br /></td><td><a href="https://dl.dropboxusercontent.com/u/14855532/big-red-button.c">device driver</a></td><td><a href="http://files.mausberrycircuits.com/setup.sh">RaspBMC/Raspbian/Debian</a><br /><a href="http://files.mausberrycircuits.com/setupOE.sh">OpenELEC</a><br /><a href="http://files.mausberrycircuits.com/setupArch.sh">Arch</a></td><td>n/a</td><td><a href="http://msl-digital-solutions.myshopify.com/pages/more-information/">OpenElec</a><br /><a href="http://msl-digital-solutions.myshopify.com/pages/more-information/">RaspBMC</a><br /><a href="http://msl-digital-solutions.myshopify.com/pages/more-information/">XBian</a></td>
</tr>
<tr>
<td><span style="font-size: x-small;"><b>Major Selling Features</b></span></td>
<td><span style="font-size: x-small;">- switches can be used for other purposes</span></td><td><span style="font-size: x-small;">- switches can be used for other purposes</span></td>
<td><span style="font-size: x-small;">- select models include reset switch</span><br />
<span style="font-size: x-small;">- rocker switch (left in on position) works with well WeMo to power on remotely</span></td>
<td><span style="font-size: x-small;">- power on Pi using different conditions</span><br />
<span style="font-size: x-small;">- remote power on / off / reboot</span></td>
<td><span style="font-size: x-small;">- includes IR receiver for XBMC</span><br />
<span style="font-size: x-small;">- only solution that can power on Pi via IR</span></td></tr>
<tr>
<td><span style="font-size: x-small;"><b>Full Review</b></span></td>
<td><span style="font-size: x-small;"><a href="http://ddurdle.blogspot.com/2013/09/adding-power-switch-to-raspberry-pi.html">previous post</a></span></td>
<td><span style="font-size: x-small;"><a href="http://ddurdle.blogspot.com/2013/12/using-usb-big-red-button-panic-button.html">previous post</a></span></td>
<td><span style="font-size: x-small;"><a href="http://ddurdle.blogspot.com/2013/12/illuminated-and-rocker-style-power.html">previous post</a></span></td>
<td><span style="font-size: x-small;"><a href="http://ddurdle.blogspot.com/2013/12/belkin-wemo-switch-as-raspberry-pi.html">previous post</a></span></td>
<td><span style="font-size: x-small;"><a href="http://ddurdle.blogspot.com/2013/12/remotepi-board-power-ir-switch-day-11.html">previous post</a></span></td>
</tr>
<tr>
<td><span style="font-size: x-small;"><b>My Sample Integration</b></span></td>
<td><span style="font-size: x-small;">n/a</span></td>
<td><span style="font-size: x-small;">n/a</span></td>
<td><span style="font-size: x-small;"><a href="http://ddurdle.blogspot.com/2013/12/my-headless-raspberry-pi-server-day-5.html">rocker switch</a></span><br />
<span style="font-size: x-small;"><a href="http://ddurdle.blogspot.com/2013/09/my-revised-second-raspberry-pi-lego.html">illuminated switch</a></span></td>
<td><span style="font-size: x-small;">n/a</span></td>
<td><span style="font-size: x-small;"><a href="http://ddurdle.blogspot.com/2013/12/my-original-first-raspberry-pi-model-b.html">RemotePi</a></span></td>
</tr>
</tbody></table>
Anonymoushttp://www.blogger.com/profile/16677545615031598278noreply@blogger.com1tag:blogger.com,1999:blog-4219190022818787033.post-61322988534446543612013-12-23T13:42:00.004-05:002013-12-23T13:43:10.358-05:00Illuminated and Rocker-style power switches for the Raspberry Pi<br />
As previously discussed in <a href="http://ddurdle.blogspot.com/2013/09/adding-power-switch-to-raspberry-pi.html">in a post about power switch options</a> for the Raspberry Pi, <a href="http://www.mausberrycircuits.com/">mausberrycircuits</a> was identified as a source of several options. Original a kickstarter campaign, the hobbiest sells various of his creations including power switches, custom switch PCB boards and car ignition boards all for the Raspberry Pi. He will even work with your design requirements and alter the switch.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://cdn.shopify.com/s/files/1/0262/4243/products/IMG_1043_1024x1024.jpg?13" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="http://cdn.shopify.com/s/files/1/0262/4243/products/IMG_1043_1024x1024.jpg?13" width="261" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://cdn.shopify.com/s/files/1/0262/4243/products/photo-4_1024x1024.jpg?13" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="225" src="http://cdn.shopify.com/s/files/1/0262/4243/products/photo-4_1024x1024.jpg?13" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<br />
His power circuits is essentially a circuit board that is placed inline with the micro-USB power line, with two connections to the GPIO (1 input, 1 output). A press of the button or a toggle of the switch takes the unit from off (complete power off for the raspberry pi) to on mode. A shell script starts on bootup that passes a high/1 to the switch to instruct indicate the raspberry pi is on. A low/0 signal passes from the switch to the raspberry pi to indicate the switch is neutral. A toggle of the rocket switch to off or holding a press button switch for two seconds changes the output to high/1 which the polling script triggers a safe poweroff. When the raspberry pi has finally fully shutdown, the GPIO goes from high/1 to low/0, which tells the switch the raspberry pi power can be cut safely. The rocket-style switches also come with a reset button that can trigger a raspberry pi reset if it becomes frozen, etc -- something that normally would require to pull the power line.<br />
<br />
The switch also detects software shutdowns invoked by the user (as the GPIO will toggle from high/1 to low/0, which the switch polls for).<br />
<br />
<br />
<i>Pros</i>:<br />
<br />
<ul>
<li>very small</li>
<li>may need some modification to your raspberry pi case</li>
<li>addresses the CLEAN SHUTDOWN and POWER OFF requirements fully.</li>
</ul>
<br />
<i>Cons</i>:<br />
<br />
<ul>
<li>expensive but cheaper then any alternatives</li>
<li>everything fully assembled</li>
</ul>
<br />
<br />
I purchased a number of the switches from Mausberry Circuits. The illuminated push button switch easily integrates into my lego design cases -- the added width is 1 lego block.<br />
<br />
<b><u>The illuminated switch integrated:</u></b><br />
<br />
Here's what my case looked like before adding the switch:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://dl.dropboxusercontent.com/u/14855532/pi-v1r1/pi-v1r1-rside.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://dl.dropboxusercontent.com/u/14855532/pi-v1r1/pi-v1r1-rside.jpg" width="320" /></a></div>
<br />
<br />
I had to rip down the right-side wall to set it up. But it is lego after all. Time to integrate the switch into the case!<br />
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://dl.dropboxusercontent.com/u/14855532/pi-v1r2/pi-v1r2-construction1.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://dl.dropboxusercontent.com/u/14855532/pi-v1r2/pi-v1r2-construction1.jpg" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://dl.dropboxusercontent.com/u/14855532/pi-v1r2/pi-v1r2-construction2.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://dl.dropboxusercontent.com/u/14855532/pi-v1r2/pi-v1r2-construction2.jpg" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
After:</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://dl.dropboxusercontent.com/u/14855532/pi-v1r2/pi-v1r2-on1.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://dl.dropboxusercontent.com/u/14855532/pi-v1r2/pi-v1r2-on1.jpg" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<b><u>The rocker-style switch integrated:</u></b></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://dl.dropboxusercontent.com/u/14855532/pi-monster/IMG_20131217_121658_669.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="https://dl.dropboxusercontent.com/u/14855532/pi-monster/IMG_20131217_121658_669.jpg" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
Anonymoushttp://www.blogger.com/profile/16677545615031598278noreply@blogger.com1tag:blogger.com,1999:blog-4219190022818787033.post-24639480936074911182013-12-23T13:28:00.001-05:002013-12-23T13:30:41.527-05:00My original First Raspberry Pi Model B lego case revitalized [day 12 of 20-days-of-posts series]<br />
My <a href="http://ddurdle.blogspot.com/2013/12/my-original-raspberry-pi-server-lego.html">original lego case design case was previously discussed</a>. Since then, I've integrated an all-in-one LED, IR receiver and power switch board, plugged into the GPIO. I decided to take this time to drastically improve on the original case design.<br />
<b><br /></b>
<br />
<b>Intention</b>: To be used for various purposes including as an XBMC media player,airplay server/client, a ASTC to wifi converter box, etc. Need for both ethernet and wifi and access to a keyboard/trackball.<br />
<br />
<br />
<b>Equipment</b>:<br />
<ul>
<li>Raspberry Pi (model B -- memory: 512MB, 2 USB ports, ethernet)</li>
<li><a href="http://ddurdle.blogspot.ca/2013/12/remotepi-board-power-ir-switch-day-11.html">RemotePi Board</a> (<a href="http://ddurdle.blogspot.ca/2013/12/remotepi-board-power-ir-switch-day-11.html">previously reviewed</a>)</li>
<li>class 10 SD card</li>
<li>micro USB (for power, plugged into TV <-> raspberry pi)</li>
<li>HDMI cable</li>
</ul>
<div>
<b>Assumptions</b>:</div>
<div>
<ul>
<li>possible need for VIDEO port</li>
<li>possible need for AUDIO jack</li>
<li>no need for access to the i/o ports (camera port, GPIO pins, etc)</li>
<li>require a "window" for IR receiver</li>
<li>require a "window" for the power LED</li>
</ul>
</div>
<div>
<u><br /></u>
<br />
<span style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-style: italic; line-height: 18px;">Like with most of my lego projects, I don't provide full schematics and block lists. My opinion is that if you have unused lego that you can use for a project like this, you make use of what you have, improvising as you go.</span><br />
<u><br /></u><u>Front-side view</u>: </div>
<br />
<i>Before:</i><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://dl.dropboxusercontent.com/u/14855532/pi-v2r1/pi-v2r1-front.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://dl.dropboxusercontent.com/u/14855532/pi-v2r1/pi-v2r1-front.jpg" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://dl.dropboxusercontent.com/u/14855532/pi-v2r1/pi-v2r1-front_door.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://dl.dropboxusercontent.com/u/14855532/pi-v2r1/pi-v2r1-front_door.jpg" width="320" /></a></div>
<br />
<i>After:</i><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://dl.dropboxusercontent.com/u/14855532/pi-tvb/IMG_20131218_224426_382.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="https://dl.dropboxusercontent.com/u/14855532/pi-tvb/IMG_20131218_224426_382.jpg" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://dl.dropboxusercontent.com/u/14855532/pi-tvb/IMG_20131218_224439_598.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="https://dl.dropboxusercontent.com/u/14855532/pi-tvb/IMG_20131218_224439_598.jpg" width="320" /></a></div>
<br />
A big transformation on the front side of the case. The IR receiver is no longer snaked along to this view-point. Therefore, it is no longer the front-side.<br />
<br />
The IR window and onboard Pi LED window is replaced with a smaller transparent block that glows and presents better than the original. The window door is replaced with a much shorter pair of "flag" doors, providing access to the VIDEO and AUDIO jack, keeping them "tucked away" when not in use and not negatively impacting the functionality of the case while in use.<br />
<br />
The front of the unit no longer curves up, shortening the base of the unit by 1 lego block size. The height has been drastically reduced from s 4 +1/3rd lego blocks to 3 blocks without affecting any functionality. The bottom 1/3rd lego block size is now self-re-enforced grey layer. The second 1/3rd lego block size black layer is gone, now that the base has better structure from a single layer. <br />
<br />
<br />
<div>
<u>Right-side view</u>:</div>
<div>
<br />
<i>Before:</i></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://dl.dropboxusercontent.com/u/14855532/pi-v2r1/pi-v2r1-rside.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://dl.dropboxusercontent.com/u/14855532/pi-v2r1/pi-v2r1-rside.jpg" width="320" /></a></div>
<i><br /></i>
<i>After:</i><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://dl.dropboxusercontent.com/u/14855532/pi-tvb/IMG_20131218_224536_638.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="https://dl.dropboxusercontent.com/u/14855532/pi-tvb/IMG_20131218_224536_638.jpg" width="320" /></a></div>
<i><br /></i>
</div>
<div>
I placed a white window block where the power switch's onboard LED is positioned, that gives the unit a nice glow when lit. I placed an inset blue window piece for IR window. The IR range provided by the window is adequate enough to get at least a 45 degree angle using the remote. I moved up the blocks for the micro USB power port to line up with the new port. I also added some support around the SD card as it was previously hanging out of the system. It is now protected from being hit (and damaging the SD card port).</div>
<br />
<br />
<u>Back-side view</u>:<br />
<br />
<i>Before:</i><br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://dl.dropboxusercontent.com/u/14855532/pi-v2r1/pi-v2r1-back.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://dl.dropboxusercontent.com/u/14855532/pi-v2r1/pi-v2r1-back.jpg" width="320" /></a></div>
<i>After:</i><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://dl.dropboxusercontent.com/u/14855532/pi-tvb/IMG_20131218_224612_849.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="https://dl.dropboxusercontent.com/u/14855532/pi-tvb/IMG_20131218_224612_849.jpg" width="320" /></a></div>
<br />
<br />
I had to get rid f the original HDMI top-swing door. It required 2 + 2/3 lego blocks height. With the shorter height, it was not possible to accommodate the door. These "flag" doors are starting to become a favourite of mine, as they stay on better and they have a smaller footprint, adjust easier, and don't distract. When not connected to a monitor/TV (for headless operation), the doors are swung down to prevent dust buildup.<br />
<br />
<u>Left-side view</u>:<br />
<br />
<i>Before:</i><br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://dl.dropboxusercontent.com/u/14855532/pi-v2r1/pi-v2r1-lside.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://dl.dropboxusercontent.com/u/14855532/pi-v2r1/pi-v2r1-lside.jpg" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://dl.dropboxusercontent.com/u/14855532/pi-v2r1/pi-v2r1-lside_door.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://dl.dropboxusercontent.com/u/14855532/pi-v2r1/pi-v2r1-lside_door.jpg" width="320" /></a></div>
<br />
<i>After:</i><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://dl.dropboxusercontent.com/u/14855532/pi-tvb/IMG_20131218_224734_896.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="https://dl.dropboxusercontent.com/u/14855532/pi-tvb/IMG_20131218_224734_896.jpg" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://dl.dropboxusercontent.com/u/14855532/pi-tvb/IMG_20131218_224800_582.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="https://dl.dropboxusercontent.com/u/14855532/pi-tvb/IMG_20131218_224800_582.jpg" width="320" /></a></div>
<br />
The top-swing door over the ethernet port was shortened to accommodate the new height of the case. The door allows the port to be tucked away when not in use. It sits perfectly flush to the unit, and with a change in the door swing mechanism the door doesn't become flimsy when open (easily falls off).<br />
<br />
The LED windows have been eliminated since they are visible through the front-side view.<br />
<br />
The unit is depicted with a wifi dongle and a wireless lenovo multimedia keyboard/trackpad dongle.<br />
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://www.blogcdn.com/www.engadget.com/media/2009/12/lenovo_multimedia_remote_with_keyboard_by_lenovo.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="198" src="http://www.blogcdn.com/www.engadget.com/media/2009/12/lenovo_multimedia_remote_with_keyboard_by_lenovo.jpg" width="320" /></a></div>
<br />
(this keyboard, which I owned for 1-2 years prior to owning the pi, but had yet found not a single purpose for it. Now I find the keyboard a pure necessity )<br />
<div>
<br /></div>
<br />
<div>
<u>Top view</u>:</div>
<div>
<i><br /></i>
<i>Before:</i></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://dl.dropboxusercontent.com/u/14855532/pi-v2r1/pi-v2r1-top.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://dl.dropboxusercontent.com/u/14855532/pi-v2r1/pi-v2r1-top.jpg" width="320" /></a></div>
<i><br /></i></div>
<div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://dl.dropboxusercontent.com/u/14855532/pi-v2r1/pi-v2r1-easyaccess1.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://dl.dropboxusercontent.com/u/14855532/pi-v2r1/pi-v2r1-easyaccess1.jpg" width="320" /></a></div>
<br /></div>
<div style="-webkit-text-stroke-width: 0px; color: black; font-family: 'Times New Roman'; font-size: medium; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">
<div class="separator" style="clear: both; font-style: normal; margin: 0px; text-align: center;">
</div>
<div style="font-style: normal; margin: 0px;">
<br /></div>
<div style="margin: 0px;">
<i>After:</i></div>
<div style="margin: 0px;">
<i><br /></i></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://dl.dropboxusercontent.com/u/14855532/pi-tvb/IMG_20131218_224822_743.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="https://dl.dropboxusercontent.com/u/14855532/pi-tvb/IMG_20131218_224822_743.jpg" width="320" /></a></div>
<div style="margin: 0px;">
<i><br /></i></div>
<div style="font-style: normal; margin: 0px;">
The original base size was 13 by 10 blocks. The new one is slightly smaller with a 13 by 9 blocks. Had I implemented an <a href="http://ddurdle.blogspot.com/2013/09/adding-power-switch-to-raspberry-pi.html">illuminated switch</a> instead of the <a href="http://ddurdle.blogspot.com/2013/12/remotepi-board-power-ir-switch-day-11.html">RemotePi</a> board, I would of had to increase the length from 13 to 14 as I had in <a href="http://ddurdle.blogspot.com/2013/09/my-revised-second-raspberry-pi-lego.html">previous cases</a>.</div>
<div style="font-style: normal; margin: 0px;">
<br /></div>
<div style="font-style: normal; margin: 0px;">
A push-button power switch is accessible from the top of the unit. Pressing down will either turn on the Raspberry Pi or safely shut it down (and power it off).</div>
<div style="font-style: normal; margin: 0px;">
<br /></div>
<div style="font-style: normal; margin: 0px;">
The GPIO access doors are gone. Since we are using the GPIO for <a href="http://ddurdle.blogspot.com/2013/12/remotepi-board-power-ir-switch-day-11.html">RemotePi</a> board, there is no need for them. If I ever receive my ordered Raspberry Pi camera, I may open up access to the camera port.</div>
</div>
Anonymoushttp://www.blogger.com/profile/16677545615031598278noreply@blogger.com0tag:blogger.com,1999:blog-4219190022818787033.post-56033528821342696052013-12-23T12:44:00.003-05:002013-12-27T21:40:34.880-05:00RemotePi Board power IR switch for Raspberry Pi [day 11 of 20-days-of-posts series]A power switch was omitted in the design of the Raspberry Pi to keep costs down. There was no easy interface provided to add one either, but there are many different options. I had previously tackled the <a href="http://ddurdle.blogspot.com/2013/09/adding-power-switch-to-raspberry-pi.html">original topic in a previous post</a>, comparing a few options, including building your circuit.<br />
<br />
I had <a href="http://ddurdle.blogspot.com/2013/09/adding-power-switch-to-raspberry-pi.html">previously reviewed several different Raspberry Pi switches</a>. A new one came to my attention that I placed an order for. It is the <a href="http://msl-digital-solutions.myshopify.com/products/remotepi-board">RemotePi Board</a> by <a href="http://msl-digital-solutions.myshopify.com/">MSL Digital Solutions</a>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://dl.dropboxusercontent.com/u/14855532/remotepi/RemotePiBoard1024x768_large.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="226" src="https://dl.dropboxusercontent.com/u/14855532/remotepi/RemotePiBoard1024x768_large.jpg" width="320" /></a></div>
<br />
<br />
At its core, it promises the same functionality has the <a href="http://ddurdle.blogspot.com/2013/09/adding-power-switch-to-raspberry-pi.html">other board solutions</a> that intercept the micro USB power connector on the Raspberry Pi, which is to control the power on/off state of the Pi through a switch and through software. But instead of intercepting the power flow through the micro USB power connector, it controls the power through the GPIO. Instead of connecting your power to the micro USB power connector on the Raspberry Pi, you connect it to this board. You then either toggle the power state by pressing the black button on the top, or better, you can use a IR remote to toggle the power.<br />
<br />
And there lies one of the key differentiators. For application use-cases such as a media player where you need an IR receiver, this board accomplishes that purpose as well. I discussed how you could <a href="http://ddurdle.blogspot.com/2013/12/adding-ir-to-your-pi-day-6-of-20-days.html">construct your own IR receiver setup on the GPIO in a previous post</a>, and also talked about HDMI CEC in the same post, but one of the issues that remains in either the case of adding an IR receiver or using your TV's built in HDMI CEC support (if it has it), is that you can't power on or off your Raspberry Pi using either your Pi or TV remote. Your solution options were either to always leave the Raspberry Pi on, have it automatically turn on when your TV is on (either by a power bar or plugged into the USB service port on your TV) or manually turn it on using a hardware switch or plug when you want to use your Pi.<br />
<br />
I don't always watch all my media content through the Raspberry Pi (such as when I play video games, watch TV channels etc), so I resorted to using the <a href="http://ddurdle.blogspot.com/2013/09/adding-power-switch-to-raspberry-pi.html">illuminated switch</a> bundled with my <a href="http://ddurdle.blogspot.com/2013/12/adding-ir-to-your-pi-day-6-of-20-days.html">IR receiver</a> that allowed me to keep my Raspberry Pi off, when not in use, and turn it on manually by pressing the switch when I wanted to watch some Pi content. There were a couple times I wanted to be able to use my <a href="http://www.logitech.com/en-ca/remotes%E2%80%8E">Logitech Harmony</a> remote to turn on the Pi. One of the benefits of this switch implementation is that it will use the IR remote's power button to toggle the power to the Pi. The IR receiver on the board will also work like any standard /dev/lirc device, meaning that it could replace the IR receiver I had setup on my Pi -- that it was completely compatible with XBMC.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://dl.dropboxusercontent.com/u/14855532/remotepi/RPiAndBoardFront1024x768_grande.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="270" src="https://dl.dropboxusercontent.com/u/14855532/remotepi/RPiAndBoardFront1024x768_grande.jpg" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://dl.dropboxusercontent.com/u/14855532/remotepi/RPiAndBoardFrontC1024x768_grande.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="154" src="https://dl.dropboxusercontent.com/u/14855532/remotepi/RPiAndBoardFrontC1024x768_grande.jpg" width="320" /></a></div>
<br />
<br />
The switch and IR receiver is contained on a single logic board. It has a connector port that plugs directly into the GPIO. This wasn't a concern for me, since on my XBMC Raspberry Pi units, I only use the GPIO for two purposes -- hooking up a power switch and hooking up a IR receiver. The direct connection to the GPIO eliminated some wiring that I needed to contend with with the IR receiver and previous power switch. The board also came with a screw with some watches and nuts so that it could be securely mounted directly onto the mount hole on the Raspberry Pi. The first releases of the Raspberry Pis (the model B 256MB "rev 1") don't have this mount point but the board is still usable without the mount..<br />
<br />
I decided to integrate the board with my <a href="http://ddurdle.blogspot.com/2013/09/my-first-raspberry-pi-lego-case-ver-2.html">model B bedroom TV Raspberry Pi case</a>. I had reviewed the lego case I had constructed for that project in a <a href="http://ddurdle.blogspot.com/2013/09/my-first-raspberry-pi-lego-case-ver-2.html">previous post</a>. I had still not integrated any power switch into this unit, so I was eager.<br />
<br />
To keep inline with the pros and cons list I provided for the other switch mechanisms, here are the lists:<br />
<br />
<i>Pros</i>:<br />
<ul>
<li>very small</li>
<li>may need some modification to your raspberry pi case, but otherwise fits within the existing case (doesn't extend out from the board's footprint)</li>
<li>addresses the CLEAN SHUTDOWN and POWER OFF requirements fully</li>
<li>no issues with provided switch script (for other switches, I had problems and <a href="http://ddurdle.blogspot.com/2013/12/modified-switchsh-for-raspberry-pi.html">I had to make customizations to the scripts</a> provided by other offerings)</li>
<li>fully integrated IR receiver that can be used to allow your IR remote to control XBMC</li>
<li>everything fully assembled</li>
</ul>
<br />
<i>Cons</i>:<br />
<ul>
<li>expensive but it does save you cost from <a href="http://ddurdle.blogspot.com/2013/12/adding-ir-to-your-pi-day-6-of-20-days.html">building your own IR receiver setup</a> or USB IR receiver </li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://dl.dropboxusercontent.com/u/14855532/pi-tvb/Screenshot%20from%202013-12-23%2012:40:32.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="https://dl.dropboxusercontent.com/u/14855532/pi-tvb/Screenshot%20from%202013-12-23%2012:40:32.png" width="320" /></a></div>
<br />
<br />
I took apart my case's right wall to accommodate the new higher-oriented micro USB port. I would be revamping the case completely now that I no longer needed to snake my IR receiver around to an opening on the front of the unit, I could now also drop down the height of the case due to the same reason and I would need to accommodate the hardware button to accommodate the manual switch.<br />
<br />
The instructions provided were very simple. After I applied the screw and plugged in the board, I connected the micro USB power to the board's port. Immediately I saw the built in power LED flash green and red momentarily to indicate the unit had power. I then press and held the power switch button down for 15 seconds, at which time the LED blinked between red and green continuously, indicating that it was ready to read the IR remote command for the power button. I used the <a href="http://www.logitech.com/en-ca/remotes%E2%80%8E">Logitech Harmony</a> power button that had been setup for the WD TV remote profile that I had setup previously on the unit's previous IR receiver. It really doesn't even have to be a power button -- it can be any unused button. The blinking stopped and I could then press that button to turn on the unit.<br />
<br />
When the IR power-assigned-button is pressed, the board's onboard LED starts blinking green, while the Raspberry Pi turns on. Everything booted up as it would regularly. I didn't have to make any changes to my <a href="http://ddurdle.blogspot.com/2013/12/customizing-your-raspberry-pi-remote.html">lircd.conf</a> profile. I started using the unit as I normally would.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.youtube.com/embed/CyBQfWhLNwM?feature=player_embedded' frameborder='0'></iframe></div>
<br />
<br />
The blinking -- which is more of a "pulsing" -- for up-to-one minute on startup and shutdown give an indication that the command was received and also indicates that the unit won't respond to subsequent power on/off requests from IR during that period. This prevents accidentally sending a second power on/off command to the unit while it works on the initial request. It also prevents "repeating" if the IR remote sends the same commands multiple times. .<br />
<br />
If you are implementing this as a new IR implementation (not replacing an existing setup), you'd need to setup a remote and <a href="http://ddurdle.blogspot.com/2013/12/customizing-your-raspberry-pi-remote.html">lircd.conf</a>. I discussed how to do this in a <a href="http://ddurdle.blogspot.com/2013/12/customizing-your-raspberry-pi-remote.html">previous post</a>.<br />
<br />
I had no problem using the onboard IR receiver with all my Harmony remote commands or with the WD TV remote that I keep around as a backup to control the unit when my Harmony remote is lost in the room-somewhere or is charging.<br />
<br />
To power off, I pressed the power button again. The board passes on all the IR signals received to the Raspberry Pi, including the one assigned to the power button, but it will start triggering a shutdown when the power-assigned button command is received. It does this by the irswitch.sh script that is installed as part of the setup. It closely resembles the <a href="http://ddurdle.blogspot.com/2013/12/modified-switchsh-for-raspberry-pi.html">safe shutdown script (switch.sh) that I discussed using with the other power switches</a>. The board's LED flashes red while the board shuts down the Pi. It continues to monitor the Raspberry Pi's shutdown for up to a minute. When the Pi is safely complete it's shutdown, the power is cut off (so the Pi becomes powered off), and the onboard LED turns off. You can then use either the manual power button on the board or again the IR remote's power-assigned button to turn the Raspberry Pi back on.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.youtube.com/embed/E7EUUTrcoaQ?feature=player_embedded' frameborder='0'></iframe></div>
<br />
<br />
The onboard LED proved to be a great asset to this power switch. I no longer had to position the front-face position in my original lego case:<br />
<br />
<a href="https://dl.dropboxusercontent.com/u/14855532/pi-v2r1/pi-v2r1-front.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em; text-align: center;"><img border="0" height="240" src="https://dl.dropboxusercontent.com/u/14855532/pi-v2r1/pi-v2r1-front.jpg" width="320" /></a><br />
<br />
I retweaked the right-side of the case to become the new front-end of the unit.<br />
<br />
The before:<br />
<br />
<a href="https://dl.dropboxusercontent.com/u/14855532/pi-v2r1/pi-v2r1-rside.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em; text-align: center;"><img border="0" height="240" src="https://dl.dropboxusercontent.com/u/14855532/pi-v2r1/pi-v2r1-rside.jpg" width="320" /></a><br />
<br />
The after:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://dl.dropboxusercontent.com/u/14855532/pi-tvb/IMG_20131218_224504_368.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="https://dl.dropboxusercontent.com/u/14855532/pi-tvb/IMG_20131218_224504_368.jpg" width="320" /></a></div>
<br />
<br />
I placed a white window block where the onboard LED is positioned, that gives the unit a nice glow when lit. I placed an inset blue window piece for IR window. The IR range provided by the window is adequate enough to get at least a 45 degree angle using the remote. I moved up the blocks for the micro USB power port to line up with the new port. I also added some support around the SD card as it was previously hanging out of the system. It is now protected from being hit (and damaging the SD card port).<br />
<br />
A closer view:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://dl.dropboxusercontent.com/u/14855532/pi-tvb/IMG_20131218_224536_638.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="https://dl.dropboxusercontent.com/u/14855532/pi-tvb/IMG_20131218_224536_638.jpg" width="320" /></a></div>
<br />
<br />
I revamped the top of the case to integrate the power button as well:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://dl.dropboxusercontent.com/u/14855532/pi-tvb/IMG_20131218_224822_743.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="https://dl.dropboxusercontent.com/u/14855532/pi-tvb/IMG_20131218_224822_743.jpg" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<br />
<br />
I review all the changes I made to my Raspberry Pi lego case for this board <a href="http://ddurdle.blogspot.com/2013/12/my-original-first-raspberry-pi-model-b.html">in this follow-on post</a>. In general, it is very easy to integrate the board into most cases as it doesn't change the footprint size of the Raspberry Pi. The only customizations that are needed are:<br />
<br />
<ol>
<li>hole on the top for the manual power switch,</li>
<li>relocation of micro USB power source in a higher position and</li>
<li>uncovering for IR and LED visibility.</li>
</ol>
<br />
<br />
<br />Anonymoushttp://www.blogger.com/profile/16677545615031598278noreply@blogger.com1tag:blogger.com,1999:blog-4219190022818787033.post-61535470958379810142013-12-23T10:44:00.002-05:002013-12-23T18:52:50.363-05:00Belkin WeMo Switch as a Raspberry Pi Power Switch [day 9 of 20-days-of-posts series]<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://dl.dropboxusercontent.com/u/14855532/wemo/372.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://dl.dropboxusercontent.com/u/14855532/wemo/372.jpg" width="320" /></a></div>
<br />
Recently I purchased a <a href="http://www.belkin.com/us/p/P-F7C027/">Belkin WeMo Switch</a>. The switch makes a single electrical outlet become online by putting it on Wifi. You can then use an iOS 6+ or Android 4+ app to toggle on/off the switch. I didn't really see to much benefit of the app, as I already use <a href="http://www.tcpi.com/connected-by-tcp%E2%80%8E">Connected by TCP</a> to control lighting around the home, providing me the ability to dim lights as well.<br />
<br />
Of bigger importance to me was the <a href="http://ifttt.com/">IFTTT</a> capability of the switch. <a href="http://ifttt.com/">IFTTT</a>, which stands for If This Then That, is an online service that lets you create recipes that can toggle the WeMo. Because <a href="http://ifttt.com/">IFTTT</a> is enabled for many other online services, you can tie the toggle on/off of the WeMo to other events, such as a gtalk or email message. You could toggle the WeMo by the sending of a message to a <a href="http://ifttt.com/">IFTTT</a> bot that contains a hash-tag that you assign to toggle your WeMo. This makes it really easy to control a switch in your home from any device, not just your phone. Likewise, <a href="http://ifttt.com/">IFTTT</a> also has scheduled events as an ingredient, so you could use it to control what times your WeMo is on and off for.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://dl.dropboxusercontent.com/u/14855532/wemo/IMG_20131218_225107_072.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://dl.dropboxusercontent.com/u/14855532/wemo/IMG_20131218_225107_072.jpg" width="180" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://dl.dropboxusercontent.com/u/14855532/wemo/IMG_20131218_225116_181.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://dl.dropboxusercontent.com/u/14855532/wemo/IMG_20131218_225116_181.jpg" width="180" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<br />
There is a newer version, called Belkin WeMo Insight switch that has a much smaller footprint and also monitors and reports the power consumption of the device plugged in. The Insight switch is about $10 more expensive. It wasn't carried in any stores in Canada at the time of purchase (Home Depot, Canadian Tire, Future Shop / Best Buy, Amazon)<br />
<br />
My particular interest in the Belkin WeMo Switch was as a Raspberry Pi power switch. It makes a powerful switch for the following purposes:<br />
<br />
<ol>
<li><b>Serves purposes where something similar to as WOL (<a href="http://en.wikipedia.org/wiki/Wake-on-LAN%E2%80%8E">Wake on LAN</a>) is needed</b>. I often use WOL on my systems, so remotely, I can connect to my home network and turn on computers as I need them, but issuing a WOL packet from the router to the PC. For the Raspberry Pi, the Pi is always on as long as it has power supplied to it, therefore the USB-based ethernet switch doesn't feature the ability to turn the system on by WOL. To do so, you would need to design and build your own power switch that could intercept the micro USB powered source and also reimplement the ethernet port by intercepting ethernet traffic capturing WOL packets and then controlling the power based on that. There exists no ready-made logic board, so creating and implementing one would be impractical (and expensive). With the WeMo, you can the toggle on power command straight to the switch, and anything connected to it will turn on.</li>
<li><b>Scheduled on/off time</b>. If you need the system to be powered on during a certain time of the day (scheduled crontab job), you can schedule the toggle on of the WeMo by a scheduler on <a href="http://ifttt.com/">IFTTT</a>. Likewise, you can toggle it off at a different time. Therefore, a scheduled crontab entry, I schedule my WeMo to be triggered on 5 minutes before the crontab entry is to run, and likewise, I schedule the WeMo to be triggered off 5 minutes after a matching crontab entry on the Raspberry Pi is scheduled to shutdown the system. Further, because there are three kinds of states you can use (toggle on, toggle off, toggle power state), if you toggle on the WeMo at a scheduled time, if it is already on, it won't be affected (as in, it won't be turned off by accident, unless you use the toggle power state as opposed to toggle on).</li>
<li><b>Control your USB powered hub</b>. In my particular application, I'm powering the Pi using a power switch, which is plugged into a hub, where my USB devices are also plugged in (such as hard drive). So, although I can schedule a shutdown on crontab which actually powers off the Pi with the addon power switch, the USB devices such as hard drive, remain powered on. With the WeMo, I'm actually powering on/off the USB hub, so it would include automatically powering on/off the Pi itself.</li>
<li><b>Remote hard-reset</b>. If (really more of a case of when) the Raspberry Pi becomes frozen or unresponsive where I'm not able to connect to it remotely to perform a reboot command, The WeMo allows me to either use my phone or <a href="http://ifttt.com/">IFTTT</a> to toggle the power off/on.</li>
</ol>
<div>
Some conditions or other notes:</div>
<div>
<ul>
<li>If you are strictly power off using the WeMo, you could corrupt the SD card or USB-based hard drive filesystem if you practice the habit of poweroff by cutting the power as opposed to safely shutting down prior with either a <span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">poweroff</span> or <span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">shutdown now -h</span> command. In actuality, you could use a third party, such as Linux-capable router (which is my case), where if I need to perform a safe power down, I have the router issue a <span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;">shutdown now -h </span>over ssh to the Raspberry Pi, and then issue a #pi-off over email to <a href="http://ifttt.com/">IFTTT</a> a minute later to actually power off the device.</li>
<li>If your Raspberry Pi starts up requiring root login to correct a disk issue, then you have no way around the issue other than to interact with the Raspberry Pi locally. There is probably some way around this, some setting that lets you disable disk checks on startup, thus avoiding the prompt at startup for a root admin to log on to perform maintenance or CTRL-D to continue. These prompts are not just tied to real disk corruption. If I take my USB hard drive offline to sync it with another hard drive using another PC, if I write changes to it's supernode in the process, the next time I boot up on the Rasbperry Pi, it'll see the supernode has a timestamp newer than the system clock and thus refused to boot until a root user takes a course of action. This nuance is for the fact the Raspberry Pi lacks a realtime clock, so on bootup, the present time will be the time at which the system was last on (stored to the SD card), so the fact the hard disk was updated or had changes to it with timestamps that are newer, it detects this as possible corruption-based issue. Only after the system is booted up and on the network will the NTP set the time on the Pi to the current one.</li>
<li>You need an iOS 6+ or Android 4+ device even if you intend to only control the WeMo via <a href="http://ifttt.com/">IFTTT</a>. The WeMO needs to be setup via the phone app.</li>
</ul>
<div>
The initial setup of the WeMo was fairly simple. From what I read, the Android version of the app was created more recently and just came out of beta, and tends to have more bugs in it then the iOS version. Therefore, I decided to dig my iPhone 3GS out of retirement for setting up this device, over the Android. I plugged it in, then on my iPhone 3GS, I downloaded the WeMo app from the appstore. As instructed by the app, you then need to change your Wifi access point on the phone to the one broadcasting from the WeMo. Then at this point, the app will ask about the network setup of the WeMo, for which you provide the network key. This was fairly simple. But I did read online that a lot of users had problems at this point as their WeMo didn't accept network passwords with special characters (non-alphanumeric) such as spaces. I'm not sure if this is resolved with a newer firmware, but if you have a network that uses one, you're out of luck with a out-of-box device until you get it onto a network it will accept.</div>
</div>
<div>
<br /></div>
<div>
As part of the setup, you provide it a name for the switch (assuming you may one day have multiples). In my case, I just called it Raspberry Pi Server. You can also assign it a user-created PNG graphic to depict the device image in the app.</div>
<div>
<br /></div>
<div>
After I got the device setup, I was prompted by the app to update the firmware on the WeMo as there was a newer one available. This is where I began to quickly learn how buggy the firmware and app are. I accepted the app to let the WeMo download the firmware. At this point it instructs you that you can close the app, that the WeMo is downloading the firmware direct (indicated by flashing blue light) and will take about 10 mins to complete, at which time the WeMo will reboot and be ready for use. I left the app open just the same, and went off to get a coffee. When I got back I saw the WeMo was done the firmware upgrade, but instead of a steady blue light (indicating on) or no light at all (indicating off), I was presented with a blinking amber light. It would seem this may have multiple meanings, but the initial one I found was that the device was not able to conenct to wifi or is still trying. Checked the router and it confirmed the WeMo was not connected, having been connected and assigned an IP prior (since it had finished setup and had downloaded the new firmware). I checked the phone app and it indicated the device was "firmware upgrading". Unplugging it and plugging it back in proved futile. I quickly learned of the restore procedure to try to trigger the device to restore to factory state. So, went through the initial setup again, assigning the device a new name, giving it the network password etc. This time at the completion of the setup, instead of letting me see the state of the switch in the app, it said the device was "firmware upgrading". I had used a different name the second time, and it was the second named switch that it was in belief was firmware upgrading, whereas looking at the device, no said activity was underway. Closed the app and started it again, and it was able to see the on/off state of the app correctly.</div>
<div>
<br /></div>
<div>
So, as you can see, both the app and the WeMo firmware are buggy, and I'll be more apprehensive on updating the firmware in the future. Because it was freshly out of the box, I tend to take on more risky behaviour such as updating firmwares since I can just turn around and head back to the store to return the bricked device. Had I updated in weeks or months following, I'd be at the mercy of the manufacturer RMA procedure. </div>
<div>
<br /></div>
<div>
Setup was easier for <a href="http://ifttt.com/">IFTTT</a>. Activating the WeMo channel in <a href="http://ifttt.com/">IFTTT</a> just involved providing it the unique identifier number that the phone app provided so <a href="http://ifttt.com/">IFTTT</a> could locate and use the WeMo. I didn't have to open any firewall ports, etc. Either the WeMo is pulling the requests or it is opening a port on the firewall itself. I'll look into the details someday. I'm interested in seeing what the packets look like going between <a href="http://ifttt.com/">IFTTT</a> and the WeMo.</div>
<div>
<br /></div>
<div>
<b>Pros:</b></div>
<div>
<ul>
<li><a href="http://ifttt.com/">IFTTT</a> support</li>
<li>the latency is minimal; within 1-2 seconds of triggering a power toggle on the app or in IFTTT, the WeMo is toggled</li>
<li>this speaks more to <a href="http://ifttt.com/">IFTTT</a> itself, but the time between emailed hash-tag emails to invoke the WeMo are processed usually around 5 seconds after the email request departs</li>
<li>survives power failures with settings preserved</li>
</ul>
</div>
<div>
<b>Cons:</b></div>
<div>
<ul>
<li>pricey (around $40 - $50)</li>
<li>firmware update process is buggy</li>
<li>requires the phone app for at least the initial setup</li>
<li>users report problems with network passwords with non alphanumeric characters</li>
<li>almost guaranteed to have problems with enterprise networks (such as ones that requires LEAP etc)</li>
<li>no surge protection; designed to fit outlets, not power-bar friendly, but it contains no surge protection and the huge footprint of the device causes hindrance plugging it into outlet surge protectors</li>
<li>unless your outlet plug sits flush with the surrounding wall, or extends out a bit, the overhanging of the switch will cause problems</li>
<li>causes havoc with powerbars; the footing is larger than power bricks, so even when a powerbar (or in my case APC UPS) has a "power brick outlet" to eliminate impact of a power brick on adjacent outlets, the footing still causes problems, barely allowing a two prong cable to clear (see picture of my setup)</li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://dl.dropboxusercontent.com/u/14855532/wemo/IMG_20131223_095446_691.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="https://dl.dropboxusercontent.com/u/14855532/wemo/IMG_20131223_095446_691.jpg" width="320" /></a></div>
<div>
<br /></div>
<blockquote class="tr_bq">
[There is a newer version, called <a href="http://www.belkin.com/us/F7C029-Belkin/p/P-F7C029;jsessionid=7F52F280F03FB65183AF0A2F05286C70">Belkin WeMo Insight switch</a> that has a much smaller footprint and also monitors and reports the power consumption of the device plugged in. The <a href="http://www.belkin.com/us/F7C029-Belkin/p/P-F7C029;jsessionid=7F52F280F03FB65183AF0A2F05286C70">Insight switch</a> is about $10 more expensive.]</blockquote>
<ul>
<li>network security issue; network details of the device are not transparent which is probably intentional to obscure security vulnerabilities </li>
<li>it is essentially an embedded computer, so when you first plug it in (or turn a power bar on) it takes about 30-45 seconds for it to boot up (indicated by blue blinking LED) and another 30 seconds for the device to find and connect to the network (indicated by amber blinking LED)</li>
<li><span style="color: red;">consumes power (using a <a href="http://www.p3international.com/products/p4400.html">kill-a-watt</a> reader, the device registers at 2 watts when idle and around 2.5 watts at bootup) -- the Raspberry Pi model B rev2 consumes about 2.5 watts, and the Raspberry Pi model A consumes about a constant 1.5 watts, so the WeMo consumes the same or more power than the Raspberry Pi.</span></li>
</ul>
<div>
<b>Pros as a Raspberry Pi switch</b>:</div>
</div>
<div>
<ul>
<li>control the power switch remotely</li>
<li>lets you perform hard reboots remotely</li>
<li>control the power to the USB hub and all your Pi devices with a single switch</li>
<li>control the power to your Raspberry Pi using <a href="http://ifttt.com/">IFTTT</a>, including implementing scheduled activities, activities based on other events</li>
<li>home automation necessity -- use in conjunction with <a href="http://www.belkin.com/us/F7C028-APL-Belkin/p/P-F7C028-APL;jsessionid=7F52F280F03FB65183AF0A2F05286C70">motion sensors</a> tied with <a href="http://ifttt.com/">IFTTT</a> to aid in setting up home automation; the WeMo switch is only one product available in the <a href="http://www.belkin.com/us/Products/home-automation/c/wemo-home-automation/">WeMo Home Automation category</a>.</li>
</ul>
<div>
<div>
<b>Cons as a Raspberry Pi switch</b>:</div>
<div>
<ul>
<li>no software shutdown support (need to software shutdown prior to avoid corruption of filesystem)</li>
<li>expensive</li>
</ul>
</div>
</div>
</div>
Anonymoushttp://www.blogger.com/profile/16677545615031598278noreply@blogger.com0tag:blogger.com,1999:blog-4219190022818787033.post-79854209501327205812013-12-21T10:01:00.002-05:002013-12-27T21:44:14.009-05:00Using the USB Big Red Button / Panic Button on the Raspberry Pi [day 10 of 20-days-of-posts series]As I had allured to in a <a href="http://ddurdle.blogspot.com/2013/09/adding-power-switch-to-raspberry-pi.html">previous post</a>, I had purchased a Panic/ Stress relief USB button from a <a href="http://www.thesource.ca/estore/product.aspx?product=8003038&language=en-CA">local store</a>. Full specifications available at their <a href="http://www.dreamcheeky.com/big-red-button">manufacturer website</a>. I believe its available on the DX website as well, or at least a clone of it.<br />
<br />
<a href="http://images.thesource.ca/images/Online/80/8003038l.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em; text-align: center;"><img border="0" src="http://images.thesource.ca/images/Online/80/8003038l.jpg" /></a><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://dl.dropboxusercontent.com/u/14855532/panic/IMG_20131218_223852_430.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="https://dl.dropboxusercontent.com/u/14855532/panic/IMG_20131218_223852_430.jpg" width="320" /></a></div>
<br />
It features essentially a USB interface to 2 i/o streams that would be either high or low. It has two input states -- one for the case cover being lifted and another for the button being pressed.<br />
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://dl.dropboxusercontent.com/u/14855532/panic/IMG_20131217_120741_190.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="https://dl.dropboxusercontent.com/u/14855532/panic/IMG_20131217_120741_190.jpg" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://dl.dropboxusercontent.com/u/14855532/panic/IMG_20131217_120748_762.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="https://dl.dropboxusercontent.com/u/14855532/panic/IMG_20131217_120748_762.jpg" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://dl.dropboxusercontent.com/u/14855532/panic/IMG_20131217_120812_235.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="https://dl.dropboxusercontent.com/u/14855532/panic/IMG_20131217_120812_235.jpg" width="320" /></a></div>
<br />
Taking apart the unit is fairly easy. There are only 4 Philips screws.<br />
<br />
As expected, inside we can see the button presses down on a standard button attached to a logic board.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://dl.dropboxusercontent.com/u/14855532/panic/IMG_20131218_223946_674.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="https://dl.dropboxusercontent.com/u/14855532/panic/IMG_20131218_223946_674.jpg" width="320" /></a></div>
<br />
The yellow cable leads to a set of electrical contacts that almost resemble tweezers. This tells the logic board whether the case lid is open.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://dl.dropboxusercontent.com/u/14855532/panic/IMG_20131218_223912_429.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="https://dl.dropboxusercontent.com/u/14855532/panic/IMG_20131218_223912_429.jpg" width="320" /></a></div>
<br />
It's hard to see on a photo, but on the case, there is a leverage switch that pops out when the lid is open, which releases the "tweezers" contacts, breaking the current, which generates a 0 on the input.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://dl.dropboxusercontent.com/u/14855532/panic/IMG_20131218_224057_820.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="https://dl.dropboxusercontent.com/u/14855532/panic/IMG_20131218_224057_820.jpg" width="320" /></a></div>
<br />
<br />
That's all there is to the internals. The components can be removed and setup in your own case. If you use lego, it would be possible to create a button to press down on the switch, and some blocks to press or depress the electrical contacts for the lid switch.<br />
<br />
My goal originally was to <a href="http://ddurdle.blogspot.com/2013/09/adding-power-switch-to-raspberry-pi.html">create a switch that could be used to shutdown the Raspberry Pi</a>. In actuality, it can be used for a multitude of purposes.<br />
<br />
<i>Pros</i>:<br />
<ul>
<li>cheap and resourceful</li>
<li>kind of geeky (re-pursing a device)</li>
<li>the casing can be taken apart and just the logical board with usb cable can be deployed</li>
</ul>
<br />
<i>Cons</i>:<br />
<ul>
<li>a USB device that occupies a USB port</li>
</ul>
<br />
<br />
For the logic part, there are a few options I've found. There is an open-source ruby gems implementation worth playing around with for fun:<br />
<blockquote class="tr_bq">
<a href="https://github.com/derrick/dream_cheeky">https://github.com/derrick/dream_cheeky</a></blockquote>
<br />
I've ended up using a device driver written in C. Malcolm Sparks provided a great device driver for this device on his blog:<br />
<br />
<blockquote class="tr_bq">
<a href="http://blog.opensensors.io/blog/2013/11/25/the-big-red-button/">http://blog.opensensors.io/blog/2013/11/25/the-big-red-button/</a></blockquote>
<br />
Malcolm goes into detail of pertaining to Arch Linux which didn't work as smooth for Debian. I'll simply the procedure to follow below for the Raspberry Pi.<br />
<br />
Three easy steps to follow.<br />
<br />
<u><b>First</b></u>, test the device. Plug in the device on the USB port. Run <span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">dmesg</span> to get the device information.<br />
<br />
I saw something like this in <span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">dmesg</span> output:<br />
<br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"><br /></span>
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">hid-generic 0003:1D34:000D.0004: hiddev0,hidraw0: USB HID v1.10 Device [Dream Link DL100B Dream Cheeky Generic Controller] on usb-0000:00:1d.0-1/input0</span><br />
<div>
<br /></div>
<div>
The device name is in that output. In this case it is <span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;">hiddev0. </span>Check /dev for the existence of <span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">/dev/hidraw0</span>. You will need to change the permissions of <span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;">/dev/hidraw0</span> if you won't be using the root user to run your script to interact with the buttons. You can change the permissions by running <span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">sudo chmod 666 /dev/hidra</span><span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;">w0.</span> If the script runs under root, this is not necessary. But it is necessary if you want to test out the switch with a non-root user.</div>
<div>
<br /></div>
<div>
<u><b>Second</b></u>, build the device driver.</div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"><br /></span></div>
<div>
Slightly modified version of <a href="http://blog.opensensors.io/blog/2013/11/25/the-big-red-button/">Malcolm Sparks script</a>, for the Raspberry Pi -- <b>note the changes in BOLD, including changing the /dev/big-red-button to the actual device location (such as /dev/hidraw0)</b>.</div>
<div>
(download <a href="https://dl.dropboxusercontent.com/u/14855532/big-red-button.c">big-red-button.c</a>)</div>
<div>
<br /></div>
<div>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">/*</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">,* Copyright © 2013, Malcolm Sparks <malcolm@congreve.com>. All Rights Reserved.</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">,*</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">,* A program to convert USB firing events from the Dream Cheeky 'Big Red Button' to MQTT events.</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">,*/</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"><br /></span>
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">#include <fcntl.h></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">#include <stdio.h></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">#include <string.h></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">#include <stdlib.h></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"><br /></span>
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">#define LID_CLOSED 21</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">#define BUTTON_PRESSED 22</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">#define LID_OPEN 23</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"><br /></span>
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">int main(int argc, char **argv)</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">{</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> int fd;</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> int i, res, desc_size = 0;</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> char buf[256];</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"><br /></span>
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> /* Use a udev rule to make this device */</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> fd = open("<b>/dev/hidraw0</b>", O_RDWR|O_NONBLOCK);</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"><br /></span>
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> if (fd < 0) {</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> perror("Unable to open device");</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> return 1;</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> }</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"><br /></span>
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> int prior = LID_CLOSED;</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"><br /></span>
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> while (1) {</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> memset(buf, 0x0, sizeof(buf));</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> buf[0] = 0x08;</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> buf[7] = 0x02;</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"><br /></span>
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> res = write(fd, buf, 8);</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> if (res < 0) {</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> perror("write");</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> exit(1);</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> }</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"><br /></span>
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> memset(buf, 0x0, sizeof(buf));</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> res = read(fd, buf, 8);</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"><br /></span>
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> if (res >= 0) {</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> if (prior == LID_CLOSED && buf[0] == LID_OPEN) {</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> printf("Ready to fire!\n");</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"><b> system("sudo initctl stop xbmc");</b></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> fflush(stdout);</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> } else if (prior != BUTTON_PRESSED && buf[0] == BUTTON_PRESSED) {</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> printf("Fire!\n");</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"><b> system("shutdown now -h");</b></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> fflush(stdout);</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> } else if (prior != LID_CLOSED && buf[0] == LID_CLOSED) {</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> printf("Stand down!\n");</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> fflush(stdout);</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> }</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> prior = buf[0];</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> }</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> usleep(20000); /* Sleep for 20ms*/</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> }</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">}</span></blockquote>
</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
You can modify the device driver to suit your needs. There are really three states that can get triggered and be associated with tasks or activities:<br />
<br />
<ol>
<li>lid is raised</li>
<li>lid is closed</li>
<li>button is pressed</li>
</ol>
<br />
In the closed-form of the button, condition 3 can only happen when condition 1 is raised and is not possible when condition 2 is raised. In a disassembled switch, you could repurpose condition 3 to behave differently based on whether it is condition 1 or 2 that is active (thus, you could add a 4th state in the device driver for <span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;">buf[0] == LID_OPEN && </span><span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;">buf[0] == BUTTON_PRESSED</span>) since the two states can be independent based on your implementation of the physical button and contacts.<br />
<br />
We'll use only states 1-3, assuming 3 can only occur when 1 is active. Edit the behaviour of the device driver, where appropriate:</div>
<div>
<ul>
<li>for when the lid is opened... [example showing stop XBMC]</li>
</ul>
</div>
<div>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> if (prior == LID_CLOSED && buf[0] == LID_OPEN) {<br /> printf("Ready to fire!\n");<br /> system("initctl stop xbmc");<br /> fflush(stdout);</span></blockquote>
<div>
<ul>
<li>for when the button is pressed...<span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"> <span style="font-family: 'Times New Roman'; font-size: small;"> [example showing shutdown system]</span> </span></li>
</ul>
</div>
<div>
<div>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> } else if (prior != BUTTON_PRESSED && buf[0] == BUTTON_PRESSED) {</span><br />
<blockquote>
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> printf("Fire!\n");<br /> system("shutdown now -h");<br /> fflush(stdout);</span></blockquote>
</blockquote>
</div>
<br />
<ul>
<li> for when the lid is closed (depending it having been opened)...<span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"> </span></li>
</ul>
<br />
<div>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> } else if (prior != LID_CLOSED && buf[0] == LID_CLOSED) {</span></blockquote>
</div>
</div>
<div>
<blockquote>
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> printf("Stand down!\n");<br /> fflush(stdout);</span></blockquote>
</div>
<div>
<br /></div>
</div>
<div>
Compile the device driver.</div>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">cc big-red-button.c -o big-red-button</span></blockquote>
<div>
<u><b><br /></b></u></div>
<div>
<u><b>Third, </b></u> install the device driver.</div>
<div>
<br /></div>
<div>
Install the executable by placing it in <span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">/etc/big-red-button</span>. Make sure the +x permission (i.e. <span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">sudo chmod 755 /etc/big-red-button</span>) is set. Add<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> /etc/big-red-button &</span> to the bottom of<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> /etc/rc.local </span>but before the <span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">exit</span>.</div>
<div>
<br /></div>
<div>
Now when the Raspberry Pi boots up, if the USB Big Red Button is attached, it should load the device driver created above automatically, awaiting the change in state for the lid and button, taking appropriate action when activated.<br />
<br />
<br /></div>
Anonymoushttp://www.blogger.com/profile/16677545615031598278noreply@blogger.com3tag:blogger.com,1999:blog-4219190022818787033.post-80534957709913946532013-12-21T09:30:00.002-05:002013-12-21T09:31:07.989-05:00Simplistic slim Raspberry Pi model A red lego case [day 8 of 20-days-of-posts series]<b>Intention</b>: To be used as a small travel Raspberry pi that can be used with displays on-the-go (such as lapdocks)<br />
<br />
<br />
<b>Equipment</b>:<br />
<ul>
<li>Raspberry Pi (model A -- memory: 256MB, 1 USB port, no ethernet)</li>
<li>class 10 SD card (32GB)</li>
</ul>
<b><b>Assumptions</b>:</b><br /><ul>
</ul>
<div>
<ul>
<li>No need for the VIDEO port (going to use HDMI)</li>
<li>No need for AUDIO jack (going to use HDMI)</li>
<li>No need to access camera port, GPIO pins, etc</li>
</ul>
</div>
<div>
<br />
<br />
<i style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;">Like with most of my lego projects, I don't provide full schematics and block lists. My opinion is that if you have unused lego that you can use for a project like this, you make use of what you have, improvising as you go.</i><br />
<br />
This is the smallest Pi case that I could make, ideal for travelling.<br />
<br /></div>
<div>
<br /></div>
<u>Left-side view</u>:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://dl.dropboxusercontent.com/u/14855532/pi-small/IMG_20131206_212618_388.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="https://dl.dropboxusercontent.com/u/14855532/pi-small/IMG_20131206_212618_388.jpg" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<br class="Apple-interchange-newline" />
We have access to the USB port. The Raspberry Pi LEDs are viewable through a window.<br />
<br />
We can see the height of the case is exactly 2 + 1/3rd lego bricks high. The width is 10 lego bricks.<br />
<div>
<br /></div>
<div>
<u>Right-side view</u>:</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://dl.dropboxusercontent.com/u/14855532/pi-small/IMG_20131206_212605_308.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="https://dl.dropboxusercontent.com/u/14855532/pi-small/IMG_20131206_212605_308.jpg" width="320" /></a></div>
<br />
<br />
The SD card slot is accessible and the SD card sits flush to the case. The micro USB power port is exposed for easy access.<br />
<br />
<br />
<u>Back-side view</u>:<br />
<div>
<br /></div>
<div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://dl.dropboxusercontent.com/u/14855532/pi-small/IMG_20131206_212611_777.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="https://dl.dropboxusercontent.com/u/14855532/pi-small/IMG_20131206_212611_777.jpg" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
An opening is provided for eacy access to the HDMI port.<br />
<br />
We can see the length of the case is 14 lego bricks in size.</div>
<div>
<br />
<br /></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<br />Anonymoushttp://www.blogger.com/profile/16677545615031598278noreply@blogger.com0tag:blogger.com,1999:blog-4219190022818787033.post-49064757386614201302013-12-18T22:31:00.002-05:002013-12-18T23:03:54.276-05:00Customizing your Raspberry Pi remote [day 7 of 20-days-of-posts series]<a href="http://ddurdle.blogspot.com/2013/12/adding-ir-to-your-pi-day-6-of-20-days.html">Yesterday</a> I discussed how you could install an IR receiver on the Raspberry Pi so that you could use an IR remote to navigate XBMC.<br />
<br />
Today I dig a little deeper into the configuration, settings and customization.<br />
<br />
I assume your IR receiver is working (as described in the previous post). We continue where we left off...<br />
<br />
<div>
<br class="Apple-interchange-newline" />
To create a configuration for a given remote, run the following:</div>
<div>
</div>
<br />
<ol>
<li><span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">sudo /etc/init.d/lirc stop</span></li>
<li><span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">sudo irrecord -d /dev/lirc0 ~/lircd.conf</span></li>
</ol>
<div>
As part of generating lirc.conf, you'll be asked to enter a key name and then press that button on the remote so that it can read the IR signal and associate with that key.<br />
<br />
To see a list of keynames, run <span style="background-color: white; font-family: Verdana; font-size: 13px; white-space: pre-wrap;">irrecord --list-namespace</span> . Some very common ones are:<br />
<br />
<div dir="ltr" style="line-height: 1.35; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: white; color: black; font-family: Verdana; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> KEY_HOME </span></div>
<div dir="ltr" style="line-height: 1.35; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: white; color: black; font-family: Verdana; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> KEY_BACK </span></div>
<div dir="ltr" style="line-height: 1.35; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: white; color: black; font-family: Verdana; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> KEY_SELECT</span></div>
<div dir="ltr" style="line-height: 1.35; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: white; color: black; font-family: Verdana; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> KEY_LEFT</span></div>
<div dir="ltr" style="line-height: 1.35; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: white; color: black; font-family: Verdana; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> KEY_RIGHT </span></div>
<div dir="ltr" style="line-height: 1.35; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: white; color: black; font-family: Verdana; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> KEY_UP </span></div>
<div dir="ltr" style="line-height: 1.35; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: white; color: black; font-family: Verdana; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> KEY_DOWN </span></div>
<div dir="ltr" style="line-height: 1.35; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: white; color: black; font-family: Verdana; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> KEY_REFRESH </span></div>
<div dir="ltr" style="line-height: 1.35; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: white; color: black; font-family: Verdana; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> KEY_FASTFORWARD </span></div>
<div dir="ltr" style="line-height: 1.35; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: white; color: black; font-family: Verdana; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> KEY_REWIND </span></div>
<div dir="ltr" style="line-height: 1.35; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: white; color: black; font-family: Verdana; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> KEY_PLAYPAUSE </span></div>
<div dir="ltr" style="line-height: 1.35; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: white; font-family: Verdana; font-size: 13px; line-height: 1.35; white-space: pre-wrap;"> KEY_INFO </span></div>
<div dir="ltr" style="line-height: 1.35; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: white; font-family: Verdana; font-size: 13px; line-height: 1.35; white-space: pre-wrap;"><br /></span></div>
When prompted for a key name, you would enter something like <span style="background-color: white; font-family: Verdana; font-size: 13px; line-height: 17px; white-space: pre-wrap;">KEY_HOME</span> and then press the HOME key on the remote. This would capture that input and the IR code associated with the key. If you use an invalid key name or need to change it, you can do so by modifying the generated output (in this case, <span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"> </span><span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;">~/lirc.conf</span>).<br />
<br />
For a sample remote, I used a <a href="http://www.wdc.com/en/products/homeentertainment/mediaplayers/%E2%80%8E">Western Digital TV (WD TV) player</a> that I no longer use. and the generated output of that remote is as follows:<br />
(download <a href="https://dl.dropboxusercontent.com/u/14855532/lircd.conf">lircd.conf</a>)<br />
<blockquote>
<span style="background-color: #eeeeee; font-family: Courier New, Courier, monospace; font-size: xx-small;"># Please make this file available to others<br /># by sending it to <lirc@bartelmus.de><br />#<br /># this config file was automatically generated<br /># using lirc-0.9.0-pre1(default) on Sat Apr 13 23:25:54 2013<br />#<br /># contributed by<br />#<br /># brand: /home/pi/lircd.conf<br /># model no. of remote control:<br /># devices being controlled by this remote:<br />#<br />begin remote<br /> name /home/pi/lircd.conf<br /> bits 16<br /> flags SPACE_ENC|CONST_LENGTH<br /> eps 30<br /> aeps 100<br /> header 8935 4503<br /> one 520 1709<br /> zero 520 606<br /> ptrail 524<br /> repeat 8935 2275<br /> pre_data_bits 16<br /> pre_data 0x219E<br /> gap 108035<br /> toggle_bit_mask 0x0<br /> begin codes<br /> KEY_BACK 0xD827<br /> KEY_BOOKMARKS 0xF00F<br /> KEY_DOWN 0x00FF<br /> KEY_ENTER 0x10EF<br /> KEY_FASTFORWARD 0x7887<br /> KEY_FAVORITES 0x08F7<br /># KEY_FORWARD 0x7887<br /> KEY_HOME 0x609F<br /> KEY_INFO 0x58A7<br /> KEY_MENU 0x58A7<br /> KEY_LEFT 0xE01F<br /> KEY_NEXT 0x807F<br /> KEY_PLAYPAUSE 0x50AF<br /> KEY_POWER 0x48B7<br /> KEY_PREVIOUS 0x40BF<br /> KEY_REWIND 0xF807<br /> KEY_RIGHT 0x906F<br /> KEY_STOP 0x20DF<br /> KEY_UP 0xA05F<br /> end codes<br />end remote</span></blockquote>
</div>
<div>
If you have a <a href="http://www.logitech.com/en-ca/harmony-remotes">Logitech Harmony remote</a>, life is even easier. You can select almost any media player remote, push the settings to your Harmony remote, and then capture they keypresses like described in the above. If you want to cheat, you could search for the remote setting for "WD TV" and then skip capturing the codes and just copy-and-paste the above <a href="https://dl.dropboxusercontent.com/u/14855532/lircd.conf">lircd.conf</a> as your own. </div>
<div>
<br /></div>
<div>
If you didn't generate the lirc.conf in the correct location, or if you are copying it from a difference source, make sure you store it in /home/pi/ on your Raspberry Pi.</div>
<div>
<br /></div>
<div>
All you need to do now, is in Raspbmc Settings (under Programs), use the settings <span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">Enable Repeat Filter</span> (enable/fill in dot), <span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">Enable GPIO TSOP IR Receiver</span> (enable/fill in dot), <span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">GPIO IR Remote Profile select Custom (lircd.conf on pi's home folder).</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"><br /></span></div>
<div>
Then either restart XBMC (you can kill -9 on the xbmc.bin process in a ssh session) or reboot the Pi, and once the Lirc service starts in XBMC, your remote should control XBMC.</div>
<div>
<br /></div>
<div>
We don't have to stop here. We can further move onto some customization.</div>
<div>
<br /></div>
<div>
It might be handy, for instance, to associate a remote key to a function. For example, there is no key set that would allow us to quickly access the Favourites Menu. In actuality, we can associate almost any function in XBMC to a key on a remote (likewise can be done for keyboard, mice, and joysticks).</div>
<div>
<br /></div>
<div>
We can repurpose an existing key, such as KEY_HOME, which we will use for this example. If you have a Harmony remote, you could create virtual keys fairly easy that would appear in the activity screen on the remote. The "WD TV" device in Harmony actually contains a few such keys such as A, B and C. You can look up any unusued key name in the keymap (running the <span style="background-color: white; font-family: Verdana; font-size: 13px; white-space: pre-wrap;">irrecord --list-namespace</span> that was ran earlier), and associate the IR signal to the key name and add it to your lircd.conf. For simplicity, this example will simply repurpose the KEY_HOME.</div>
<div>
<br /></div>
<div>
On the Raspberry Pi, I will create a file <span style="background-color: #efefef; font-family: Verdana; font-size: 13px; vertical-align: baseline; white-space: pre-wrap;">/home/pi/.xbmc/userdata/Lircmap.xml</span> . I add the following entries to that file:</div>
<div>
(download <a href="https://dl.dropboxusercontent.com/u/14855532/Lircmap.xml">Lircmap.xml</a>)</div>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"><br /><span style="background-color: #eeeeee;"><span style="vertical-align: baseline; white-space: pre-wrap;"><lircmap></span><span style="vertical-align: baseline; white-space: pre-wrap;"> </span></span></span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"><span style="background-color: #eeeeee;"><span style="vertical-align: baseline; white-space: pre-wrap;"> <remote device="devinput"></span><span style="vertical-align: baseline; white-space: pre-wrap;"> </span></span></span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"><span style="background-color: #eeeeee;"><span style="vertical-align: baseline; white-space: pre-wrap;"> <back>KEY_BACK</back></span></span></span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"><span style="background-color: #eeeeee;"><span style="vertical-align: baseline; white-space: pre-wrap;"> <up>KEY_UP</up></span></span></span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"><span style="background-color: #eeeeee;"><span style="vertical-align: baseline; white-space: pre-wrap;"> <left>KEY_LEFT</left></span></span></span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"><span style="background-color: #eeeeee;"><span style="vertical-align: baseline; white-space: pre-wrap;"> </span></span></span><span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small; vertical-align: baseline; white-space: pre-wrap;"><select>KEY_SELECT</select></span><span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small; vertical-align: baseline; white-space: pre-wrap;"> </span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small; vertical-align: baseline; white-space: pre-wrap;"> <right>KEY_RIGHT</right></span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small; vertical-align: baseline; white-space: pre-wrap;"> <down>KEY_DOWN</down></span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small; vertical-align: baseline; white-space: pre-wrap;"> <stop>KEY_STOP</stop></span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small; vertical-align: baseline; white-space: pre-wrap;"> <info>KEY_INFO</info></span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small; vertical-align: baseline; white-space: pre-wrap;"> <skipminus>KEY_REWIND</skipminus></span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small; vertical-align: baseline; white-space: pre-wrap;"> <play>KEY_PLAYPAUSE</play></span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small; vertical-align: baseline; white-space: pre-wrap;"> <skipplus>KEY_FASTFORWARD</skipplus></span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small; vertical-align: baseline; white-space: pre-wrap;"> <menu>KEY_HOME</menu></span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace; font-size: xx-small; vertical-align: baseline; white-space: pre-wrap;"> </remote></span></blockquote>
<blockquote class="tr_bq">
<span id="docs-internal-guid-5d7184a4-08d3-8e59-cd77-0d09314f79be" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"><span style="vertical-align: baseline; white-space: pre-wrap;"></lircmap></span></span></blockquote>
<div>
In <a href="https://dl.dropboxusercontent.com/u/14855532/Lircmap.xml">Lircmap.xml</a>, I am associating my key names to functions in XBMC. You can look up all the available function names from <a href="http://wiki.xbmc.org/index.php?title=keymap">http://wiki.xbmc.org/index.php?title=keymap</a> . It appears they are case-insensitive (Play = play). I can associate the keys to explicit functions. Because you are using KEY_* names that are actually valid and common, these are mapped to their appropriate functions in XBMC by default. Therefore, you could have stopped and not created this file, and still be able to use the keys to invoke common functions in XBMC. You only have to create this file and start mapping keys once you have decided to reprogram their functions. You can select any available function name (you cannot make up your own, but you can select an existing name and repurpose it). We will select an unused <menu></menu> and associate the KEY_HOME to it as in <span style="background-color: #eeeeee; white-space: pre-wrap;"><span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"><menu>KEY_HOME</menu></span>.</span></div>
<div>
<span style="background-color: #eeeeee; white-space: pre-wrap;"><br /></span></div>
<div>
<span style="background-color: #eeeeee; white-space: pre-wrap;">Finally, o</span>n the Raspberry Pi, I will create a file <span style="background-color: #efefef; font-family: Verdana; font-size: 13px; vertical-align: baseline; white-space: pre-wrap;">/home/pi/.xbmc/userdata/keymaps/remote.xml</span> . I add the following entries to that file:</div>
<div>
(download <a href="https://dl.dropboxusercontent.com/u/14855532/remote.xml">remote.xml</a>)</div>
<div>
<br /></div>
<div>
<span style="vertical-align: baseline; white-space: pre-wrap;"><span id="docs-internal-guid-5d7184a4-08dd-5d36-a96a-e5aae7651f3e"><span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"></span></span></span><br />
<blockquote class="tr_bq">
<span style="vertical-align: baseline; white-space: pre-wrap;"><span id="docs-internal-guid-5d7184a4-08dd-5d36-a96a-e5aae7651f3e"><span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"><span style="background-color: #efefef; vertical-align: baseline;"><keymap></span><span style="background-color: #efefef; vertical-align: baseline;"> </span></span></span></span></blockquote>
<blockquote class="tr_bq">
<span style="vertical-align: baseline; white-space: pre-wrap;"><span id="docs-internal-guid-5d7184a4-08dd-5d36-a96a-e5aae7651f3e"><span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"><span style="background-color: #efefef; vertical-align: baseline;"> <global></span><span style="background-color: #efefef; vertical-align: baseline;"> </span></span></span></span></blockquote>
<blockquote class="tr_bq">
<span style="vertical-align: baseline; white-space: pre-wrap;"><span id="docs-internal-guid-5d7184a4-08dd-5d36-a96a-e5aae7651f3e"><span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"><span style="background-color: #efefef; vertical-align: baseline;"> <remote></span><span style="background-color: #efefef; vertical-align: baseline;"> </span></span></span></span></blockquote>
<blockquote class="tr_bq">
<span style="vertical-align: baseline; white-space: pre-wrap;"><span id="docs-internal-guid-5d7184a4-08dd-5d36-a96a-e5aae7651f3e"><span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"><span style="background-color: #efefef; vertical-align: baseline;"> <menu></span><span style="background-color: white; vertical-align: baseline;">XBMC.ActivateWindow(Favourites)</span><span style="background-color: #efefef; vertical-align: baseline;"></menu></span><span style="background-color: #efefef; vertical-align: baseline;"> </span></span></span></span> </blockquote>
<blockquote class="tr_bq">
<span style="vertical-align: baseline; white-space: pre-wrap;"><span id="docs-internal-guid-5d7184a4-08dd-5d36-a96a-e5aae7651f3e"><span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"><span style="background-color: #efefef; vertical-align: baseline;"> </remote></span></span></span></span> </blockquote>
<blockquote class="tr_bq">
<span style="vertical-align: baseline; white-space: pre-wrap;"><span id="docs-internal-guid-5d7184a4-08dd-5d36-a96a-e5aae7651f3e"><span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"><span style="background-color: #efefef; vertical-align: baseline;"> </global></span></span></span></span></blockquote>
<blockquote class="tr_bq">
<span style="vertical-align: baseline; white-space: pre-wrap;"><span id="docs-internal-guid-5d7184a4-08dd-5d36-a96a-e5aae7651f3e"><span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"><span style="vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"><span style="background-color: #efefef; vertical-align: baseline;"></keymap></span></span></span></span></span></span></blockquote>
<span style="vertical-align: baseline; white-space: pre-wrap;"><span id="docs-internal-guid-5d7184a4-08dd-5d36-a96a-e5aae7651f3e"><span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">
</span></span></span>I invoke the XMBC.ActiveWindow function and pass it Favourites to open the favourites.xml in a Favourties menu. There are a number of <a href="http://wiki.xbmc.org/index.php?title=Opening_Windows_and_Dialogs">windows that can be opened to common function</a>. There are also a number of <a href="http://wiki.xbmc.org/index.php?title=List_of_built-in_functions">different functions that can be called</a>. Favourites does exist in XBMC (it is actually a Window ID type that automatically loads whatever is listed in favourites.xml). There are also a bunch of <a href="http://wiki.xbmc.org/?title=Window_IDs">different window IDs</a> that you can do the same action on. You could literally have a 400 key remote and still not have enough keys to satisfy all the functions and windows to call upon.</div>
<div>
<br /></div>
<div>
At this point, with the menu defined to the KEY_HOME in the <a href="https://dl.dropboxusercontent.com/u/14855532/Lircmap.xml">Lircmap.xml</a> and the menu defined with our custom action to open the Favourites Window in <a href="https://dl.dropboxusercontent.com/u/14855532/remote.xml">remote.xml</a>, we can either restart XBMC (you can kill -9 on the xbmc.bin process in a ssh session) or reboot the Pi, and once the Lirc service starts in XBMC, your custom key should perform the action of opening the Favourites menu.</div>
<div>
<br /></div>
<div>
The last time I have is troubleshooting. If a key doesn't appear to be performing correctly or if you don't believe you've mapped it correctly, while in XBMC on the Raspberry Pi, ssh into the system and run <span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">irw</span>. When you press keys on your remote to XBMC, the actions and key names invoked should appear in the ssh session. This will quickly help identify the key name associated with the key. If you press a key and it doesn't appear in the session, it means you haven't mapped it in the <a href="https://dl.dropboxusercontent.com/u/14855532/lircd.conf">lircd.conf</a>. </div>
<div>
<span style="background-color: #eeeeee; white-space: pre-wrap;"><br /></span></div>
Anonymoushttp://www.blogger.com/profile/16677545615031598278noreply@blogger.com0