[PATCH 1/2] hardy-lbm: bcm5974: remove dynamic quirks, instead post-install quirkline

Ben Collins ben.collins at canonical.com
Thu Jul 24 16:17:21 UTC 2008


On Thu, 2008-07-24 at 12:18 +0200, Henrik Rydberg wrote:
> This patch aims at resolving the problem of initializing
> the bcm5974 by installing a quirkline in /etc/modprobe.d/bcm5974,
> which makes usbhid ignore the trackpad.
> 
> The install/remove scripts are only added, not linked into
> postinst; hoping for some help to do it properly.

NACK in a few ways:

- Completely against policy. Creating files like this is just broken.
- Wont work on LiveCD installs since postinst is never run in this case.
- Causes linux-lbm to fail to install on systems where bcm5974 doesn't 
  exist.

Put the quirks in the code where it belongs. This is the wrong way to
handle this.

> Signed-off-by: Henrik Rydberg <rydberg at euromail.se>
> ---
>  debian/control-scripts/bcm5974-post-install |   71 +++++++++++++++++++++++++++
>  debian/control-scripts/bcm5974-post-remove  |   27 ++++++++++
>  updates/input/mouse/bcm5974.c               |   48 +------------------
>  3 files changed, 99 insertions(+), 47 deletions(-)
>  create mode 100755 debian/control-scripts/bcm5974-post-install
>  create mode 100755 debian/control-scripts/bcm5974-post-remove
> 
> diff --git a/debian/control-scripts/bcm5974-post-install b/debian/control-scripts/bcm5974-post-install
> new file mode 100755
> index 0000000..79d99c6
> --- /dev/null
> +++ b/debian/control-scripts/bcm5974-post-install
> @@ -0,0 +1,71 @@
> +#!/bin/bash
> +#
> +# bcm5943-post-install - post-installing the BCM5974
> +#
> +# Copyright (C) 2008	   Henrik Rydberg (rydberg at euromail.se)
> +#
> +# This program 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 program 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 program; if not, write to the Free Software
> +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
> +#
> +
> +DRIVER=bcm5974
> +ETCPATH=/etc/modprobe.d/$DRIVER
> +LSUSB=/usr/sbin/lsusb
> +
> +MANID=05ac
> +DEVID=
> +QUIRKID=
> +
> +# Macbook Air
> +MATCH[0]=0223; QUIRK[0]=00020800
> +MATCH[1]=0224; QUIRK[1]=00024800
> +MATCH[2]=0225; QUIRK[2]=00020800
> +# Macbook Pro Penryn
> +MATCH[3]=0230; QUIRK[3]=00020800
> +MATCH[4]=0231; QUIRK[4]=00024800
> +MATCH[5]=0232; QUIRK[5]=00020800
> +# End list
> +MATCH[6]=
> +
> +if [ -x $LSUSB ]; then
> +	typeset -i i=0
> +	while [ "${MATCH[$i]}" != "" ]; do
> +		if [ "`$LSUSB|grep ${MANID}:${MATCH[$i]}`" != "" ]; then
> +			DEVID=0x${MANID}:0x${MATCH[$i]}
> +			QUIRKID=0x${QUIRK[$i]}
> +	        fi
> +		i=$i+1
> +	done
> +else
> +	echo bcm5974: $LSUSB not found
> +	exit 1
> +fi
> +
> +if [ "$DEVID" = "" ]; then
> +	#echo No suitable device found
> +	exit 1
> +fi
> +
> +cat > $ETCPATH <<EOF
> +### Options for the bcm5974 driver
> +
> +## This line makes usbhid ignore the trackpad
> +options usbhid quirks=$DEVID:$QUIRKID
> +
> +## Debug level - uncomment this to get raw packets in /var/log/debug
> +#options bcm5974 debug=99
> +EOF
> +
> +exit 0
> +
> diff --git a/debian/control-scripts/bcm5974-post-remove b/debian/control-scripts/bcm5974-post-remove
> new file mode 100755
> index 0000000..f348e28
> --- /dev/null
> +++ b/debian/control-scripts/bcm5974-post-remove
> @@ -0,0 +1,27 @@
> +#!/bin/bash
> +#
> +# bcm5943-post-remove - post-removing the BCM5974
> +#
> +# Copyright (C) 2008	   Henrik Rydberg (rydberg at euromail.se)
> +#
> +# This program 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 program 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 program; if not, write to the Free Software
> +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
> +#
> +
> +DRIVER=bcm5974
> +ETCPATH=/etc/modprobe.d/$DRIVER
> +
> +rm -f $ETCPATH
> +
> +exit 0
> diff --git a/updates/input/mouse/bcm5974.c b/updates/input/mouse/bcm5974.c
> index c43fc0c..2b94835 100644
> --- a/updates/input/mouse/bcm5974.c
> +++ b/updates/input/mouse/bcm5974.c
> @@ -663,55 +663,9 @@ static struct usb_driver atp_driver = {
>  	.id_table = atp_table,
>  };
> 
> -#define USB_VENDOR_ID_APPLE		0x05ac
> -#define USB_DEVICE_ID_APPLE_WELLSPRING_ANSI   0x0223
> -#define USB_DEVICE_ID_APPLE_WELLSPRING_ISO    0x0224
> -#define USB_DEVICE_ID_APPLE_WELLSPRING_JIS    0x0225
> -#define USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI   0x0230
> -#define USB_DEVICE_ID_APPLE_WELLSPRING2_ISO    0x0231
> -#define USB_DEVICE_ID_APPLE_WELLSPRING2_JIS    0x0232
> -
> -static const struct hid_blacklist {
> -	__u16 idVendor;
> -	__u16 idProduct;
> -	__u32 quirks;
> -} hid_blacklist[] = {
> -	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ANSI, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
> -	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_APPLE_ISO_KEYBOARD | HID_QUIRK_IGNORE_MOUSE},
> -	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_JIS, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE},
> -	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE},
> -	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_APPLE_ISO_KEYBOARD | HID_QUIRK_IGNORE_MOUSE },
> -	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_JIS, HID_QUIRK_APPLE_HAS_FN  | HID_QUIRK_IGNORE_MOUSE },
> -	{0,0,0}
> -};
> -
> -static int __init atp_update_quirks(void)
> -{
> -	struct hid_blacklist *bp;
> -	int result=0;
> -	for (bp=hid_blacklist; bp->quirks; bp++)
> -	{
> -		result = usbhid_modify_dquirk(bp->idVendor,bp->idProduct,bp->quirks);
> -		if (result < 0)
> -		{
> -			dbg_hid("Could not modify quirk for %04x:%04x\n",bp->idVendor,bp->idProduct);
> -			break;
> -		}
> -	}
> -	return result;
> -}
> -
>  static int __init atp_init(void)
>  {
> -	int result;
> -
> -	/*
> -	 * Update the kernel quirk table for this device.
> -	 */
> -	result = atp_update_quirks();
> -	if (result >= 0)
> -		return usb_register(&atp_driver);
> -	return(result);
> +	return usb_register(&atp_driver);
>  }
> 
>  static void __exit atp_exit(void)
> -- 
> 1.5.4.3
> 
> 





More information about the kernel-team mailing list