NOTE: This is an archive of my old blog. Go to http://gonium.net for my current website.

Sending Faxes from my Router

Posted by md on September 11, 2010

Faxes are an rather old method for communication, but in Germany they have one advantage: as opposed to emails, faxes are legally binding in the same way as letters are. So, from time to time, sending out a fax is useful. In addition, I have a telephone flatrate included in my data plan, so I don’t have to pay the postage for letters any more. The plan: use the USB port on my router to attach a modem and send out faxes using the mgetty package.

For 3 Euro I acquired an old ELSA Microlink 56k USB modem. I did some research, this modem is one of the few ones supported by the Linux usb-cdc kernel drivers. In addition it can be powered from USB only, so I don’t need another power supply. A week after winning an auction on ebay it arrived today.

My router runs OpenWRT. I installed the following packages using the opkg system:

kmod-usb2
kmod-usb-uhci
kmod-usb-net
kmod-usb-core
kmod-usb-acm
mgetty

mgetty contains a program called “sendfax”, which can be used to dial a number and send the data. The latter needs to be in G3 format. Since I write all my letters using LaTeX, I integrated a “fax” target into my Makefile for LaTeX documents. This target reads the PDF output of LaTeX and converts it to G3 using Ghostscript. The essential command is:

gs -dSAFER -dBATCH -dNOPAUSE -sDEVICE=dfaxhigh -sOutputFile=fax.g3.%d -q main.pdf

This creates a bunch of fax.g3.* files, one for each page within the PDF file. Then, I simply copy these files to my router and issue the sendfax command, for example:

sendfax #fax number# fax.g3.1 fax.g3.2

The command dials the fax number and sends the specified g3 files:

root@nibbler:~# sendfax 032121xyzxyz fax.g3.1 fax.g3.2
Trying fax device '/dev/ttyACM0'... OK.
Dialing 032121xyzxyz... OK.
sending 'fax.g3.1'...
sending 'fax.g3.2'...

If an error occurs, the command will fail and tell you about it. The mgetty package also contains various scripts for building a fax spooler, but for my personal usage, I will stick to raw sendfax. Please note that it is also possible to receive faxes, but I did not install these components so far.

No more postage for me. Yay!

Picture: CC-BY-SA-NC vtengr4047, thanks!

Der Metavortrag 1

Posted by md on August 05, 2010

Morgen (6.8.2010) halte ich beim Chaostreff Kaiserslautern einen Metavortrag, sprich: Einen Vortrag über Vorträge. Das Ganze ist eine recht emotionale Geschichte: In den letzten Stunden habe ich mich intensiv mit meinen eigenen Vorträgen beschäftigt. Und die Idee verworfen, zuviel Theorie da einzubauen. Das soll nicht heissen, dass Schulz von Thuns Kommunikationsquadrat nicht sinnvolles Hintergrundwissen ist. Ganz im Gegenteil, es gibt nix praktischeres als eine gute Theorie. Aber für diesen Vortrag out-of-scope.

Ich fasse mal meinen Vortrag zusammen:

  • Vorträge halten ist eine Fertigkeit. Das braucht Übung, ist aber sehr befriedigend, wenn es funktioniert.
  • Die meisten Vorträge Folien sind schlecht. Ich empfehle “The Cognitive Style of Power Point” als Heilkur.
  • Der Content ist nach wie vor das Wichtigste an einem Vortrag – das ist auch gut so.
  • Trotzdem kann man durch den Vortragsstil entscheidend beeinflussen, ob die Message ankommt – oder eben nicht.
  • Schließlich: Ob ein Vortragsstil einem liegt oder nicht, muss man selbst herausfinden.

UPDATE: Die Folien sind nun hier: MetaVortragsFolien (PDF)

Weiterführende Informationen:

Hatte ich erwähnt, dass ich einige meiner besten Vorträge am Flipchart ohne Rechner gehalten habe?

Contiki and Mac OS 1

Posted by md on July 30, 2010

At the moment I am building a small demo based on the AVR Raven and Contiki. I was running into some trouble with building the Firmwares on my Mac – this is the documentation of the workarounds.

The Contiki build system depends on some GNU utilities that are not installed. Using the following steps I was able to compile for the “native” (i.a. Mac OS) target:

  1. Install GNU binutils using MacPorts.
  2. Edit “cpu/native/Makefile.native” and adjust the “Compiler Definitions” section like this:

    ### Compiler definitions
    CC = gcc
    LD = gcc
    AS = as
    NM = nm
    # Use GNU ar instead of /usr/bin/ar
    AR = gar
    OBJCOPY = objcopy
    STRIP = strip
    ifdef WERROR
    CFLAGSWERROR=-Werror -pedantic -std=c99 -Werror
    endif
    CFLAGSNO = -Wall -g -I/usr/local/include $(CFLAGSWERROR)
    CFLAGS += $(CFLAGSNO) -D_XOPEN_SOURCE=500 -O
    # Simplify ld arguments
    #LDFLAGS = -Wl,-Map=contiki-$(TARGET).map,-export-dynamic
    LDFLAGS = -Wl

Another issue is the ELF binaries for the AVR Raven boards. These files contain all components of the programs: flash and eeprom
images as well as fuse settings. Unfortunately, avrdude cannot read the ELF format. So you have to extract the flash manually:


$ avr-objcopy -R .eeprom -R .fuse -R .signature -O ihex $NAME.elf $NAME.hex

It works similar for the EEPROM section (where the IP data is stored):

$ avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 -O ihex webserver6.elf webserver6.eep

You can also check which fuse settings are used:

$ avr-objdump -d -S -j .fuse webserver6.elf
webserver6.elf: file format elf32-avr
Disassembly of section .fuse:
00820000 <__fuse>:
820000: e2 99 ff

The directory structure of Contiki is somewhat overwhelming. I am currently working in these directories:

  1. contiki-2.4/platform/avr-ravenlcd: This is where the code for the ATMega3290p lives. Run make here and upload.
  2. contiki-2.4/platform/avr-raven: The ATMega1284p code lives here, this is where most patches are. Don’t run make here!
  3. contiki-2.4/examples/webserver-ipv6-raven: Run make here for the ATMega1284p code. This builds the webserver code and includes the platform/avr-raven dir.

In addition, I have a serial terminal for debugging output:
screen -U /dev/cu.SLAB_USBtoUART 57600