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:
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.
Last wednesday in my ASM and Systems Programming class we received our STK500 programming boards for use with our projects. Yesterday we were given some taste of how to program a board in Atmel ASM.
The ‘official’ way to download your program to an atmel board is to use their Windows-only AVR Studio. Boo!
Luckily, there is Linux software already available for this. AVRDUDE lets you communicate with the STK500 programmer to download code compiled into the Intel Hex format. Finding a compiler is a bit more difficult, but still pretty easy. There isn’t a compiler in the fedora repos, so I went searching and found avra. It is 100% compatible with the official AVR compiler.
As my first free time project, I made some leds count in binary:
;comment
.cseg
.org 0
.def count = r16
.def temp = r17
.equ PORTB = 0×18
.equ DDRB = 0×17
ldi temp,0xFF
out DDRB,temp
ldi count,0×00
lp:
out PORTB,count
inc count
rjmp lp
That was pretty thrilling for me, but I wanted more, so I made a pattern expand outwards:
;comment
.device ATmega16
.cseg
.org 0
.def output = r16
.def temp = r18
.equ PORTB = 0×18
.equ DDRB = 0×17
.equ LEFT = 0b11110000
.equ RIGHT = 0b00001111
.equ PATTERN = 0b00011000
ldi temp,0xFF
out DDRB,temp
ldi output,PATTERN
lp:
out PORTB,output
mov temp,output
andi output,LEFT
lsl output
andi temp,RIGHT
lsr temp
or output,temp
ldi temp,0
cpse temp,output
rjmp lp
ldi output,PATTERN
rjmp lp
And here’s the device in its blinking glory:
First, I’ll show off the logo for Glovebox:
Second, Glovebox development has stalled a little bit over the last few weeks due to college starting up again for me. So, I’ll just give a quick overview over whats changed since I first announced the project.
Much like KDE’s libraries, Gloveui is the name for the base library I forsee all Glovebox components using. This will allow for super easy theming and other bits of consistency. As of now though, it only has an implementation of the Freedesktop icon and sound theme naming specifications, along with GIcon and GNotify classes.
A GIcon has a simple constructor. You pass it the fd.o icon name, and it uses the QIcon methods to load up images. Icons are still drawn using the basic QIconEngineV2, so it doesn’t always draw the proper size. Thats coming soon though.
The GNotify is a rough outline for a much more broad system. I soon home to have something similar to the galago-project implementation of the fd.o notification specification, where information bubbles can pop up on the display somehow. But for now, GNotify only does one thing: plays fd.o-named sounds. Since it is static, you just call GNotify::global()->sound("desktop-login"); to play the startup sound. GNotify uses Qt’s Phonon classes to accomplish this with minimal effort.
Over on the right is the current view of the Launchpad main window. Nothing too exciting to look at, I know, but there is now a fully-functional GPS data engine! And on the map page, I’ve implemented two handy widgets: A compass and a signal chart. The two widgets are independent of Glovebox, so any other Qt developer is welcome to use them. The only issue with them right now is the size hints aren’t working properly.
With a full school schedule (class and work from 9-6 on a good day), I don’t have a whole lot of free time. I try to hack on Glovebox when I get a chance, and I’ve got a quick list of things I’m working on from time to time:
That last item is a bit troublesome to me. A main feature of my Launchpad is to show a dashboard with widgets for the home page. Idealy, I’d like to implement this using Plasma. Unfortunately, that means I’d have to add KDELibs as a requirement. Right now, my plan of attack is to strip out all the KDE-specific code and replace it with Glovebox code.
Its bothering me though that I seem to be duplicating the efforts of KDELibs just to import one (awesome) feature (set). With all the recent work on getting Plasma to work great for embedded devices, it seems like I should just bite the bullet and link in KDELibs. I feel that goes against my biggest design goal for Glovebox, in that it should be small as possible and depend on as few libraries as possible.
So, lazyweb, any input on this problem?
For most of the summer, I spent my limited idle time thinking up what kind of big project I wanted to accomplish next, now that my MythTV system was ticking along just fine. My Hiveminder list had a few notable things in it: a beowulf cluster of as many free, discarded computers as I can find, a dorm computer that acts as a link between my dorm and home network, a networked coffee maker, and a car computer. Just to name a few crazy ideas.
All of those others would take too much effort, or have already been done before hundreds of times. The linux car computer hasn’t though. Searching google yields one result, “The Coolest Car in the World“. Really, its nicely done. But it could use some improvements. At a quick glance, most of the package seems hacked together using bits of MythTV, Gentoo, various other programs, and shell scripts. Even though it works, it is still very much a huge hack.
So I started my own project. A car computing environment. Much like a desktop environment such as KDE, or Gnome, Glovebox is a ‘desktop’ environment of sorts. It is based in Qt/Embedded Linux, which unfortunately restricts all GUIs to use that, but I feel the benefit of the lightweightness far outweighs anything gained by using a heavy X server.
The project is currently hosted by GitHub, and can be found on it’s page there. More details about the project can be found on that page as well. But for now, how about some screenshots, eh?
This first shot here shows Marble from the KDE project. In Qt/Embedded. As I said in yesterday’s post, I was planning on using it for some big upcoming project. Here it is! Right now, all the map does is sit there and look pretty. More like pretty awesome, am I right? Oh ho ho ho…
Since the Services concept in Launchpad (the main menu program) is based off of plasma’s DataEngine system, I figured it’d be a good idea to continue the tradition of using a clock as the whipping boy. The first Service I wrote was the time service, and the first page to use a service was the clock page. Once I add themes to the system, the clock will look a lot nicer.
As you are likely well aware, the Ext javascript library changed it’s license to the GPL. Instead of being reasonable people and choosing the LGPL, they want to enforce the spread of open source throughout the cloud. Sounds like a great idea, except that open source doesn’t always work. I’m a strong advocate of open source, but enforcing everyone that uses your software to suddenly be required to release their software under the GPL is a bad idea. Its the opposite of the spirit of the GPL, because it forces you to release the source of your software. You can’t do exactly what you want with it anymore.
The GPL was created to protect an author’s ideas about how their software should be used. Comparing it to other licenses such as the MIT license, the GPL is incredibly restrictive. It makes sure that source code released as open source stays open source. If something is added to it (like including it into a website’s programming), then everything that touches it must be GPL’d too. It can be quite a nasty virus. However, the LGPL tries to grant a little more freedom to the user of the software. It allows them to use the software how they want without having to release whatever uses it under the LGPL.
Releasing the Ext library under both the GPL and a commercial license effectively forces all users to either pony up some cash to use it, or they have to lose a bunch of cash by releasing their secrets under the GPL. If it used the LGPL license, they wouldn’t have to.
Then again, maybe I’m full of crap and nobody really understands how these licenses apply to a distributed language such as Javascript. Its only my two cents.
Today’s slashdot article references a program built by NeoSmart called iReboot. NeoSmart says that they’ve manged to create a way to work around Windows Vista’s UAC system. Their method involves making a system daemon run at startup and then having a userspace program interact through standard interprocess communication. Yet somehow, they see this as a Vista security flaw.
Linux can do pretty much the same thing, yet people don’t point at it and say it is an insecure method. There already is an elevated privilege daemon running on a modern Linux system called HAL which lets regular users do things that only root should be able to do. Previously, the only way to reboot a system was to be root, who has the privilege to run /sbin/halt. Now, you send a message through the DBUS to HAL, who in turns calls halt, or more likely does a regular system call into the kernel.
The main difference between these two systems of rebooting into a different operating system is that DBUS was thought out to be secure from the start. DBUS relies on the concept of POSIX user accounts to make sure that only certain users or groups can access certain DBUS interfaces. But of course, DBUS was meant to be a generic interprocess communication system easier to use and much more capable than a homemade and likely platform-dependent system of unix sockets or even IPC signals. iReboot still uses the same principle, except that it isn’t as secure as DBUS. It doesn’t need to be, because there isn’t any security loss with a one- or two-user desktop.
As Raymond Chen says in his “When People ask for Security Holes as Features” series, some people are just stupid. They don’t understand the complications of how something like security works. They want silly things like asking the system for the user’s password while being blissfully naive. At the end of NeoSmart’s release post, the writer says that UAC’s separation of privileges just “gets in the way” of programmers who want to do simple things. Let’s face it, Unix-based operating systems have managed to deal with this ‘flaw’ for years. Through the efforts of ConsoleKit and DBUS, fine-grained granting of permissions has made ‘working around’ this issue a bit easier in recent times. The administrator just needs to specify which users can do what. No UAC dialogs, no need to enter the root password (unless the administrator desires it).
If NeoWin thinks this is a problem, they should have a careful look at any programming language in general. Just because it has a function to delete a file, does that mean that the language should remove that function because it could easily be abused?
I’ve got a USB Delorme Earthmate LT-20 that, untill a few months ago, worked perfectly fine. Somewhere between then and now, the cypress_m8 driver that supported it in linux somehow changed to make it unsupported. What happened was that it tried to retrieve the serial line settings but the Earthmate didn’t respond to the query, so the driver disabled it to try and make it harmless, even though it was already harmless. Somewhere around line 400 in drivers/usb/serial/cypress_m8.c, add this:
/* The LT-20 doesn't really work too well with trying to get the serial settings. */
if (port->serial->dev->descriptor.idProduct == PRODUCT_ID_EARTHMATEUSB_LT20) {
return retval;
}
Put it right before the lines that say:
do {
retval = usb_control_msg (port->serial->dev, usb_rcvctrlpipe(port->serial->dev, 0),
HID_REQ_GET_REPORT, USB_DIR_IN | USB_RECIP_INTERFACE | USB_TYPE_CLASS,
0×0300, 0, feature_buffer, 8, 500);
That fixes it and doesn’t break other devices either, like simply commenting out the cypress_set_dead() call.
A good while ago I updated my kdebuild script to support the initial build setup of a new SVN repository copy. Now you can use the –init flag to run the first cmake && make from the source directories. Because sometimes you need to rm -rf the build directories.
Friday marked the end of the second week of my (hopefully) 4-year stay at The University of Akron.
I’m the first of my family to go to any form of higher education, so the whole experience has been totally new to me. My two roommates are respectively the 2nd and 6th members of their families to have been in college. Both of them currently have family members in their second year here too.
Before coming here to Akron, I crawled most of the internet (and just about all of Everything2) to try and learn exactly what the “College Experience” is like. Nobody wanted to tell, so all that I knew was that everybody drinks, your professors are just people with names who talk a lot, and ramen constitutes 80% of your diet (the other 20% is beer).
Gee, I feel silly now.
Most of my professors are actually graduate students (one is a part-timer who teaches at a local high school). They have personalities comparable to people back in Jefferson (read: nutters), and are on a two-way first-name basis with us. Its hardly different than high school.
Yes, there are a lot of people who drink. Specifically, my neighbors. Well, they used to until they got the grand idea of quaffing a gatoraide bottle full of vodka and monster. Aside from those two, drinking is still pretty popular. Every weekend you can hear the halls filled with voices of excited people prepping to go out on the town to some random party.
As for feeding, I have a meal plan. It costs about $3,000 and lasts the whole semester. I’m not sure if other colleges have such a thing, but the plan pretty much guarantees that you get fed. Here at Akron there is “Rob’s Cafe” inside Robertson hall. When you use your meal plan, they swipe your ZipCard and it acts like a debit card. Several other eateries around Akron also accept your ZipCard, so McDonald’s can be paid with your meal plan too.
Another nifty feature about the ZipCard system is the All-Campus account. Its like a small little savings account you or your parents can put money on. The money can be spent anywhere zipcards are accepted (like the local bookstores, or the bowling alley). If you have a US Bank account, you can link the two together so you never worry about adding money to the card.
So about that Rob’s Cafe…
It is incredible. Every national cuisine is available there and made-to-order on demand. Omlettes, Waffles, Cereal, Wraps, Pizza, Chinese, Italian, Mexican, Salads, Soups, the list goes on. Their waffles are incredible. Not having one before you leave Akron is a cardinal sin in my book.
Prices there vary according to the meal selection available. You should know that because it is inevitable you will use up your weekly allotment of $50 before Sunday when they recharge the accounts. Breakfast is around $5, Lunch is $7 and dinner is $9.
At the moment, I have nothing to occupy my weekends. During the week I have classes and work at my dorm’s builtin food delivery service. On the weekends, I struggle to maintain sanity by sleeping in until noon and wandering campus aimlessly. Currently I’m working on joining several clubs to occupy myself, such as the Green Dragon Kung-Fu club and the Zips Programming Network. There isn’t a bowling league or club yet, but myself and two other Jeffersonians filled out the form asking if there is any interest in such a thing.
For a long time, I used transKode as my Amarok transcoding script. I’m not sure why but as of last week that script broke and transcoded all my oggs to silent MP3s. They still had the proper length and tags, but filled with nothing but silence. I searched on Amarok’s Wiki for other transcoding scripts and noticed that transKode wasn’t there anymore. Odd.
The most promising script available was amaKode. That statement didn’t really say much though, because the script was partially functional. All it could do was transcode from any format to any other. No tagging though, and sometimes Amarok wouldn’t get the DCOP call right.
Following a suggestion on AmaKode’s kde-apps page I ported AmaKode to use pyKDE and the hacked dcopext.py. That rightly fixed the DCOP problem so all files got moved around right. The only remaining problem was tagging the output files.
Amarok doesn’t have any DCOP functions to query the collection about a specific URL, so I had to resort to using TagLib. Amarok passes the transcoding script a URL, so I needed to manually strip out the ‘file://’ from the URL. It isn’t a very clean hack but it works for 99% of my uses.
I’m not sure why, but my python-taglib installation doesn’t have the TagLib::Tag::duplicate method. Meh.
And for people who just want to upgrade: