Looking for a Debugging Mentor Wed, Feb 20. 2013
I'd love to figure out why my Toshiba Z830's screen-brightness controls work fine after suspend but don't work after hibernate with Fedora 17 (I have two-phase suspend/hibernate set up). I'm comfortable doing debugging but don't even know where to start on this one -- I don't know which subsystems to poke at.
Anyone willing to mentor me through this?
Acessing the armv6hl Koji Buildsystem Mon, Feb 11. 2013
The Seneca CDOT OSTEP project has been operating a Koji buildsystem for the Fedora ARM Secondary Architecture project, for the armv5tel and armv7hl architectures. These architectures are going to shift to the Fedora Phoenix datacentre Real Soon Now(tm) now that true enterprise-grade ARM server hardware is available.The armv5tel architecture has hit EOL with Fedora 18, but will be supported with updates until a month after the release of Fedora 20; we (the Fedora ARM group) is working towards Primary Architecture status for armv7hl by the Fedora 20 release.
We (Seneca OSTEP) are now also operating a second Koji buildsystem, for the armv6hl architecture. This architecture is really of interest only for the Raspberry Pi at this point in time. This buildsystem is accessible on the web at http://japan.proximity.on.ca/koji/
However, to access the armv6hl buildsystem using the Koji command-line tools, using a Fedora client certificate, a bit of a dance is required. This post outlines the steps...
1. Set up your Fedora packager environment, if you haven't already done so.
2. Add this text to the end of your ~/.fedora-server-ca.cert file:
-----BEGIN CERTIFICATE-----
MIIECTCCAvGgAwIBAgIJAPbCTGkATOHqMA0GCSqGSIb3DQEBBQUAMGAxCzAJBgNV
BAYTAkNBMRAwDgYDVQQIEwdPbnRhcmlvMRAwDgYDVQQHEwdUb3JvbnRvMQ0wCwYD
VQQKEwRDZG90MQ4wDAYDVQQLEwVqYXBhbjEOMAwGA1UEAxMFamFwYW4wHhcNMTIw
OTI0MTQyODQ2WhcNMjIwOTIyMTQyODQ2WjBgMQswCQYDVQQGEwJDQTEQMA4GA1UE
CBMHT250YXJpbzEQMA4GA1UEBxMHVG9yb250bzENMAsGA1UEChMEQ2RvdDEOMAwG
A1UECxMFamFwYW4xDjAMBgNVBAMTBWphcGFuMIIBIjANBgkqhkiG9w0BAQEFAAOC
AQ8AMIIBCgKCAQEA86TrvFZr95nH8+C9hkSMXqn2kvPZuD6EOsIr/ysQ7ML0xYyW
GJLegs1Z0GYGsKtMdT0CBm+zw8lbdM/+3yRBZG2awd6+Q3aIdeY0QcPkTbnxGsnY
bOr1cP5LwVP3OW6+qR4Leo0ISOJHdAp7HroXi1vUGMg+i3vHwlIBJGdpEngMEMTw
LB21H5xsE6sCwvq4ShhRY064hHfBzVHgO4rTaIwF003zOvPKkWvPqu9WqxCGls80
ASITj8JWCbf8Y/kByddQOdNMkXBPHnmmPzmDorkemOWOYuVJQ1bq8U8JxlVDMvrl
eUweXi6Pz8BEw6EMsskTQQl/oC+ZBNtKD6jJYQIDAQABo4HFMIHCMB0GA1UdDgQW
BBS4SjQeRaXa0y4SHIn7IAdjOi91rDCBkgYDVR0jBIGKMIGHgBS4SjQeRaXa0y4S
HIn7IAdjOi91rKFkpGIwYDELMAkGA1UEBhMCQ0ExEDAOBgNVBAgTB09udGFyaW8x
EDAOBgNVBAcTB1Rvcm9udG8xDTALBgNVBAoTBENkb3QxDjAMBgNVBAsTBWphcGFu
MQ4wDAYDVQQDEwVqYXBhboIJAPbCTGkATOHqMAwGA1UdEwQFMAMBAf8wDQYJKoZI
hvcNAQEFBQADggEBALFU40yI6gPF8ExOL7+WW2DBkjuCdaeSJXGk/JD29Ass6xS/
iRaAwjwo5UIU356J9TaJFRLIvG34GX0wSdMeYSrJvpCaZzrgDU/AtSDOzr4FF/s4
FOUBk8bENPKZYPUql+VFbQxAEv8PRCUxr9guzpJ3sUaud1J8mPo6/asqIkHzvHFH
JWdhWQJoaS9tFWHqLcG0Y+JpjpcFDqUObelZ1N3+4Dm/U2dreL1+0rt+9d40hken
IbhopnuINnZM6002YG8OWJT3WHuTtSeq8uIlDVhQA+1mzldHddDCA3mmRqL6BjS0
UVQEKz1sqle01LGTQjtMIOr/vnA56Nbhzsm4k7I=
-----END CERTIFICATE-----
3. Place this text in /etc/koji/armv6-config:
[koji]
;configuration for koji cli tool
;url of XMLRPC server
server = http://japan.proximity.on.ca/kojihub
;url of web interface
weburl = http://japan.proximity.on.ca/koji
;url of package download site
topurl = http://japan.proximity.on.ca/
;configuration for SSL athentication
;client certificate
cert = ~/.fedora.cert
;certificate of the CA that issued the client certificate
ca = ~/.fedora-upload-ca.cert
;certificate of the CA that issued the HTTP server certificate
serverca = ~/.fedora-server-ca.cert
4. Execute this command: sudo ln -s /usr/bin/arm-koji /usr/local/bin/armv6-koji
5. Ping someone on the OSTEP team via irc://irc.freenode.net/seneca to add your FAS2 username to the Koji instance.
6. Profit! -- You should now be able to issue commands to the armv6hl koji system by typing: armv6-koji command
In due course, we'll get this configured as a standard secondary-arch Koji instance, and you can skip the steps above -- but in the meantime, if you want to help with the armv6hl effort, those are the steps required.
Why the Pi is Great for Teaching and Hacking Fri, Jan 18. 2013
Today at FUDCon I gave a lightning talk on interfacing devices to the Raspberry Pi, to try and explain why this device is so interesting to both educators and hackers.
Here's a recap of the demo for those who weren't there (or if I missed something); I was using a Pi running the Raspberry Pi Fedora Remix 17, and the point of the demo was to show how simple devices can be controlled (or sensed) directly from the command line (using just four commands: cd, ls, cat, and echo, plus sleep and the bash while...do loop):
1. Output
The Raspberry Pi has a number of General-Purpose Input/Output (GPIO) pins available on a connector on the corner of the board. These can be used as inputs or as outputs, and can be on (binary “1”) or off (binary “0”). The pinout diagram is available on the web.
Connecting up an output can be as simple as taking an LED (from any electronics part store, or snipped out of a dead PC) and a small resistor (I used a 220 ohm one - red/red/brown) and connecting them to one of the GPIO pins and a ground pin. In the demo I used GPIO 11 and ground, with a tiny breadboard and some male-female jumper wires for convenience.
The software side is pretty simple: there's a directory, /sys/class/gpio, that provides access to the GPIO pins. By default, this directory contains just three entries:
# cd /sys/class/gpio
# ls -l
total 0
--w------- 1 root root 4096 Dec 31 1969 export
lrwxrwxrwx 1 root root 0 Dec 31 1969 gpiochip0 -> ../../devices/virtual/gpio/gpiochip0
--w------- 1 root root 4096 Dec 31 1969 unexport
Placing a GPIO number in the export file gives us control of that GPIO:
# echo 11 > export
And the kernel responds by creating a directory corresponding to that GPIO pin:
# ls -l
total 0
--w------- 1 root root 4096 Jan 14 18:39 export
lrwxrwxrwx 1 root root 0 Jan 14 18:40 gpio11 -> ../../devices/virtual/gpio/gpio11
lrwxrwxrwx 1 root root 0 Dec 31 1969 gpiochip0 -> ../../devices/virtual/gpio/gpiochip0
--w------- 1 root root 4096 Dec 31 1969 unexport
The gpio11 directory contains a number of pseudo-files for controlling the pin:
# cd gpio11
# ls -l
total 0
-rw-r--r-- 1 root root 4096 Jan 14 18:41 active_low
-rw-r--r-- 1 root root 4096 Jan 14 18:41 direction
-rw-r--r-- 1 root root 4096 Jan 14 18:41 edge
drwxr-xr-x 2 root root 0 Jan 14 18:41 power
lrwxrwxrwx 1 root root 0 Jan 14 18:39 subsystem -> ../../../../class/gpio
-rw-r--r-- 1 root root 4096 Jan 14 18:39 uevent
-rw-r--r-- 1 root root 4096 Jan 14 18:41 value
The files we care about are direction and value. The direction is initially set to input (“in”), which we can see if we cat the direction file:
# cat direction
in
We can change the pin to an output by writing “out” into that file:
# echo out > direction
The value file will tell us if that pin is off (“0”) or on (“1”):
# cat value
0
If you set this value to 1, the LED should turn on:
# echo 1 > value
If it doesn't, you probably have it plugged in backwards. Switch the wires (I'll wait).
Once the LED is on, you should be able to turn it off by setting the value to 0:
# echo 0 > value
From an educational perspective, this is really cool: it makes a concept (bit) tangible.
But turning the light on and off gets boring quickly. The next step is to write a command-line loop to make the LED blink:
# while true; do echo 1 > value; sleep 0.2; echo 0 > value; sleep 0.2; done
What if you want to control something a lot bigger than an LED? Just substitute something like a Powerswitch Tail II for your LED - your Pi connects to an LED inside the tail, and whenever that LED is turned on, the water pump/blender/fan/toaster plugged into the tail starts up.
2. Input
Connecting an input is not any more complicated. In the demo, I hooked up an old “Turbo Mode” switch (remember those?!) to GPIO 24. In one position, it connected GPIO 24 to 3.3 volts, and in the other position, it connected it to ground.
Using this switch as an input was even easier than controlling the LED:
# cd /sys/class/gpio
# echo 24 > export
# cat gpio24/value
0
... Now toggle the switch! ...
# cat gpio24/value1
3. Input & Output
Putting both of these together is pretty straightforward. You can control the flashing of the LED using the switch with a line like this:
# while sleep 0.1; do if [ $(<gpio24/value) = "0" ]; then echo 1 > gpio11/value; sleep 0.2; echo 0 > gpio11/value; sleep 0.2; fi; done
For education, these experiments are simple, quick, and don't require a lot of background knowledge: the student needs only a handful of basic bash commands (cd, ls, cat, echo). Unlike an Arduino, the Pi doesn't need a separate system to host development. You also don't need to deal with files, interpreters, shebang lines, permissions, or compilers. But eventually (and usually pretty quickly), students will want to learn those concepts. In order to save their commands across boots, for example, they will soon want to store them in files: voila, scripts!
It's logical and easy to progress from controlling a single LED and reading a single switch to controlling six LEDs - enough for a two-way traffic light - and then you can add things like pedestrian crossing buttons. Or you can use two infrared LEDs and two infrared phototransistors (which act exactly like switches), mounted in a doorway, to count the number of people that have entered and exited from a room, turning on the lights whenever people are present. These types of projects are fun and engaging ways to teach logic, programming, and circuits.
After a while, students want to do something they can't easily do in bash, like drive a GPIO faster, or poll some complex combination of pins – and they're on to Python (or C, or Perl, or any of a multitude of other languages).
When students/hackers/makers want to connect something more complex than can be easily interfaced through GPIO, the Pi offers serial ports (you can put a message on an LCD display with two bash commands), I2C, and SPI interfaces. And although the ARM processor in the Pi is fairly slow, it is fast enough to do interesting things like speech synthesis and machine vision.
SBR600 - Winter 2013 Mon, Dec 17. 2012
The SBR600 Software Build & Release course provides a unique opportunity for Seneca CTY students to get involved with an open source community. However, for the Winter 2013 semester, we opened the course late, so not very many students are aware that it's available.
If you're interested in taking SBR600, or know anyone who is: SBR600 is available for the Winter 2013 semester through SIRIS.
Interested in buying a Raspberry Pi? Mon, Sep 10. 2012
I'm trying to gauge interest in being able to buy the Raspberry Pi at the Seneca Bookstores (no promises!). Please take a second and let me know what you think using this poll...
Measuring the Raspberry Pi's Current Consumption Wed, Jun 20. 2012
The Raspberry Pi has a micro-USB jack for power input. This can be used with any recent mobile phone adapter. If you use a two-part adapter, with a plug-in AC-DC converter and a USB A to micro-USB A cable, it's easy to measure the current drawn by the Pi.
To do this, you'll need a USB A male to USB A female extension cord and an ammeter or multimeter with a 1A or 10A range.
1. Remove the outer insulation in the middle of the USB extension cable. Peel back the shielding (silver braid and/or foil) to one side.
2. Cut the 5V supply wire (usually coloured red).
3. Connect your ammeter or multimeter to the cut 5V line.
4. Insert this cable between your AC-DC converter and the USB cable going to your Raspberry Pi.
So, how much current does the Raspberry Pi draw?
It looks like the Pi can draw anywhere from 250 to 500 mA in normal operation, though I did see smaller values in the early stages of startup. When idle, my Pi draws 320-380 mA; with a basic Logitech keyboard and mouse attached and in use, and with the CPU and GPU fairly active, it comes close to 500 mA.
Update: Powering the Pi from a Laptop
The fact that the Pi's current consumption is reliably under 500 mA means that it is actually safe to power from the USB port of another system. This is convenient for developers on the go: for example, I'm in an air-conditioned library escaping the current Toronto heatwave, and have my Pi connected to the back of my laptop with a micro-USB cable for power and a crossover ethernet cable for data.



