Easy Atmel AVRDUDE upload script

For my ASM and systems programming class, we occasionally write programs and need to upload them to the programmer board. Since my laptop only has USB ports, I was given a USB-to-Serial converter. In windows, there is device probing using AVR Studio that lets it find the device by itself. In linux, you only know which tty is the USB-to-Serial converter by looking at dmesg. Usually.

But this is the year 2008! Linux is a modern operating system! You should be able to do that probing through the command line, right?

Using HAL, you can easily find which device is the converter. It isn’t what AVR Studio does (sending magic packets) but it still works, and it doesn’t send any unwanted magic to my bluetooth radio or CDMA modem. I’ve written a small function for my zsh shell that automatically detects which USB tty is the serial converter and sets up the avrdude command as needed:

  1. alias avrdude=‘_avrdude’
  2. _avrdude() {
  3.     #Find the USB-to-serial adaptor entries, then find the actual USB device entry
  4.     UDI=$(hal-find-by-property –key info.product –string ‘FT232 USB-Serial (UART) IC’);
  5.     if [ -z "$UDI" ];then
  6.         echo "No USB device found."
  7.         return -1
  8.     fi;
  9.     UDI=$(hal-find-by-capability –capability ’serial’ | grep "$UDI")
  10.     #Get the USB character device
  11.     DEVICE=$(hal-get-property –udi "$UDI" –key linux.device_file)
  12.     NAME=$(hal-get-property –udi "$UDI" –key info.product)
  13.     echo "Using discovered device ${DEVICE} - ${NAME}"
  14.     =avrdude -c stk500v2 -p m16 -y -P "$DEVICE" $@
  15. }

Of course, this script is written for that specific USB device, and tells avrdude to prepare for my ATMega16 (-p m16) on the STK500v2 programming board. YMMV.

Comments »

Glovebox Widgets

Glovebox is still rolling around on my laptop. I managed to sit down today after a few weeks of on-and-off thinking of how to best solve my current problem: how to do widgets.

One idea was to hack the KDE bits out of Plasma and just stick it in there, but there’s a few problems with that:

  • Near impossible to update libplasma
  • I’d add kdelibs as a dependency, if I didn’t hack out the bits
  • Would take forever
  • Its a shameful, ugly hack.

Over time, I came to the conclusion that I won’t use plasma, but I’ll use it as a reference for some of the really great ideas it has.

Plasma’s main goal is for a slick looking desktop, be it for a PC, internet tablet, embedded device, or PDA. I’m sure someone from the plasma team would like to say that its great for my project, and I’d like to agree. I can’t really think of a good reason to not have it in, other than the fact that I don’t want kdelibs as a dependency. Perhaps I’m just bullish and falling for the Not-Invented-Here thinking.

If someone out there in kdeland can figure a way to jam plasma into Glovebox without requiring someone to install the whole kdelibs package, I’d like to hear that.

Anyways, I wrote my own little widget system. Its very simple for right now, as I don’t have any kind of theming in. Thats next I think.

Oh yeah, the obligatory screenshot:

Here you can see, what else, a clock. Its just a proof-of-concept clock though. I’m working on theming next.

Comments »