--- libkarma-0.0.6.orig/debian/control
+++ libkarma-0.0.6/debian/control
@@ -0,0 +1,76 @@
+Source: libkarma
+Priority: extra
+Maintainer: Joe Nahmias <jello@debian.org>
+Build-Depends: debhelper (>= 6), dpatch, zlib1g-dev, libtagc0-dev, libusb-dev
+Build-Depends-Indep: cli-common-dev (>= 0.4.4), mono-devel (>= 2.4.3)
+Standards-Version: 3.8.0
+Section: libs
+Homepage: http://www.freakysoft.de/html/libkarma/
+
+Package: libkarma-dev
+Section: libdevel
+Architecture: any
+Depends: libkarma0 (= ${binary:Version}), libtagc0-dev
+Description: Rio Karma access library [development files]
+ libkarma is a C language library that provides (read/write) access
+ to the Rio Karma music player using either the usb (with OMFS) or
+ network (PEARL) interface.
+ .
+ libkarma allows developers to do the following:
+ .
+   * login
+   * read, write and delete music or data files
+   * read and write file information
+   * write music or taxi files with one function, including setting
+     all metadata
+ .
+ This package contains the development files needed to compile
+ programs using the facilities provided by libkarma.
+
+Package: libkarma0
+Section: libs
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: Rio Karma access library [runtime files]
+ libkarma is a C language library that provides (read/write) access
+ to the Rio Karma music player using either the usb (with OMFS) or
+ network (PEARL) interface.
+ .
+ This package contains the runtime library needed by programs using
+ the facilities provided by libkarma.
+
+Package: karma-tools
+Section: utils
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: Rio Karma access library [tools]
+ Some basic utilities for use with the Rio Karma.  Includes:
+ .
+   * chprop
+   * karma_helper
+   * riocp
+
+Package: libkarma-cil
+Section: libs
+Architecture: all
+Depends: ${shlibs:Depends}, ${misc:Depends}, ${cli:Depends}
+Description: Rio Karma access library [CLI runtime library]
+ Also known as karma-sharp, this is a CLI library (.dll) that
+ provides (read/write) access to the Rio Karma music player using
+ either the usb (with OMFS) or network (PEARL) interface.
+ .
+ This package contains the runtime glue library needed by C# programs
+ using the facilities provided by libkarma.
+
+Package: libkarma-cil-dev
+Section: libs
+Architecture: all
+Depends: libkarma-cil (= ${binary:Version}), ${misc:Depends}
+Replaces: libkarma-cil (<< 0.0.6-4.3)
+Description: Rio Karma access library [CLI library development files]
+ Also known as karma-sharp, this is a CLI library (.dll) that
+ provides (read/write) access to the Rio Karma music player using
+ either the usb (with OMFS) or network (PEARL) interface.
+ .
+ This package contains development files for the karma-sharp library used for
+ compilation.
--- libkarma-0.0.6.orig/debian/libkarma-cil.install
+++ libkarma-0.0.6/debian/libkarma-cil.install
@@ -0,0 +1 @@
+usr/lib/karma-sharp/*
--- libkarma-0.0.6.orig/debian/compat
+++ libkarma-0.0.6/debian/compat
@@ -0,0 +1 @@
+6
--- libkarma-0.0.6.orig/debian/karma-tools.manpages
+++ libkarma-0.0.6/debian/karma-tools.manpages
@@ -0,0 +1 @@
+debian/tmp/usr/share/man/man?/*
--- libkarma-0.0.6.orig/debian/rules
+++ libkarma-0.0.6/debian/rules
@@ -0,0 +1,101 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# This file was originally written by Joey Hess and Craig Small.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+# Include patch, unpatch rules for dpatch
+include /usr/share/dpatch/dpatch.make
+
+CFLAGS = -Wall -g
+
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+	CFLAGS += -O0
+else
+	CFLAGS += -O2
+endif
+export CFLAGS
+
+PREFIX=/usr
+export PREFIX
+
+# Set MONO_SHARED_DIR per CLI Policy §4.3
+export MONO_SHARED_DIR=$(CURDIR)
+
+build: build-arch
+build-arch: patch
+	dh_testdir
+	$(MAKE) libkarma tools
+	touch $@
+build-indep: patch
+	dh_testdir
+	$(MAKE) karma-sharp MCS=/usr/bin/mono-csc
+	touch $@
+
+clean: clean-patched unpatch
+clean-patched:
+	dh_testdir
+	dh_testroot
+	rm -f build-arch build-indep
+	[ ! -f Makefile ] || $(MAKE) clean
+	rm -rf $(MONO_SHARED_DIR)/.wapi
+	dh_clean
+
+install: build install-arch install-indep
+install-arch: build-arch
+	dh_testdir
+	dh_testroot
+	dh_installdirs
+	cd src && $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install VERSION=0.0.6
+	cd tools && $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install VERSION=0.0.6
+install-indep: build-indep
+	dh_testdir
+	dh_testroot
+	dh_installdirs
+	cd karma-sharp && $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install VERSION=0.0.6
+
+binary-indep: export DH_OPTIONS := -i
+binary-indep: build-indep install-indep
+	dh_testdir
+	dh_testroot
+	dh_installchangelogs ChangeLog
+	dh_installdocs
+	dh_installexamples
+	dh_install --sourcedir=debian/tmp
+	dh_installman
+	dh_link
+	dh_strip
+	dh_compress
+	dh_fixperms
+	dh_clifixperms
+	dh_makeshlibs
+	dh_installdeb
+	dh_shlibdeps -L libkarma0 -l debian/libkarma0/usr/lib
+	dh_clideps -d
+	dh_gencontrol
+	dh_md5sums
+	dh_builddeb
+
+binary-arch: export DH_OPTIONS := -a
+binary-arch: build-arch install-arch
+	dh_testdir
+	dh_testroot
+	dh_installchangelogs ChangeLog
+	dh_installdocs
+	dh_installexamples
+	dh_install --sourcedir=debian/tmp
+	dh_installman
+	dh_link
+	dh_strip
+	dh_compress
+	dh_fixperms
+	dh_makeshlibs
+	dh_installdeb
+	dh_shlibdeps -L libkarma0 -l debian/libkarma0/usr/lib
+	dh_gencontrol
+	dh_md5sums
+	dh_builddeb
+
+binary: binary-arch binary-indep
+.PHONY: build clean-patched clean binary-indep binary-arch binary install-arch install-indep install
--- libkarma-0.0.6.orig/debian/libkarma-dev.install
+++ libkarma-0.0.6/debian/libkarma-dev.install
@@ -0,0 +1,3 @@
+usr/include/libkarma/*
+usr/lib/lib*.a
+usr/lib/lib*.so
--- libkarma-0.0.6.orig/debian/libkarma-cil-dev.install
+++ libkarma-0.0.6/debian/libkarma-cil-dev.install
@@ -0,0 +1 @@
+usr/lib/pkgconfig/*
--- libkarma-0.0.6.orig/debian/watch
+++ libkarma-0.0.6/debian/watch
@@ -0,0 +1,11 @@
+# Example watch control file for uscan
+# Rename this file to "watch" and then you can run the "uscan" command
+# to check for upstream updates and more.
+# See uscan(1) for format
+
+# Compulsory line, this is a version 3 file
+version=3
+
+# Uncomment to examine a Webpage 
+# <Webpage URL> <string match>
+http://www.freakysoft.de/html/libkarma/ libkarma-(.*)\.tar\.gz
--- libkarma-0.0.6.orig/debian/karma-tools.examples
+++ libkarma-0.0.6/debian/karma-tools.examples
@@ -0,0 +1 @@
+tools/create_device-settings
--- libkarma-0.0.6.orig/debian/changelog
+++ libkarma-0.0.6/debian/changelog
@@ -0,0 +1,102 @@
+libkarma (0.0.6-4.5) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * debian/control, debian/rules: Move mono-devel back from Build-Depends to
+    Build-Depends-Indep to allow libkarma to build on non-mono arches. Also
+    make build depend on build-arch so that the bindings aren't built on all
+    buildds. (Closes: #520862)
+  * debian/control: Bump minimum version on mono-devel BDI to 2.4.3 and remove
+    BDs on all packages provided by mono source package.
+
+ -- Iain Lane <laney@ubuntu.com>  Sat, 17 Apr 2010 21:01:06 +0100
+
+libkarma (0.0.6-4.4) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * tools/karma_helper.c:
+    + Only call usb_detach_kernel_driver_np() on Linux (Closes: #567693)
+      (Thanks to Petr Salinger <Petr.Salinger@seznam.cz>)
+
+ -- Jo Shields <directhex@apebox.org>  Mon, 12 Apr 2010 12:34:43 +0100
+
+libkarma (0.0.6-4.3) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * debian/control:
+    + Bump mono-devel version to 2.4.2.3 for mono-csc
+    + Create -cil-dev package containing pcfiles
+  * debian/rules:
+    + Use MCS=/usr/bin/mono-csc instead of /usr/bin/csc (Closes: #562259)
+    + Add VERSION=0.0.6 to karma-sharp $(MAKE) invocations to ensure
+      Version: field of .pc file is populated (Closes: #551049)
+
+ -- Chow Loong Jin <hyperair@ubuntu.com>  Thu, 21 Jan 2010 19:31:18 +0800
+
+libkarma (0.0.6-4.2) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Fix FTBFS on buildds: Move mono-devel from B-D-I to B-D as suggested
+    by Peter Green, thanks! (Closes: #520862).
+
+ -- Cyril Brulebois <kibi@debian.org>  Mon, 07 Dec 2009 06:20:39 +0100
+
+libkarma (0.0.6-4.1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * debian/control:
+    + Updated build-deps on Mono as part of the Mono 2.0 transistion.
+      (thanks goes to James Westby for providing a patch)
+  * debian/rules:
+    + Override C# compiler variable.
+
+ -- Mirco Bauer <meebey@debian.org>  Sat, 21 Mar 2009 14:28:30 +0100
+
+libkarma (0.0.6-4) unstable; urgency=low
+
+  * Ack NMU, closes: #458681, #423260, #459271.
+  * Bump std-ver to 3.8.0, moved Homepage header to source section.
+  * Bump debhelper compat to 6, no changes.
+  * debian/rules: fix clean up of ./.wapi directory
+  * debian/rules: split build & install targets into -arch and -indep
+  * Improve tool manpages
+
+ -- Joe Nahmias <jello@debian.org>  Fri, 27 Jun 2008 12:42:15 -0400
+
+libkarma (0.0.6-3.1) unstable; urgency=low
+
+  * Non-Maintainer upload.
+  * debian/control:
+    + Build depend on libmono2.0-cil (Closes: #458681).
+  * debian/patches/05_add_karma-sharp_dllmap.dpatch:
+    + Fix bashisms to fix build with dash (Closes: #423260).
+      Thanks to Andrea Veri for the patch.
+  * debian/patches/80_gmcs.dpatch:
+    + Build with gmcs to only get 2.0 dependencies as the only depending
+      package, banshee, already uses 2.0 and this will get use less
+      dependencies (Closes: #459271).
+
+ -- Sebastian Dröge <slomo@debian.org>  Sat, 05 Jan 2008 08:04:30 +0100
+
+libkarma (0.0.6-3) unstable; urgency=low
+
+  * Set MONO_SHARED_DIR per CLI Policy §4.3, closes: #445798.
+
+ -- Joe Nahmias <jello@debian.org>  Tue, 16 Oct 2007 00:06:48 -0400
+
+libkarma (0.0.6-2) unstable; urgency=low
+
+  * Since libkarma-cil is managed code (c#) it should be arch:all.
+
+ -- Joe Nahmias <jello@debian.org>  Sun, 14 Jan 2007 18:06:44 -0500
+
+libkarma (0.0.6-1) unstable; urgency=low
+
+  * Initial release, closes: #317173.
+  * Added debian/watch file.
+  * Wrote manpages for riocp, chprop, and karma_helper.
+  * Install playlist_show as an example in libkarma-dev.
+  * Install create_device-settings as an example in karma-tools.
+  * Build karma-sharp dll for use with banshee.
+
+ -- Joe Nahmias <jello@debian.org>  Mon,  8 Jan 2007 22:13:43 -0500
+
--- libkarma-0.0.6.orig/debian/copyright
+++ libkarma-0.0.6/debian/copyright
@@ -0,0 +1,40 @@
+This package was debianized by Joe Nahmias <jello@debian.org> on
+Mon,  1 Jan 2007 07:17:35 +0000.
+
+It was downloaded from http://www.freakysoft.de/html/libkarma/.
+
+Upstream Author: Frank Zschockelt <libkarma@freakysoft.de>
+
+Copyright:
+ * Copyright (c) Christophe Devine 2001-2003
+ * Copyright (c) Cedric Tefft <cedric@earthling.net> 2000-2001
+ * Copyright (c) Enrique Vidal <evidal@iti.upv.es> 2004-2006
+ * Copyright (c) Frank Zschockelt <libkarma@freakysoft.de> 2004-2006
+ * Copyright (c) Keith Bennett <keith@mcs.st-and.ac.uk> 2006
+ * Copyright (c) Michael R. Elkins <me@mutt.org> 1996-2000
+ * Copyright (c) Nicolas Justin+Gregrory Kokanosky 2004
+ * Copyright (c) Paul van der Mark <pmark@liacs.nl> ???? *
+ * Copyright (c) ams@wiw.org (Abhijit Menon-Sen) 1998.
+
+
+License:
+
+   This package is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This package is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this package; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+
+On Debian systems, the complete text of the GNU General
+Public License can be found in `/usr/share/common-licenses/GPL'.
+
+The Debian packaging is (C) 2007, Joe Nahmias <jello@debian.org> and
+is licensed under the GPL, see above.
--- libkarma-0.0.6.orig/debian/libkarma0.install
+++ libkarma-0.0.6/debian/libkarma0.install
@@ -0,0 +1 @@
+usr/lib/lib*.so.*
--- libkarma-0.0.6.orig/debian/karma-tools.install
+++ libkarma-0.0.6/debian/karma-tools.install
@@ -0,0 +1 @@
+usr/bin/*
--- libkarma-0.0.6.orig/debian/patches/60_fix_prop_count_off_by_ones.dpatch
+++ libkarma-0.0.6/debian/patches/60_fix_prop_count_off_by_ones.dpatch
@@ -0,0 +1,64 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 60_fix_prop_count_off_by_ones.dpatch by  <jello@debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: No description.
+
+@DPATCH@
+diff -urNad libkarma-0.0.6~/src/properties.c libkarma-0.0.6/src/properties.c
+--- libkarma-0.0.6~/src/properties.c	2006-11-11 13:57:43.000000000 -0500
++++ libkarma-0.0.6/src/properties.c	2007-01-14 22:53:59.000000000 -0500
+@@ -344,7 +344,7 @@
+         return -1;
+     }
+ 
+-    for(i=0,j=16; i<props.count-1; j++) {
++    for(i=0,j=16; i<props.count; j++) {
+         if(props.fidTable[j]){
+             buf=lk_properties_export(j*16);
+             write(fd, buf, strlen(buf));
+@@ -517,7 +517,7 @@
+     offset_16 = (uint16_t *) offset;
+ 
+     if (type == SDB_BLOB || type == SDB_STRING) {
+-        for(i=0,j=16,off=0; i<props.count-1; j++) {
++        for(i=0,j=16,off=0; i<props.count; j++) {
+             if(!props.fidTable[j]) continue;
+             str = lk_properties_get_property(j*16,attr);
+             if (str) {
+@@ -612,7 +612,7 @@
+             }
+         }
+     } else if (type == SDB_LE32) {
+-        for(i=0,j=16; i<props.count-1; j++) {
++        for(i=0,j=16; i<props.count; j++) {
+             if(!props.fidTable[j]) continue;
+             str = lk_properties_get_property(j*16,attr);
+             if(!str)
+@@ -623,7 +623,7 @@
+         }
+         fwrite(offset, i*sizeof(uint32_t), 1, fp);
+     } else if (type == SDB_LE16) {
+-        for(i=0,j=16; i<props.count-1; j++) {
++        for(i=0,j=16; i<props.count; j++) {
+             if(!props.fidTable[j]) continue;
+             str = lk_properties_get_property(j*16,attr);
+             if(!str)
+@@ -634,7 +634,7 @@
+         }
+         fwrite(offset_16, i*sizeof(uint16_t), 1, fp);
+     } else if (type == SDB_CHAR) {
+-        for(i=0,j=16; i<props.count-1; j++) {
++        for(i=0,j=16; i<props.count; j++) {
+             if(!props.fidTable[j]) continue;
+             str = lk_properties_get_property(j*16,attr);
+             if(!str)
+@@ -695,7 +695,7 @@
+ 
+ int lk_properties_write_smalldb(char *usbMountPoint, karma_db_t *db)
+ {
+-    uint32_t i, len, arrsz, nfiles = props.count-1;
++    uint32_t i, len, arrsz, nfiles = props.count;
+     uint32_t ret = 0;
+     uint32_t *offset = NULL;
+     table_t *table = NULL;
--- libkarma-0.0.6.orig/debian/patches/15_install_docs.dpatch
+++ libkarma-0.0.6/debian/patches/15_install_docs.dpatch
@@ -0,0 +1,46 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 15_install_docs.dpatch by Joe Nahmias <jello@debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Install upstream documentation files.
+
+@DPATCH@
+diff -urNad libkarma-0.0.6~/Makefile libkarma-0.0.6/Makefile
+--- libkarma-0.0.6~/Makefile	2007-01-08 22:53:41.000000000 -0500
++++ libkarma-0.0.6/Makefile	2007-01-08 22:55:57.000000000 -0500
+@@ -1,6 +1,7 @@
+ LK_SRC=src
+ TOOLSDIR=tools
+ PREFIX?=/usr/local
++INSTALL?=./install-sh
+ VERSION=0.0.6
+ 
+ export PREFIX
+@@ -12,6 +13,12 @@
+ 	karma-sharp/{Makefile,karma-sharp.pc.in,Song.cs,Device.cs} \
+ 	Jamfile Makefile COPYING ChangeLog THANKS INSTALL TODO \
+ 	install-sh karma-tools.spec
++DOCS=THANKS TODO ChangeLog
++
++INSTALL_DIR     := $(INSTALL) -d -o root -g root -m 0755
++INSTALL_FILE    := $(INSTALL)    -o root -g root -m 0644
++INSTALL_PROGRAM := $(INSTALL)    -o root -g root -m 0755 # -s
++INSTALL_SCRIPT  := $(INSTALL)    -o root -g root -m 0755
+ 
+ all: libkarma tools karma-sharp
+ 
+@@ -19,11 +26,14 @@
+ 	cd $(LK_SRC) && $(MAKE) install
+ 	cd karma-sharp && $(MAKE) install
+ 	cd tools && $(MAKE) install
++	$(INSTALL_DIR) $(DESTDIR)/$(PREFIX)/share/doc/libkarma
++	$(INSTALL_FILE) $(DOCS) $(DESTDIR)/$(PREFIX)/share/doc/libkarma
+ 
+ uninstall: 
+ 	cd $(LK_SRC) && $(MAKE) uninstall
+ 	cd karma-sharp && $(MAKE) uninstall
+ 	cd tools && $(MAKE) uninstall
++	rm -rf $(DESTDIR)/$(PREFIX)/share/doc/libkarma
+ 
+ libkarma: FORCE
+ 	cd $(LK_SRC) && $(MAKE)
--- libkarma-0.0.6.orig/debian/patches/80_gmcs.dpatch
+++ libkarma-0.0.6/debian/patches/80_gmcs.dpatch
@@ -0,0 +1,14 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## DP: Use gmcs rather than mcs
+@DPATCH@
+
+--- libkarma-0.0.6/karma-sharp/Makefile.old	2008-01-05 07:59:32.000000000 +0100
++++ libkarma-0.0.6/karma-sharp/Makefile	2008-01-05 07:59:49.000000000 +0100
+@@ -1,6 +1,6 @@
+ ASSEMBLY_SOURCES=Song.cs Device.cs
+ ASSEMBLY_RESOURCES=
+-MCS=$(shell which mcs)
++MCS=$(shell which gmcs)
+ MCS_FLAGS = -debug
+ 
+ ifeq ($(MCS),)
--- libkarma-0.0.6.orig/debian/patches/00list
+++ libkarma-0.0.6/debian/patches/00list
@@ -0,0 +1,13 @@
+01_use_DESTDIR
+05_add_karma-sharp_dllmap
+06_fix_shlib_build_and_install
+08_dynamically_link_tools
+15_install_docs
+20_install_playlist_show_as_example
+25_tool_manpages
+50_add_write_smalldb_debug_info
+51_fix_dmap_and_playlist_counts
+52_check_for_upload_errors
+60_fix_prop_count_off_by_ones
+70_fix_prop-write-smalldb_retval
+80_gmcs.dpatch
--- libkarma-0.0.6.orig/debian/patches/70_fix_prop-write-smalldb_retval.dpatch
+++ libkarma-0.0.6/debian/patches/70_fix_prop-write-smalldb_retval.dpatch
@@ -0,0 +1,47 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 70_fix_prop-write-smalldb_retval.dpatch by  <jello@debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: No description.
+
+@DPATCH@
+diff -urNad libkarma-0.0.6~/src/properties.c libkarma-0.0.6/src/properties.c
+--- libkarma-0.0.6~/src/properties.c	2007-01-14 15:42:40.000000000 -0500
++++ libkarma-0.0.6/src/properties.c	2007-01-14 15:44:57.000000000 -0500
+@@ -738,9 +738,11 @@
+         goto err;
+ 
+     if (db->num_attribs == 0)
++    {
+         ret = smalldb_init(db);
+-    if (ret)
+-        goto err;
++        if (ret)
++            goto err;
++    }
+ 
+     db->ctime = (int) time(NULL);
+     fwrite(&db->version, sizeof(uint32_t), 1, fp);
+@@ -793,18 +795,15 @@
+ 
+     fwrite(&db->ctime, sizeof(uint32_t), 1, fp);
+     fclose(fp);
+-
+-    if (arr) free(arr);
+-    if (offset) free(offset);
+-    if (table) free(table);
+-
+-    return 0;
++    goto out;
+ 
+ err:
++    ret = 1;
++out:
+     if (arr) free(arr);
+     if (offset) free(offset);
+     if (table) free(table);
+     if (tmp) free(tmp);
+ 
+-    return 1;
++    return ret;
+ }
--- libkarma-0.0.6.orig/debian/patches/06_fix_shlib_build_and_install.dpatch
+++ libkarma-0.0.6/debian/patches/06_fix_shlib_build_and_install.dpatch
@@ -0,0 +1,70 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 06_fix_shlib_build_and_install.dpatch by Joe Nahmias <jello@debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Fix building and installation of shared lib.
+
+@DPATCH@
+diff -urNad libkarma-0.0.6~/src/Makefile libkarma-0.0.6/src/Makefile
+--- libkarma-0.0.6~/src/Makefile	2007-01-08 23:29:46.000000000 -0500
++++ libkarma-0.0.6/src/Makefile	2007-01-08 23:37:20.000000000 -0500
+@@ -11,19 +11,23 @@
+ CC=gcc
+ AR=ar
+ RANLIB=ranlib
++LN_S?=ln -s
+ 
+ CFLAGS+=-fPIC -D_REENTRANT -Wall -pedantic
+ CFLAGS+=-ggdb -W -Wchar-subscripts -Wmissing-prototypes 
+ CFLAGS+=-Wmissing-declarations -Wno-switch -Wredundant-decls -Wno-unused
++MAJOR:=$(firstword $(subst ., ,$(VERSION)))
+ 
+ default: all
+ 
+-install:
++install: shared-lib-stamp static-lib-stamp
+ 	../install-sh -m 0755 -d $(DESTDIR)/$(PREFIX)/lib
+ 	../install-sh -m 0755 -d $(DESTDIR)/$(PREFIX)/include
+ 	../install-sh -m 0755 -d $(DESTDIR)/$(PREFIX)/include/libkarma
+ 	../install-sh -m 0644 -t $(DESTDIR)/$(PREFIX)/lib/ $(LIBDIR)/$(TARGET).a
+-	../install-sh -m 0755 -t $(DESTDIR)/$(PREFIX)/lib/ $(LIBDIR)/$(TARGET).so
++	../install-sh -m 0755 -t $(DESTDIR)/$(PREFIX)/lib/ $(LIBDIR)/$(TARGET).so.$(VERSION)
++	$(LN_S) $(TARGET).so.$(VERSION) $(DESTDIR)/$(PREFIX)/lib/$(TARGET).so.$(MAJOR)
++	$(LN_S) $(TARGET).so.$(VERSION) $(DESTDIR)/$(PREFIX)/lib/$(TARGET).so
+ 	../install-sh -m 0644 -t $(DESTDIR)/$(PREFIX)/include/libkarma/ $(INST_HEADERS)
+ 
+ uninstall:
+@@ -35,16 +39,28 @@
+ $(LIBDIR):
+ 	@[ -d $(LIBDIR) ] || mkdir $(LIBDIR) > /dev/null 2>&1
+ 
+-$(TARGET): $(OBJS) $(LIBDIR)
++$(LIBDIR)/$(TARGET).a: $(OBJS) $(LIBDIR)
+ 	$(AR) r $(LIBDIR)/$(TARGET).a $(OBJS)
+ 	$(RANLIB) $(LIBDIR)/$(TARGET).a
+ 
+-shared: $(OBJS) $(LIBDIR)
+-	$(CC) -shared $(OBJS) $(CFLAGS) -o $(LIBDIR)/$(TARGET).so -ltag_c
++$(LIBDIR)/$(TARGET).so.$(VERSION): $(OBJS) $(LIBDIR)
++	$(CC) -shared -Wl,-soname,$(TARGET).so.$(MAJOR) $(OBJS) $(CFLAGS) -o $(LIBDIR)/$(TARGET).so.$(VERSION) -ltag_c
+ 
+-all: $(TARGET) shared
++$(LIBDIR)/$(TARGET).so.$(MAJOR): $(LIBDIR)/$(TARGET).so.$(VERSION) $(LIBDIR)
++	$(LN_S) $(TARGET).so.$(VERSION) $(LIBDIR)/$(TARGET).so.$(MAJOR)
++
++$(LIBDIR)/$(TARGET).so: $(LIBDIR)/$(TARGET).so.$(VERSION) $(LIBDIR)
++	$(LN_S) $(TARGET).so.$(VERSION) $(LIBDIR)/$(TARGET).so
++
++shared-lib-stamp: $(LIBDIR)/$(TARGET).so.$(VERSION) $(LIBDIR)/$(TARGET).so.$(MAJOR) $(LIBDIR)/$(TARGET).so
++	touch $@
++
++static-lib-stamp: $(LIBDIR)/$(TARGET).a
++	touch $@
++
++all: static-lib-stamp shared-lib-stamp
+ 
+ .PHONY: clean
+ 
+ clean:
+-	rm -rf $(OBJS) $(LIBDIR)/ 
++	rm -rf $(OBJS) $(LIBDIR)/ static-lib-stamp shared-lib-stamp
--- libkarma-0.0.6.orig/debian/patches/51_fix_dmap_and_playlist_counts.dpatch
+++ libkarma-0.0.6/debian/patches/51_fix_dmap_and_playlist_counts.dpatch
@@ -0,0 +1,28 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 51_fix_dmap_and_playlist_counts.dpatch by  <jello@debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: No description.
+
+@DPATCH@
+diff -urNad libkarma-0.0.6~/src/karmaUsb.c libkarma-0.0.6/src/karmaUsb.c
+--- libkarma-0.0.6~/src/karmaUsb.c	2007-01-14 13:00:53.000000000 -0500
++++ libkarma-0.0.6/src/karmaUsb.c	2007-01-14 15:33:33.000000000 -0500
+@@ -741,8 +741,6 @@
+     }
+     *ptr = '\0';
+     *properties = tmp;
+-    db->dmap_size = 0;
+-    db->num_playlists = 0;
+ 
+   out:
+     ret = 0;
+@@ -755,6 +753,8 @@
+         free(prop_strs);
+     if (db)
+     {
++        db->dmap_size = 0;
++        db->num_playlists = 0;
+         if (db->dmap)
+             free(db->dmap);
+         if (db->playlists)
--- libkarma-0.0.6.orig/debian/patches/01_use_DESTDIR.dpatch
+++ libkarma-0.0.6/debian/patches/01_use_DESTDIR.dpatch
@@ -0,0 +1,98 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 01_use_DESTDIR.dpatch by Joe Nahmias <jello@debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Make everything install into DESTDIR.
+
+@DPATCH@
+diff -urNad libkarma-0.0.6~/Makefile libkarma-0.0.6/Makefile
+--- libkarma-0.0.6~/Makefile	2007-01-08 23:50:43.000000000 -0500
++++ libkarma-0.0.6/Makefile	2007-01-08 23:54:42.000000000 -0500
+@@ -1,6 +1,6 @@
+ LK_SRC=src
+ TOOLSDIR=tools
+-PREFIX=/usr/local
++PREFIX?=/usr/local
+ VERSION=0.0.6
+ 
+ export PREFIX
+diff -urNad libkarma-0.0.6~/karma-sharp/Makefile libkarma-0.0.6/karma-sharp/Makefile
+--- libkarma-0.0.6~/karma-sharp/Makefile	2007-01-08 23:53:02.000000000 -0500
++++ libkarma-0.0.6/karma-sharp/Makefile	2007-01-08 23:54:42.000000000 -0500
+@@ -26,18 +26,18 @@
+ 
+ ifdef HAS_MONO
+ install: $(ASSEMBLY) karma-sharp.pc
+-	../install-sh -d $(PREFIX)/lib/karma-sharp
+-	../install-sh -d $(PREFIX)/lib/pkgconfig
+-	../install-sh -t $(PREFIX)/lib/karma-sharp $(ASSEMBLY)
+-	../install-sh -t $(PREFIX)/lib/pkgconfig -m 0644 karma-sharp.pc
++	../install-sh -d $(DESTDIR)/$(PREFIX)/lib/karma-sharp
++	../install-sh -d $(DESTDIR)/$(PREFIX)/lib/pkgconfig
++	../install-sh -t $(DESTDIR)/$(PREFIX)/lib/karma-sharp $(ASSEMBLY)
++	../install-sh -t $(DESTDIR)/$(PREFIX)/lib/pkgconfig -m 0644 karma-sharp.pc
+ else
+ install:
+ 
+ endif
+ 
+ uninstall: FORCE
+-	$(RM) -r $(PREFIX)/lib/karma-sharp
+-	$(RM) $(PREFIX)/lib/pkgconfig/karma-sharp.pc
++	$(RM) -r $(DESTDIR)/$(PREFIX)/lib/karma-sharp
++	$(RM) $(DESTDIR)/$(PREFIX)/lib/pkgconfig/karma-sharp.pc
+ 
+ $(ASSEMBLY): $(ASSEMBLY_SOURCES) $(ASSEMBLY_RESOURCES)
+ 	$(MCS) $(MCS_FLAGS) -unsafe -target:library -out:$@ $(ASSEMBLY_SOURCES) $(ASSEMBLY_RESOURCES:%=-resource:%) -r:Mono.Posix
+diff -urNad libkarma-0.0.6~/src/Makefile libkarma-0.0.6/src/Makefile
+--- libkarma-0.0.6~/src/Makefile	2007-01-08 23:50:43.000000000 -0500
++++ libkarma-0.0.6/src/Makefile	2007-01-08 23:56:52.000000000 -0500
+@@ -19,21 +19,21 @@
+ default: all
+ 
+ install:
+-	../install-sh -m 0755 -d $(PREFIX)/lib
+-	../install-sh -m 0755 -d $(PREFIX)/include
+-	../install-sh -m 0755 -d $(PREFIX)/include/libkarma
+-	../install-sh -m 0644 -t $(PREFIX)/lib/ $(LIBDIR)/$(TARGET).a
+-	../install-sh -m 0755 -t $(PREFIX)/lib/ $(LIBDIR)/$(TARGET).so
+-	../install-sh -m 0644 -t $(PREFIX)/include/libkarma/ $(INST_HEADERS)
++	../install-sh -m 0755 -d $(DESTDIR)/$(PREFIX)/lib
++	../install-sh -m 0755 -d $(DESTDIR)/$(PREFIX)/include
++	../install-sh -m 0755 -d $(DESTDIR)/$(PREFIX)/include/libkarma
++	../install-sh -m 0644 -t $(DESTDIR)/$(PREFIX)/lib/ $(LIBDIR)/$(TARGET).a
++	../install-sh -m 0755 -t $(DESTDIR)/$(PREFIX)/lib/ $(LIBDIR)/$(TARGET).so
++	../install-sh -m 0644 -t $(DESTDIR)/$(PREFIX)/include/libkarma/ $(INST_HEADERS)
+ 
+ uninstall:
+-	$(RM) $(PREFIX)/lib/$(TARGET).a $(PREFIX)/lib/$(TARGET).so*
+-	$(RM) -r $(PREFIX)/include/libkarma
++	$(RM) $(DESTDIR)/$(PREFIX)/lib/$(TARGET).a $(DESTDIR)/$(PREFIX)/lib/$(TARGET).so*
++	$(RM) -r $(DESTDIR)/$(PREFIX)/include/libkarma
+ 
+ OBJS = $(SRCS:.c=.o)
+ 
+ $(LIBDIR):
+-	@[ -d $(LIBDIR) ] || mkdir $(LIBDIR) > /dev/null 2>&1
++	@[ -d $(LIBDIR) ] || mkdir -p $(LIBDIR) > /dev/null 2>&1
+ 
+ $(TARGET): $(OBJS) $(LIBDIR)
+ 	$(AR) r $(LIBDIR)/$(TARGET).a $(OBJS)
+diff -urNad libkarma-0.0.6~/tools/Makefile libkarma-0.0.6/tools/Makefile
+--- libkarma-0.0.6~/tools/Makefile	2007-01-08 23:50:43.000000000 -0500
++++ libkarma-0.0.6/tools/Makefile	2007-01-08 23:54:42.000000000 -0500
+@@ -27,11 +27,11 @@
+ 	$(CC) $(INCLUDES) $(CFLAGS) $@.c -o $@ -lusb
+ 
+ install:
+-	../install-sh -m 0755 -d $(PREFIX)/bin
+-	../install-sh -m 0755 -t $(PREFIX)/bin/ $(TOOLS)
++	../install-sh -m 0755 -d $(DESTDIR)/$(PREFIX)/bin
++	../install-sh -m 0755 -t $(DESTDIR)/$(PREFIX)/bin/ $(TOOLS)
+ 
+ uninstall:
+-	cd $(PREFIX)/bin && $(RM) $(TOOLS)
++	cd $(DESTDIR)/$(PREFIX)/bin && $(RM) $(TOOLS)
+ 
+ .PHONY: clean
+ 
--- libkarma-0.0.6.orig/debian/patches/20_install_playlist_show_as_example.dpatch
+++ libkarma-0.0.6/debian/patches/20_install_playlist_show_as_example.dpatch
@@ -0,0 +1,24 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 20_install_playlist_show_as_example.dpatch by Joe Nahmias <jello@debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Install playlist_show tool as an example, rather than a user tool.
+
+@DPATCH@
+diff -urNad libkarma-0.0.6~/debian/libkarma-dev.examples libkarma-0.0.6/debian/libkarma-dev.examples
+--- libkarma-0.0.6~/debian/libkarma-dev.examples	1969-12-31 19:00:00.000000000 -0500
++++ libkarma-0.0.6/debian/libkarma-dev.examples	2007-01-01 18:48:48.000000000 -0500
+@@ -0,0 +1 @@
++tools/playlist_show.c
+diff -urNad libkarma-0.0.6~/tools/Makefile libkarma-0.0.6/tools/Makefile
+--- libkarma-0.0.6~/tools/Makefile	2007-01-09 00:03:43.000000000 -0500
++++ libkarma-0.0.6/tools/Makefile	2007-01-09 00:05:15.000000000 -0500
+@@ -9,7 +9,7 @@
+ LDFLAGS+=-ltag_c -lz -L $(LIBDIR)
+ 
+ OBJS=$(SRCS:.c=.o)
+-TOOLS=riocp chprop playlist_show karma_helper
++TOOLS=riocp chprop karma_helper
+ 
+ default: $(TOOLS)
+ all: $(TOOLS)
--- libkarma-0.0.6.orig/debian/patches/25_tool_manpages.dpatch
+++ libkarma-0.0.6/debian/patches/25_tool_manpages.dpatch
@@ -0,0 +1,307 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 25_tool_manpages.dpatch by Joe Nahmias <jello@debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Create manpages for chprop, karma_helper, and riocp user tools.
+
+@DPATCH@
+diff -urNad libkarma-0.0.6~/tools/Makefile libkarma-0.0.6/tools/Makefile
+--- libkarma-0.0.6~/tools/Makefile	2008-06-27 12:30:46.000000000 -0400
++++ libkarma-0.0.6/tools/Makefile	2008-06-27 12:30:46.000000000 -0400
+@@ -10,6 +10,7 @@
+ 
+ OBJS=$(SRCS:.c=.o)
+ TOOLS=riocp chprop karma_helper
++MANPAGES=riocp.1 chprop.1 karma_helper.1
+ 
+ default: $(TOOLS)
+ all: $(TOOLS)
+@@ -29,9 +30,12 @@
+ install:
+ 	../install-sh -m 0755 -d $(DESTDIR)/$(PREFIX)/bin
+ 	../install-sh -m 0755 -t $(DESTDIR)/$(PREFIX)/bin/ $(TOOLS)
++	../install-sh -m 0755 -d $(DESTDIR)/$(PREFIX)/share/man/man1
++	../install-sh -m 0755 -t $(DESTDIR)/$(PREFIX)/share/man/man1 $(MANPAGES)
+ 
+ uninstall:
+ 	cd $(DESTDIR)/$(PREFIX)/bin && $(RM) $(TOOLS)
++	$(RM) $(addprefix $(DESTDIR)/$(PREFIX)/share/man/man1/, $(MANPAGES))
+ 
+ .PHONY: clean
+ 
+diff -urNad libkarma-0.0.6~/tools/chprop.1 libkarma-0.0.6/tools/chprop.1
+--- libkarma-0.0.6~/tools/chprop.1	1969-12-31 19:00:00.000000000 -0500
++++ libkarma-0.0.6/tools/chprop.1	2008-06-27 12:31:23.000000000 -0400
+@@ -0,0 +1,51 @@
++.\"                                      Hey, EMACS: -*- nroff -*-
++.\" First parameter, NAME, should be all caps
++.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
++.\" other parameters are allowed: see man(7), man(1)
++.TH CHPROP 1 "January  1, 2007"
++.\" Please adjust this date whenever revising the manpage.
++.\"
++.\" Some roff macros, for reference:
++.\" .nh        disable hyphenation
++.\" .hy        enable hyphenation
++.\" .ad l      left justify
++.\" .ad b      justify to both left and right margins
++.\" .nf        disable filling
++.\" .fi        enable filling
++.\" .br        insert line break
++.\" .sp <n>    insert n+1 empty lines
++.\" for manpage-specific macros, see man(7)
++.SH NAME
++chprop \- change file properties on the Rio Karma
++.SH SYNOPSIS
++.B chprop
++.BI "-a " hostname/ip
++.RI [ -p " " password ]
++.I fid key value
++.SH DESCRIPTION
++This manual page documents briefly the
++.B chprop
++command.
++.PP
++\fBchprop\fP is a program that changes properties of files on the Rio Karma.
++.SH OPTIONS
++A summary of options is included below.
++.TP
++.B \-a \fIhost/IP\fP
++Set access location of Rio Karma.  Can be either a hostname or IP address for
++network access; or a path in the filesystem where the Rio Karma is mounted for
++USB access.
++.TP
++.B \-h
++Show summary of options.
++.TP
++.B \-p \fIpassword\fP
++Password for accessing the Rio Karma via the network.
++.SH SEE ALSO
++.\" .BR bar (1),
++.BR riocp (1).
++.SH AUTHOR
++chprop was written by Frank Zschockelt <libkarma@freakysoft.de>.
++.PP
++This manual page was written by Joe Nahmias <jello@debian.org>,
++for the Debian project (but may be used by others).
+diff -urNad libkarma-0.0.6~/tools/karma_helper.1 libkarma-0.0.6/tools/karma_helper.1
+--- libkarma-0.0.6~/tools/karma_helper.1	1969-12-31 19:00:00.000000000 -0500
++++ libkarma-0.0.6/tools/karma_helper.1	2008-06-27 12:30:46.000000000 -0400
+@@ -0,0 +1,68 @@
++.\"                                      Hey, EMACS: -*- nroff -*-
++.\" First parameter, NAME, should be all caps
++.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
++.\" other parameters are allowed: see man(7), man(1)
++.TH KARMA_HELPER 1 "June 27, 2008"
++.\" Please adjust this date whenever revising the manpage.
++.\"
++.\" Some roff macros, for reference:
++.\" .nh        disable hyphenation
++.\" .hy        enable hyphenation
++.\" .ad l      left justify
++.\" .ad b      justify to both left and right margins
++.\" .nf        disable filling
++.\" .fi        enable filling
++.\" .br        insert line break
++.\" .sp <n>    insert n+1 empty lines
++.\" for manpage-specific macros, see man(7)
++.SH NAME
++karma_helper \- adjusts the state of the Rio Karma
++.SH SYNOPSIS
++.B karma_helper
++.RI [ options ] " files" ...
++.SH DESCRIPTION
++This manual page documents briefly the
++.B karma_helper
++command.
++.PP
++.\" TeX users may be more comfortable with the \fB<whatever>\fP and
++.\" \fI<whatever>\fP escape sequences to invode bold face and italics, 
++.\" respectively.
++\fBkarma_helper\fP is a program that sends USB commands to the Rio Karma to
++modify its state.
++.SH OPTIONS
++A summary of options is included below.
++.TP
++.B \-b
++Bind driver to device.
++.TP
++.B \-e
++Enter storage mode.
++.TP
++.B \-h
++Show summary of options.
++.TP
++.B \-i
++Retrieve device information string.
++.TP
++.B \-l
++Leave storage mode.
++.TP
++.B \-r
++Reset device (leave "Finished" screen).
++.TP
++.B \-t
++Update time.
++.TP
++.B \-u
++Unbind driver from device.
++.SH NOTES
++karma_helper requires root priveliges to directly access the USB layer and send
++most of the available commands.
++.SH SEE ALSO
++.BR riocp (1).
++.SH AUTHOR
++karma_helper was written by Frank Zschockelt <libkarma@freakysoft.de>.
++.PP
++This manual page was written by Joe Nahmias <jello@debian.org>,
++for the Debian project (but may be used by others).
+diff -urNad libkarma-0.0.6~/tools/riocp.1 libkarma-0.0.6/tools/riocp.1
+--- libkarma-0.0.6~/tools/riocp.1	1969-12-31 19:00:00.000000000 -0500
++++ libkarma-0.0.6/tools/riocp.1	2008-06-27 12:30:46.000000000 -0400
+@@ -0,0 +1,145 @@
++.\"                                      Hey, EMACS: -*- nroff -*-
++.\" First parameter, NAME, should be all caps
++.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
++.\" other parameters are allowed: see man(7), man(1)
++.TH RIOCP 1 "June 27, 2008"
++.\" Please adjust this date whenever revising the manpage.
++.\"
++.\" Some roff macros, for reference:
++.\" .nh        disable hyphenation
++.\" .hy        enable hyphenation
++.\" .ad l      left justify
++.\" .ad b      justify to both left and right margins
++.\" .nf        disable filling
++.\" .fi        enable filling
++.\" .br        insert line break
++.\" .sp <n>    insert n+1 empty lines
++.\" for manpage-specific macros, see man(7)
++.SH NAME
++riocp \- program to transfer files to and from the Rio Karma
++.SH SYNOPSIS
++.B riocp
++.RI [ options ] " files_to_upload" ...
++.SH DESCRIPTION
++This manual page documents briefly the \fBriocp\fP command.
++.PP
++\fBriocp\fP is a program that searches for and lists files on the Rio Karma.
++It also allows the user to transfer files to and from the device.
++.SH OPTIONS
++A summary of options is included below.
++.TP
++.BR "\-a " { \fIpath\fP | \fIhostname\fP | \fIIP-ADDR\fP }
++Set access location of Rio Karma.  Can be either a hostname or IP address for
++network access; or a path in the filesystem where the Rio Karma is mounted for
++USB access.
++.TP
++.B \-b
++Get database by scanning *1 files, instead of smalldb.
++.TP
++.B \-c \fIcharset\fP
++Set codeset to use when communicating with the Rio Karma.
++.TP
++.B \-D \fIdummyName\fP
++Use \fIdummyName\fP for missing or empty props.
++Default if not set is '\fI-UnKnown-\fP'.
++.TP
++.B \-d
++Download the files searched for with "\fB-s\fP".
++.TP
++.B \-e \fIset1\fP \fIset2\fP \fIset3\fP
++Edit the download pathname using \fIset1\fP and \fIset2\fP as in unix \fBtr\fP.
++If \fIset3\fP is empty (""): just translate as in \fBtr\fP;
++otherwise, further delete all chars given in \fIset3\fP.
++.TP
++.B \-F
++Use filenames in \fB~/.openrio/.../__libkarma_fdb__.gz\fP for download.
++.TP
++.B \-f
++Force the files to be written even if they are dupes.
++.TP
++.B \-H
++Download files listed in \fB~/.openrio/.../__libkarma_fdb__.gz\fP
++that match the current hostname.
++.TP
++.B \-h
++Show summary of options.
++.TP
++.B \-l \fIprops\fP
++Like \fB-u\fP for \fItype\fP='\fBplaylist\fP'.  The default is to use whatever
++is set for \fB-u\fP.
++.TP
++.B \-p \fIpassWord\fP
++Password for accessing the Rio Karma via the network.
++.TP
++.B \-q
++Squeeze repeated chars (given in "\fIset2\fP" of \fB-e\fP),
++after the optional delete.
++.TP
++.B \-R
++Same as \fB-r\fP, but do not ask for confirmation.
++.TP
++.B \-r
++Remove these files (after the optional download).
++.TP
++.B \-s \fIsearchString\fP
++Search karma DB according to \fIsearchString\fP.
++\fIsearchString\fP syntax: \fIproperty\fP=\fIsearchStr\fP[{,|+}...], where:
++.RS
++.PP
++- \fIsearchStr\fP is a substring of the \fIproperty\fP value
++(see \fB~/.openrio/*/fileinfo\fP for possible \fIproperty\fP names)
++.PP
++- '\fB,\fP' and '\fB+\fP' mean AND and OR, respectively
++.PP
++- each AND/OR operator is applied to the previous search results
++.RE
++.TP
++.B \-U \fIfdb.gz\fP
++Upload files listed in the given \fIfdb.gz\fP file.
++.TP
++.B \-u \fIprops\fP
++Use properties to build download path for \fItype\fP=\fBtune\fP.
++"\fIprops\fP" are formating strings (as in "\fBprintf\fP"), where:
++.RS
++.PP
++.B %a
++.RI "= " Artist
++.PP
++.B %c
++.RI "= " Codec
++.PP
++.B %f
++.RI "= " fid
++.PP
++.B %g
++.RI "= " Genre
++.PP
++.B %n
++.RI "= " "Track Number"
++.PP
++.B %s
++.RI "= " Source
++.PP
++.B %T
++.RI "= " Type
++.PP
++.B %t
++.RI "= " Title
++.PP
++The default is "\fI%f.%c\fP".
++.RE
++.TP
++.B \-w
++Don't rewrite the smalldb database file.
++.TP
++.B \-x \fIprops\fP
++Like \fB-u\fP for \fItype\fP='\fBtaxi\fP'. The default is to use whatever is
++set for \fB-u\fP.
++.SH SEE ALSO
++.BR printf (3),
++.BR tr (1).
++.SH AUTHOR
++riocp was written by Frank Zschockelt <libkarma@freakysoft.de>.
++.PP
++This manual page was written by Joe Nahmias <jello@debian.org>,
++for the Debian project (but may be used by others).
--- libkarma-0.0.6.orig/debian/patches/08_dynamically_link_tools.dpatch
+++ libkarma-0.0.6/debian/patches/08_dynamically_link_tools.dpatch
@@ -0,0 +1,42 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 08_dynamically_link_tools.dpatch by Joe Nahmias <jello@debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Link user tools to libkarma dynamically instead of statically.
+
+@DPATCH@
+diff -urNad libkarma-0.0.6~/tools/Makefile libkarma-0.0.6/tools/Makefile
+--- libkarma-0.0.6~/tools/Makefile	2007-01-08 23:13:50.000000000 -0500
++++ libkarma-0.0.6/tools/Makefile	2007-01-08 23:15:36.000000000 -0500
+@@ -1,12 +1,12 @@
+ INCLUDES=-I../src
+ LIBDIR=../lib
+-LIBKARMA=$(LIBDIR)/libkarma.a
++LIBKARMA=$(LIBDIR)/libkarma.so
+ 
+ SRCS=pathedit.c
+ 
+ CC=gcc
+ CFLAGS+=-Wall -pedantic
+-LDFLAGS+=-ltag_c -lz
++LDFLAGS+=-ltag_c -lz -L $(LIBDIR)
+ 
+ OBJS=$(SRCS:.c=.o)
+ TOOLS=riocp chprop playlist_show karma_helper
+@@ -15,13 +15,13 @@
+ all: $(TOOLS)
+ 
+ riocp: riocp.c $(OBJS) $(LIBKARMA)
+-	$(CC) $(INCLUDES) $(LDFLAGS) $(CFLAGS) $@.c -o $@ $(OBJS) $(LIBKARMA)
++	$(CC) $(INCLUDES) $(LDFLAGS) $(CFLAGS) $@.c -o $@ $(OBJS) -lkarma
+ 
+ chprop: chprop.c $(LIBKARMA)
+-	$(CC) $(INCLUDES) $(LDFLAGS) $(CFLAGS) $@.c -o $@ $(LIBKARMA)
++	$(CC) $(INCLUDES) $(LDFLAGS) $(CFLAGS) $@.c -o $@ -lkarma
+ 
+ playlist_show: playlist_show.c $(LIBKARMA)
+-	$(CC) $(INCLUDES) $(LDFLAGS) $(CFLAGS) $@.c -o $@ $(LIBKARMA)
++	$(CC) $(INCLUDES) $(LDFLAGS) $(CFLAGS) $@.c -o $@ -lkarma
+ 
+ karma_helper: karma_helper.c
+ 	$(CC) $(INCLUDES) $(CFLAGS) $@.c -o $@ -lusb
--- libkarma-0.0.6.orig/debian/patches/50_add_write_smalldb_debug_info.dpatch
+++ libkarma-0.0.6/debian/patches/50_add_write_smalldb_debug_info.dpatch
@@ -0,0 +1,24 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 50_add_write_smalldb_debug_info.dpatch by  <jello@debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: No description.
+
+@DPATCH@
+diff -urNad libkarma-0.0.6~/src/karmaUsb.c libkarma-0.0.6/src/karmaUsb.c
+--- libkarma-0.0.6~/src/karmaUsb.c	2007-01-14 13:00:53.000000000 -0500
++++ libkarma-0.0.6/src/karmaUsb.c	2007-01-14 14:36:21.000000000 -0500
+@@ -933,7 +933,12 @@
+ /* -------------------------------------------------------------------------- */
+ int lk_karmaUsb_write_smalldb(void)
+ {
+-    return lk_properties_write_smalldb(usbMountPoint, db);
++    int val = 0;
++
++    errno = 0;
++    val = lk_properties_write_smalldb(usbMountPoint, db);
++    perror("lk_karmaUsb_write_smalldb()");
++    return val;
+ }
+ 
+ /* -------------------------------------------------------------------------- */
--- libkarma-0.0.6.orig/debian/patches/05_add_karma-sharp_dllmap.dpatch
+++ libkarma-0.0.6/debian/patches/05_add_karma-sharp_dllmap.dpatch
@@ -0,0 +1,30 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 05_add_karma-sharp_DLLmap.dpatch by Joe Nahmias <jello@debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Add dllmap for karma-sharp.dll to find libkarma.
+
+@DPATCH@
+diff -urNad libkarma-0.0.6~/karma-sharp/karma-sharp.dll.config libkarma-0.0.6/karma-sharp/karma-sharp.dll.config
+--- libkarma-0.0.6~/karma-sharp/karma-sharp.dll.config	1969-12-31 19:00:00.000000000 -0500
++++ libkarma-0.0.6/karma-sharp/karma-sharp.dll.config	2007-01-08 22:37:39.000000000 -0500
+@@ -0,0 +1,3 @@
++<configuration>
++<dllmap dll="karma" target="libkarma.so.0" />
++</configuration>
+diff -urNad libkarma-0.0.6~/karma-sharp/Makefile libkarma-0.0.6/karma-sharp/Makefile
+--- libkarma-0.0.6~/karma-sharp/Makefile	2007-01-08 23:00:11.000000000 -0500
++++ libkarma-0.0.6/karma-sharp/Makefile	2007-01-08 23:00:54.000000000 -0500
+@@ -25,10 +25,10 @@
+ 	karma-sharp.pc.in > karma-sharp.pc
+ 
+ ifdef HAS_MONO
+-install: $(ASSEMBLY) karma-sharp.pc
++install: $(ASSEMBLY) karma-sharp.pc $(ASSEMBLY).config
+ 	../install-sh -d $(DESTDIR)/$(PREFIX)/lib/karma-sharp
+ 	../install-sh -d $(DESTDIR)/$(PREFIX)/lib/pkgconfig
+-	../install-sh -t $(DESTDIR)/$(PREFIX)/lib/karma-sharp $(ASSEMBLY)
++	../install-sh -t $(DESTDIR)/$(PREFIX)/lib/karma-sharp $(ASSEMBLY) $(ASSEMBLY).config
+ 	../install-sh -t $(DESTDIR)/$(PREFIX)/lib/pkgconfig -m 0644 karma-sharp.pc
+ else
+ install:
--- libkarma-0.0.6.orig/debian/patches/52_check_for_upload_errors.dpatch
+++ libkarma-0.0.6/debian/patches/52_check_for_upload_errors.dpatch
@@ -0,0 +1,19 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 52_check_for_upload_errors.dpatch by  <jello@debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: No description.
+
+@DPATCH@
+diff -urNad libkarma-0.0.6~/karma-sharp/Device.cs libkarma-0.0.6/karma-sharp/Device.cs
+--- libkarma-0.0.6~/karma-sharp/Device.cs	2006-11-11 13:57:43.000000000 -0500
++++ libkarma-0.0.6/karma-sharp/Device.cs	2007-01-14 15:37:22.000000000 -0500
+@@ -119,7 +119,7 @@
+             foreach (string filename in filesToAdd) {
+                 int fid = lk_rio_write(rio_id, filename);
+ 
+-                if (ProgressChanged != null) {
++                if (ProgressChanged != null && fid > 0) {
+                     ProgressChanged(new Song(fid));
+                 }
+             }
