Archive for the ‘Projects’ Category

Fast merge of multiple jpgs to a single pdf

Wednesday, May 9th, 2012

If you want to merge several images (e.g.) jpg to a single pdf, probably after scanning them, just use

convert *.jpg output.pdf

So simple.

X-Chat2 script to preserve nickname

Monday, September 26th, 2011

I have been using X-Chat2 for quite a while now, and since my ISP cuts my line every 24h, i rejoin all IRC networks once my client detects the disconnect. This happens before the server realises, that the old connection is invalid, so my nickname is occupied by a ghost (zombie connection). There is a command to tell the server, that this situation has happened (ghosting), but not all servers support it.

Thats why i wrote this script, which listens for some events (e.g. the QUIT command, which is sent when the server realises, the other connection is dead) and then tries to change the nick back to the primary nick. It also listens to some more events and has a nickchange delay (so you dont spam the server with nickchanges in case of a problem). One could probably reduce the eventlisteners to the QUIT one.

I wrote this in perl, because i was looking at other plugins how the xchat API works, but it should be fairly easy to port it to python or c++, or whatever you want. No special license.

Install by simply renaming it to nickChanger.pl and putting it into your

~/.xchat2/

folder and ensuring that perl is installed. X-Chat will try to load it on start.

nickChanger.pl

 

Building an AVR m0dul for the CCC r0ket

Friday, August 26th, 2011

AWARD:

Thanks to penma, ISP methods are implemented, check:
this commit on github

 

The CCC r0ket, handed out at the Chaos Communication Camp 2011, is a slick ARM based developing board, featuring a battery, a display, 5-way jog dial button, RF and an USB mountable dataflash.

More information can be found here:

http://r0ket.badge.events.ccc.de/start

http://events.ccc.de/camp/2011/wiki/R0ket

The most intresting feature though is the m0dbus, which enables the eager tinkerer to build his own m0duls (addons), to bring new features to the r0ket. The wiki shows some m0duls like “the flame”, which is an LED with acrylic art.

My idea now was to build a m0dul that features a low-power AVR, which is connected to the r0ket over SPI (available through the m0dbus connectors) and offers even more possibilities for m0duls because of the possible UART interface, the more pins, one can delegate tasks to the AVR and so on. Virtually, i’d be a m0dul-m0dul or simply: m0dul². Can you go deeper?

 

cccamp r0ket with an avr m0dul

 

Since ripping the AVR out of the circuit to update its firmware is not an option, as a first step i looked into programming the AVR serially via SPI by the ARM. That is possible with most AVR MCU’s featurung “ISP Programming”. This leads to the first feature of the m0dul², beeing an in-system programmer for AVR chips. How cool is that?

ISP Programming is described in the full Datasheet of each AVR and the AVR910 note. Also, there are two implementations mentioned in this thread:

http://mbed.org/forum/mbed/topic/595/?page=1#comment-4028

My prototype features an ATTiny2313 (because it was the first i found) so i tried flashing some IntelHex file via SPI, but so far didnt manage to get beyond the flash erase cycle (which works great). The hexfile is read completely into RAM (because the dataflash also uses SPI, just like the display) and then the ISP magic should happen.

If you think you could help the project, please checkout my fork at

https://github.com/x29a/r0ket

I am working with an application (because space is sparse, so the official firmware will be too big) called “avrisp”. To build the firmware, simply change to the firmware/ directory and call the makefile with

make APP=avrisp

The avrisp lib is located under firmware/avr and should be built automatically. The firmware then has to be flashed to the r0ket in ISP mode (hold left and power up). Im doing this via dd and a little helperscript “ravr.sh“.

Since the display cant be used while flashing via SPI (shared bus), the ISP routines feature no debug output. I created *_dry functions, which print to the display instead of talking to the SPI bus, in order to locate the problem.

Hooking up the AVR is straightforward. The repo contains hardware schematics, which show the needed pins on the m0dbus connector. Looking from on top, the right (m0dul A) connector has the following pinout:

VCC-        -BUSINT

SS2-          -SCL

SS1-          -SDA

SS0-          -GND

SCK-         -MOSI

MISO-        -3.3V

I connected SS0 with RESET on the AVR and used the 3.3V for the AVR’s VCC. MOSI, MISO and SCK get directly connected. One could put resistors in between, i didnt. I connected a LED between GND and a pin, so i could the the AVR’s firmware.

Since the ARM runs at 72Mhz, but the AVR is at 8Mhz tops, one needs to divide the SPI frequency before trying to talk to the AVR. This is done in the avrspi_select() routine. Constants for the project are located in the avr.h

TODO:

  • decide which AVR to use, it should have low power consumption but many features (adc, uart, timer, ram/flash) and run at 3.3V
  • fix code to be able to program AVR through SPI
  • integrate avrisp lib into r0ket repo
  • draft schematics, route layout, print pcbs, make kits
  • write SPI communication code, which can be used in the AVR firmware to talk to the ARM
  • build a m0dul² that uses the newly gained features (one i have in mind is to interface the MCA-25 cam)

I unfortunately dont have the time, to continue this right now, so if you have some tips, patches, ideas, feel free to comment, contact me (im also in #r0ket on IRC) or directly send some github pull requests. I’d love to see this w0rking.

How to resize your virtualbox harddrive

Tuesday, July 26th, 2011

This was my situation: Ubuntu 10.04 i686 Host, Ubuntu 10.04 i686 Guest, VirtualBox 4.0.12, dynamic virtual guest hard drive with 8GB, which were simply too few.

Searching the VBox-Forums, it seems there are a couple of ways to increase the disc space of your dynamic virtual harddrive, the way also depends on your host/guest combination.

You might want to look into CloneVDI, a tool that lets you do many things with your VDI. The Post on the VBox-Forums can be found here: CloneVDI Discussion and Support.

I followed the instructions from this post, which seemed to fit my combination just fine. All you need is another guest linux, which happened to be another Ubuntu 10.04 for me. I will call this guest tmp-guest.

First, shut down the guest with the too-small harddrive, which i will call original.vdi. Then goto the vbox settings of your tmp-guest and select the storage tab. There you can add another harddrive to the controller, which will be a new harddrive. Follow the guide to create a harddrive with the desired size (e.g. 15GB for me). I will call this the new.vdi.

After that, stay in this section and also add the original.vdi harddrive (by choosing “select existing harddisk” in the guide). You should now have the harddisk of the tmp-guest, the newly created big new.vdi and the original.vdi attached to your tmp-guest.

Now boot up your tmp-guest and install e.g. “gparted” by doing:

sudo apt-get install gparted

The operations done by gparted could also be done via the LiveCD, where the .iso can be mounted by virtualbox, if you dont want to install gparted to your tmp-guest.

Before we can resize the virtual harddrives, we need to clone the original.vdi to the new.vdi. This can be achieved with the following command:

dd if=/dev/[device of original.vdi] of=/dev/[device of new.vdi] bs=1M conf=noerror

The device will probably be /dev/sdb for the original.vdi and /dev/sdc for the new.vdi, /dev/sda is the harddrive of your tmp-guest. Depending on your configuration this could be totally different though, so its better to verify that you copy the right devices.

ALL YOUR DATA COULD BE LOST.

If you know the harddrives UUID’s, you could use the command

blkid

to identify the devices. Another option is to use

fdisk /dev/sdb

and hit the “p” option to show the details of this device. Pay attention to quit fdisk with “q” so that no changes are written. The new.vdi will not display proper information, since now partitions were created in it.

One could also install “smartmontools” (sudo apt-get install smartmontools) and use the command:

sudo smartctl –all /dev/sdc

to get information on that device.

Assuming the dd command was successfull, you will see the transfer stats like

8589934592 bytes (8.6 GB) copied, 416.04 s, 20.6 MB/s

Now new.vdi contains an exact mirror of original.vdi, but the extra space is not yet available. This will be fixed by gparted.

Start gparted and select the new.vdi device from the top right (should be 15GB or whatever your new size is). Right click on the 8.6GB of partition (left) and select resize. Draw the border all the way to the right (this uses all the available space) and click OK. These changes have to be applied (green arrow on middle).

Now your new.vdi contains the data of your original.vdi but has some extra space.

Shut down your tmp-guest, go back to the settings, detach the new.vdi and original.vdi from your tmp-guest, remove the original.vdi from your original guest and add the new.vdi instead. You should be able to boot the new.vdi without problems and TADA, more space!

One note, if you have different snapshots and want to merge them into a .vdi, you have to delete the previous stages from the snapshowview. Otherwise, snapshots are stored as a difference to the vdi and you will have an old snapshot in your new.vdi.

See this post on how to merge a vdi with a snapshot.

If you have trouble, removing your original.vdi, e.g. because of the error

“… has more than one child hard disk”

it might still be attached somewhere. This can be resolved in the Virtual Media Manager, which shows the machines, an image is attached to. For further guidance, please see this post or this blog entry.

For windows guests, this blogpost might be helpful.

Fujitsu Point 510

Thursday, October 21st, 2010
So i have this Fujitsu Point 510 ancient TabletPC that i play with once every 6 months. Its a pretty old device (i think from 1991 or so) but that doesnt make it any less intresting!

It features a 10.4″ resistive touchscreen, some extra buttons (for rightclick, contrast, soundlevel), indicator lights for HDD, battery, operation, builtin mic and speaker, a place for the pen to reside, IR, DSUB-9 serial, PS2 for a keyboard, two (i think) proprietary connectors (printer/dockingstation maybe) and a PCMCIA Slot for 16bit cards. Yes, its one slot, but it can handle those cards that need two slots because of their size.

Internally it has a 100Mhz AMD CPU and 8MB of soldered RAM which can be expanded easily with two modules. More on those two later. Also, there is room for a 2.5″ IDE harddrive (i have read about some upper size limits somewhere) which is about 3GB big.

On the CPU and again on the case itself, it states that this machine is designed for Windows 95. Actually, Windows 95 runs pretty smoothly on there (check out the Solitaire Animation on YouTube) and there are actually still drivers available from here (just select TabletPC->Point, all the drivers there should work since the hardware didnt really change between the versions). But then again, Windows 95 is just not quite ready for nowadays tasks, especially network/internet or multimedia. And who still supports Win95?

So now there are two options: install Windows98SE or install Linux. For the Linux part (which i will do eventually hopefully [probably in 6 months, or later], please check the links at the end). For the Windows98SE part, go on reading.

Since the Point 510 doesnt provide a Floppy or CD drive (one could try PXE or CD via PCMCIA), its probably the easiest to take out the harddrive, plug it onto a 2.5″ to 3.5″ adapter and put it into a regular PC. Taking out the harddrive is quite easy since its installed in a booth which can be taken out after loosening one screw on the side.

Once you have the Win98 (se) CD in the drive (you either need a bootfloppy or a bootcdrom, i used a win98 boot cdrom which loads CD-Rom drivers from bootdisk.com) the installation is relativly straight forward. One thing i strongly advice is to boot up your system on the Host and copy the whole CD contents to the harddrive. Windows98 will ask you for the CD whenever you even think about changing a driver or adding a new software component. You should also install the touchscreen drivers (using the windows 95 ones works just fine), because otherwise you will be stuck with a system that you cant control. Afterwards, put the harddrive back and it should work allright.

Things i didnt get to work: any form of networking :(

In order to get a little more bang out of your point, you can overclock the CPU to 133Mhz and install more RAM. First the easier part, which is installing more RAM.

On the back of the Point 510 is a compartment which houses two slots for 72pin 3.3V EDO SODIMM Laptop RAM modules. Those a quite rare nowaydays but i found a store on Ebay that still sells them. They ship overseas, are totally nice and: it works! I ordered two 16MB modules and two 32MB modules just to try some combinations. Everything but the 32MB+32MB+8MB (builtin) combination worked. The 64MB would show up in the BIOS check, but the system wont continue to boot. So if one were to remove the internal 8MB, it might work. So my machine runs with 56MB (32MB+16MB+8MB).

bios point 510

Another intresting detail in the above image is the frequency of the AMD CPU beeing 133Mhz instead of 100Mhz. This can be achieved by a hardware modification.

Be warned, this should just show you how to do it, its not a garantuee that you wont break your device. All modifications are done at your own risk!

First of all, you need to disassemble the whole device. Its always good to remove the battery, harddrive and RAM, then loosen all screws (you will need torx and a phillips screwdriver) and then cautiously crack open the case. Some wire will be attaching the screen and the board, but they can be unplugged easily. The next step is to unmount the motherboard from the case since the CPU is on the other side underneath a silver heatdissipater, which you have to remove as well. You should see the following:

Point510 Board before modification
Point510 Board before modification

Now according to this Post, Pin11 of the CPU selects the frequency. If its high or undefined, the selektor will result in 100Mhz, but if its pulled to ground, it will result in 133Mhz. Luckily, the layout of the board already has a little slot for R7, which is not equipped but will connect Pin11 to ground. So the modification is rather simple. Just take the leg of a resistor (or some other wire), cut it to length, connect the two points of R7 and Pin11 will be grounded. My modification looks like this:

Point510 modification
Point510 modification

Before you reassemble the Point, try out if it still boots (hookup the screen and power). If it does: congratulations!

Since Windows98SE didnt quite fullfill my needs, installing Linux (some stripped down gentoo maybe) will be one of my future projects.

UPDATE: another modification i did was to take a cf-to-ide (2.5) adapter and plug it into the Point510, instead of the harddrive. Now its totally passive, should use less power and is of course much more quiet. works like a charm. maybe its even faster. The adapter can be also bought at ebay.

Links for Linux on the Point 510:

http://www.software-kombinat.de/linux-point510-resources.html

http://libxg.free.fr/point/point.htm

More Infos on the Point 510:

http://www.cncwebsite.com/computer/pt510.htm