Bug 144547 - Added Logitech DiNovo Laser support to bluez-utils-2.25
Bug#: 144547 Product:  Gentoo Linux Version: unspecified Platform: All
OS/Version: Linux Status: RESOLVED Severity: enhancement Priority: P2
Resolution: FIXED Assigned To: liquidx@gentoo.org Reported By: brucebertrand@juno.com
Component: Ebuilds
URL: 
Summary: Added Logitech DiNovo Laser support to bluez-utils-2.25
Keywords:  
Status Whiteboard: 
Opened: 2006-08-20 12:28 0000
Description:   Opened: 2006-08-20 12:28 0000
Here's a new ebuild and patch to add support for  Logitech's DiNovo Media
Desktop Laser to bluez-utils-2.25.

This might not be needed with 2.3, but as its not in portage yet...


-------
ebuild
-------

# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header:
/var/cvsroot/gentoo-x86/net-wireless/bluez-utils/bluez-utils-2.25-r2.ebuild,v
1.5 2006-08-20 15:26:44 brucebertrand Exp $

inherit eutils

DESCRIPTION="Bluetooth Tools and System Daemons for Linux"
HOMEPAGE="http://bluez.sourceforge.net/"
SRC_URI="http://bluez.sourceforge.net/download/${P}.tar.gz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~hppa ppc sparc x86"

IUSE="alsa cups dbus gtk pcmcia udev dinovo-mdl"

RDEPEND="!net-wireless/bluez-pan
                >=net-wireless/bluez-libs-2.25
                dev-libs/libusb
                alsa? ( >=media-libs/alsa-lib-1.0.9 )
                cups? ( net-print/cups )
                dbus? ( >=sys-apps/dbus-0.31 )
                gtk? ( >=dev-python/pygtk-2.2 )
                pcmcia? ( virtual/pcmcia
                                  sys-apps/setserial )
                udev? ( sys-fs/udev )"
DEPEND="sys-devel/bison
                sys-devel/flex
                >=sys-apps/sed-4
                ${RDEPEND}"

src_unpack() {
        unpack ${A}

        if use dinovo-mdl; then
                epatch ${FILESDIR}/${PN}-2.25-dinovo-mdl.patch
        fi

        sed -i \
                -e "s:^HIDD_ENABLE=.*:HIDD_ENABLE=false:" \
                -e "s:^HID2HCI_ENABLE=.*:HID2HCI_ENABLE=false:" \
                -e "s:^\(# Start dund.*\)$:\1\n# If you want to use dund, you
must install\: net-dialup/ppp .:" \
                ${S}/scripts/bluetooth.default

        sed -i \
                -e "s:security .*;:security user;:" \
                ${S}/hcid/hcid.conf

        if use gtk; then
                sed -i -e "s:\(pin_helper \).*:\1/usr/bin/bluepin;:" \
                        ${S}/hcid/hcid.conf
        else
                sed -i -e "s:\(pin_helper \).*:\1/etc/bluetooth/pin-helper;:" \
                        ${S}/hcid/hcid.conf
        fi

        # fix cups-1.2
        sed -i -e "s:\$(libdir)/cups:$(cups-config --serverbin):"
${S}/cups/Makefile.{am,in}
}

src_compile() {
        econf \
                $(use_enable alsa) \
                $(use_enable cups) \
                $(use_enable dbus) \
                $(use_enable pcmcia) \
                $(use_enable gtk bluepin) \
                --enable-avctrl \
                --enable-bcm203x \
                --enable-dfutool \
                --enable-hid2hci \
                --enable-obex \
                --disable-initscripts \
                --localstatedir=/var \
                || die "econf failed"

        emake || die "emake failed"
}

src_install() {
        make DESTDIR="${D}" install || die "make install failed"

        dodoc AUTHORS ChangeLog README

        # optional bluetooth utils
        cd ${S}/tools
        dosbin bccmd hcisecfilter ppporc pskey

        exeinto /etc/bluetooth
        newexe ${FILESDIR}/${PN}-2.24-pin-helper.sh pin-helper

        insinto /etc/bluetooth
        newins ${FILESDIR}/${PN}-2.24-pin pin
        fperms 0600 /etc/bluetooth/pin

        newinitd ${FILESDIR}/${PN}-2.25-init.d bluetooth
        newconfd ${S}/scripts/bluetooth.default bluetooth

        # If we are compiled with dbus support then we kinda need it
        if use dbus ; then
                sed -i 's/after dbus/need dbus/g' "${D}"/etc/init.d/bluetooth
        fi

        # bug #103498
        if use pcmcia; then
                fperms 755 /etc/pcmcia/bluetooth
        fi

        # bug #84431
        if use udev; then
                insinto /etc/udev/rules.d/
                newins ${FILESDIR}/${PN}-2.24-udev.rules 70-bluetooth.rules

                exeinto /lib/udev/
                newexe ${FILESDIR}/${PN}-2.24-udev.script bluetooth.sh
        fi
}

pkg_postinst() {
        einfo
        einfo "A startup script has been installed in /etc/init.d/bluetooth."
        einfo
        einfo "If you need to set a default PIN, edit /etc/bluetooth/pin, and
change"
        einfo "/etc/bluetooth/hcid.conf option 'pin_helper' to
/etc/bluetooth/pin-helper."
        einfo

        if use gtk; then
                einfo "By default, /usr/bin/bluepin will be launched on the
desktop display"
                einfo "for pin number input."
                einfo
        fi

        if use udev; then
                einfo "You need to run 'udevstart' or reboot for the udev rules
to take effect."
                einfo
        fi
}


-------
patch
-------

--- bluez-utils-2.25/tools/hid2hci.c    2006-01-07 21:03:06.000000000 -0500
+++ bluez-utils-2.25/tools/hid2hci.c    2006-08-20 14:55:02.229086000 -0400
@@ -221,7 +221,9 @@
        { HCI, 0x046d, 0xc703, switch_logitech },
        { HCI, 0x046d, 0xc704, switch_logitech },
        { HCI, 0x046d, 0xc705, switch_logitech },
-       { HCI, 0x046d, 0x0b02, switch_logitech },       /* Logitech diNovo
Media Desktop Laser */
+       { HCI, 0x046d, 0x0b02, switch_logitech }, /* Logitech diNovo Media
Desktop Laser */
+       { HCI, 0x046d, 0xc70c, switch_logitech }, /* Logitech diNovo Media
Desktop Laser */
+       { HCI, 0x046d, 0xc70b, switch_logitech }, /* Logitech diNovo Media
Desktop Laser */
        { -1 }
 };

------- Comment #1 From Bruce Bertrand 2006-08-20 12:31:37 0000 -------
Created an attachment (id=94718) [details]
ebuild for DiNovo MDL support

needs the patch

------- Comment #2 From Bruce Bertrand 2006-08-20 12:32:34 0000 -------
Created an attachment (id=94720) [details]
Patch for DiNovo MDL support

Put it in 'files' 

------- Comment #3 From Bruce Bertrand 2006-08-20 12:34:41 0000 -------
Also, sorry about the text versions of the ebuild and patch in the first post. 
Didn't realize I'd be able to attach the files.

------- Comment #4 From Michael Hanselmann (hansmi) (RETIRED) 2006-08-20 12:50:05 0000 -------
Sorry, but why should I care? Or why did you add me to Cc:?

------- Comment #5 From Bruce Bertrand 2006-08-20 14:59:29 0000 -------
You're listed as the most recent maintainer of bluez-utils-2.25-r1

------- Comment #6 From Michael Hanselmann (hansmi) (RETIRED) 2006-08-21 01:52:29 0000 -------
(In reply to comment #5)
> You're listed as the most recent maintainer of bluez-utils-2.25-r1

I marked it stable on ppc. That's not the same as maintaining an ebuild. The
maintainer is liquidx, as stated in metadata.xml.

Heck, I do not even own Bluetooth hardware.

------- Comment #7 From Alastair Tse (RETIRED) 2006-08-22 03:44:51 0000 -------
Bruce, don't mind hansmi, just that some devs get irritated when they get bugs
assigned to them by users who shouldn't be doing the assigning.

Have you forwarded this upstream to the bluez people?

------- Comment #8 From Olivier Crete 2006-11-18 00:16:05 0000 -------
Created an attachment (id=102241) [details]
patch from upstream

this patch is from upstream CVS.
Please apply this patch to the 2.25 ebuild.
And while you are at it, would be nice to add version 3.7 of bluez-utils with
the new d-bus stuff.

------- Comment #9 From Olivier Crete 2007-01-15 00:17:57 0000 -------
I added the patch to the CVS