Assorted CHIP Stuff

Some stuff from playing with the stupidly named CHIP .

Battery

There is a script shipped with the CHIP images that will dump some information from the battery controller. Which is sort of useful I guess.

[chip@chip] $ sudo battery.sh
BAT_STATUS=0
CHARG_IND=1
BAT_EXIST=1
CHARGE_CTL=0xc9
CHARGE_CTL2=0x45
Battery voltage = 3930.3mV
Battery discharge current = 0mA
Battery charge current = 882.5mA
Internal temperature = 51.9c

LEDs

There are two leds on board, a pink one that is directly wired into power and a status led connected over i2c. The led can be control directly over i2c with the i2cset command.

[chip@chip] $ sudo i2cset -f -y 0 0x34 0x93 0x0 #turn off

[chip@chip] $ sudo i2cset -f -y 0 0x34 0x93 0x1 #turn on

On my CHIP image the led is showing some sort of heartbeat that isn't stopped when I manually intervene. On their forums the i2cset method is reccomended to control the led, but the heartbeat made this impossible.

After a ton of poking and searching, trying to see if you can get strace to log processes that access a path (doesn't look like you can) I came across ledtrig-cpu in the dmesg .

[    2.315000] ledtrig-cpu: registered to indicate activity on CPUs

ledtrig-cpu is a kernel module for showing event status on built in leds, there is some inscruitable BBB documentation that somewhat shows how to control it.

In /sys/class there is an entry for each on the leds on board, listed with their colour. We can have a play with the led by looking at the following:

[root@chip] # cd /sys/class/leds/chip:white:status
[root@chip] # ls
brightness  device  max_brightness  power  subsystem  trigger  uevent
[root@chip] # cat brightness 
0
[root@chip] # cat max_brightness 
255
[root@chip] # echo 24 > brightness 
[root@chip] # echo 10 > brightness
[root@chip] # echo 255 > brightness
[root@chip] # echo 0 > brightness

Changing the value in brightness didn't dim the STAT led at all, I can only set it on or off.

[root@chip] # cat trigger
[none] kbd-scrollock kbd-numlock kbd-capslock kbd-kanalock kbd-shiftlock kbd-altgrlock kbd-ctrllock kbd-altlock kbd-shiftllock kbd-shiftrlock kbd-ctrlllock kbd-ctrlrlock nand-disk usb-gadget usb-host axp20x-usb-online timer oneshot heartbeat backlight gpio cpu0 default-on transient flash torch mmc0 rfkill0 rfkill1 rfkill2 rfkill3

The trigger functionality was much more fun. Trigger modes can be changed by writing their name to the file

[root@chip] # echo backlight > trigger
[root@chip] # echo transient > trigger
[root@chip] # echo torch > trigger    
[root@chip] # echo mmc0 > trigger 
[root@chip] # echo timer > trigger

Setting the trigger mode to timer added two more files the /sys entry:

[root@chip] # ls
brightness  delay_off  delay_on  device  max_brightness  power  subsystem  trigger  uevent
[root@chip] # cat delay_on 
500
[root@chip] # cat delay_off
500
[root@chip] # echo 2000 > delay_off

We can restore the trigger to the heartbeat with:

[root@chip] # echo heartbeat > trigger

Reading: Babylon's Ashes, Diamond Age

Archive this page now

The Internet Archive's Wayback Machine has an 'archive this page now' button, which I know I was aware of, but I hadn't ever used it. Watching this chat about archiving I thought I would have a look at it.

My preferred option would be to add a hook to my post script that triggers the IA to scrap any new pages. Poking around the FAQ and the scant API page didn't reveal any recommendations for how to use the tools. With no advice I tried curl with the URL they used:

curl https://web.archive.org/save/http://adventurist.me/posts/0244

That URL worked great, the history page now has a new scrap entry from today. Having done that I started looking to see how well covered my site was, it turns out very few pages have been captured into the global history.

Seems like an easy fix:

curl -s -S "https://web.archive.org/save/http://adventurist.me/posts/0[040-243]" > /dev/null

Ethics in Internet Archiving

The Internet Archive is my favourite thing on the internet, it is much much more than just the wayback machine . It is a massive archive of human culture, it might be one of the most important things being created right now.

There is much more information being added to the IA now than any one person could process themselves. But it isn't that hard for individuals to pick an upload or a topic and process through the files and provide some sort of best of list.

The video below is a chat about archiving, I think the most important take away is that we really need people to review the material and make sections accessible.

Paraphrased:

I am waiting for someone to go through 200 floppy discs and write a blogpost: 
    "I looked at all this junk, these 7 are great."

It is Sunday, so that makes seven days of writing .

Reading: Babylon's Ashes, Diamond Age

Headless CHIP WiFi

I am working on a modification to hostapd and I really have to run this on linux. The pi I was planning to use has seems to have finally given up the ghost after 4 years of use. Never fear, I failed over to using the chip , that came with my pocketchip flashed with the headless firmware.

The chip will use the microusb connection as a serial port by default, similar to the way the BBB uses the usb port to do ethernet. With a serial connection, I needed to figure out how to get the chip onto wifi.

There is a command line tool for interacting with network manager listed in the chip documentation . nmcli is a pretty great tool for network access.

$ nmcli device wifi list
*  SSID             MODE   CHAN  RATE       SIGNAL  BARS  SECURITY    
*  HameNetwork      Infra  11    54 Mbit/s  100     ▂▄▆█  WPA2        
   NetGear-AWQ4D8   Infra  1     54 Mbit/s  69      ▂▄▆_  WPA1 WPA2   
   BTWifi-X         Infra  6     54 Mbit/s  30      ▂___  WPA2 802.1X 
   BTWifi-with-FON  Infra  6     54 Mbit/s  30      ▂___  --

Better yet, there is a nmtui interface that presents a nice ncurses way to configure the network.


Reading: Babylon's Ashes, Diamond Age

Evil Bit

It appears that people mistake this April 1st RFC for a genuine one, the author has a page of replies here .


Reading: Babylon's Ashes, Diamond Age