Nick Sanders | f8ff9e1 | 2011-02-08 16:39:31 -0800 | [diff] [blame] | 1 | # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 2 | # Use of this source code is governed by a BSD-style license that can be |
| 3 | # found in the LICENSE file. |
| 4 | |
Nick Sanders | f8ff9e1 | 2011-02-08 16:39:31 -0800 | [diff] [blame] | 5 | inherit eutils cros-binary |
| 6 | |
| 7 | # Synaptics touchpad generic eclass. |
| 8 | IUSE="is_touchpad ps_touchpad" |
| 9 | |
Puneet Kumar | 936af5d | 2011-02-25 18:59:10 -0800 | [diff] [blame] | 10 | RDEPEND="x11-base/xorg-server" |
Nick Sanders | f8ff9e1 | 2011-02-08 16:39:31 -0800 | [diff] [blame] | 11 | DEPEND="${RDEPEND}" |
| 12 | |
Dave Parker | 6892971 | 2011-04-04 18:28:16 -0700 | [diff] [blame] | 13 | # @ECLASS-VARIABLE: SYNAPTICS_TOUCHPAD_PN |
| 14 | # @DESCRIPTION: The packagename used as part of the binary tarball filename. |
| 15 | : ${SYNAPTICS_TOUCHPAD_PN:=${PN}} |
| 16 | |
Nick Sanders | f8ff9e1 | 2011-02-08 16:39:31 -0800 | [diff] [blame] | 17 | export_uri() { |
| 18 | local XORG_VERSION_STRING |
| 19 | local XORG_VERSION |
| 20 | local X_VERSION |
| 21 | |
| 22 | XORG_VERSION_STRING=$(grep "XORG_VERSION_CURRENT" "$ROOT/usr/include/xorg/xorg-server.h") |
| 23 | XORG_VERSION_STRING=${XORG_VERSION_STRING/#\#define*XORG_VERSION_CURRENT} |
| 24 | XORG_VERSION=$(($XORG_VERSION_STRING)) |
Puneet Kumar | c10ccd0 | 2011-08-04 10:56:03 -0700 | [diff] [blame] | 25 | |
| 26 | if [ $XORG_VERSION -ge 11100000 ]; then |
| 27 | X_VERSION=1.11 |
Stéphane Marchesin | 75bc1f3 | 2011-10-21 19:21:24 -0700 | [diff] [blame] | 28 | elif [ $XORG_VERSION -ge 11000000 ]; then |
Puneet Kumar | c10ccd0 | 2011-08-04 10:56:03 -0700 | [diff] [blame] | 29 | X_VERSION=1.10 |
| 30 | elif [ $XORG_VERSION -ge 10903000 ]; then |
Nick Sanders | f8ff9e1 | 2011-02-08 16:39:31 -0800 | [diff] [blame] | 31 | X_VERSION=1.9 |
| 32 | else |
| 33 | X_VERSION=1.7 |
| 34 | fi |
Puneet Kumar | f6342d6 | 2011-10-24 19:33:40 -0700 | [diff] [blame] | 35 | CROS_BINARY_URI="http://commondatastorage.googleapis.com/synaptics/${SYNAPTICS_TOUCHPAD_PN}-xorg-${X_VERSION}-${PV}-${PR}.tar.gz" |
Nick Sanders | f8ff9e1 | 2011-02-08 16:39:31 -0800 | [diff] [blame] | 36 | } |
| 37 | |
Mike Frysinger | fd47e82 | 2013-04-15 15:55:31 -0400 | [diff] [blame] | 38 | synaptics-touchpad_src_unpack() { |
Nick Sanders | f8ff9e1 | 2011-02-08 16:39:31 -0800 | [diff] [blame] | 39 | export_uri |
| 40 | cros-binary_src_unpack |
| 41 | } |
| 42 | |
Mike Frysinger | fd47e82 | 2013-04-15 15:55:31 -0400 | [diff] [blame] | 43 | synaptics-touchpad_src_install() { |
Nick Sanders | f8ff9e1 | 2011-02-08 16:39:31 -0800 | [diff] [blame] | 44 | # Currently you must have files/* in each ebuild that inherits |
| 45 | # from here. These files will go away soon after they are pushed |
| 46 | # into the synaptics tarball. |
| 47 | export_uri |
| 48 | cros-binary_src_install |
Andrew de los Reyes | 96055d0 | 2012-02-28 14:11:00 -0800 | [diff] [blame] | 49 | if [ $(ls "${D}" | wc -l) -eq 1 ]; then |
| 50 | local extra_dir="$(ls "${D}")" |
| 51 | mv "${D}/${extra_dir}/"* "${D}/" |
| 52 | rmdir "${D}/${extra_dir}/" |
| 53 | fi |
Nick Sanders | f8ff9e1 | 2011-02-08 16:39:31 -0800 | [diff] [blame] | 54 | |
Daniel Kurtz | 057d46e | 2012-01-06 02:18:19 +0800 | [diff] [blame] | 55 | exeinto /opt/Synaptics/bin |
| 56 | doexe "${FILESDIR}/tpcontrol_syncontrol" || die |
Nick Sanders | f8ff9e1 | 2011-02-08 16:39:31 -0800 | [diff] [blame] | 57 | |
Daniel Kurtz | 06b8123 | 2012-01-06 02:25:44 +0800 | [diff] [blame] | 58 | # If it exists, install synlogger to log calls to the Synaptics binaries. |
| 59 | # The original binaries themselves are appended with _bin, and symlinks are |
| 60 | # created with their original names that point at synlogger. |
| 61 | if [ -f "${FILESDIR}/synlogger" ]; then |
| 62 | doexe "${FILESDIR}/synlogger" || die |
| 63 | local f |
| 64 | for f in syn{control,detect,reflash} ; do |
| 65 | mv "${D}"/opt/Synaptics/bin/${f}{,_bin} || die |
| 66 | dosym synlogger /opt/Synaptics/bin/${f} || die |
| 67 | done |
| 68 | fi |
| 69 | |
Nick Sanders | f8ff9e1 | 2011-02-08 16:39:31 -0800 | [diff] [blame] | 70 | # link the appropriate config files for the type of trackpad |
| 71 | if use is_touchpad && use ps_touchpad; then |
| 72 | die "Specify only one type of touchpad" |
| 73 | elif use is_touchpad; then |
| 74 | dosym HKLM_Kernel_IS /opt/Synaptics/HKLM_Kernel || die |
| 75 | dosym HKLM_User_IS /opt/Synaptics/HKLM_User || die |
| 76 | elif use ps_touchpad; then |
| 77 | dosym HKLM_Kernel_PS /opt/Synaptics/HKLM_Kernel || die |
| 78 | dosym HKLM_User_PS /opt/Synaptics/HKLM_User || die |
| 79 | else |
| 80 | die "Type of touchpad not specified" |
| 81 | fi |
Nick Sanders | f8ff9e1 | 2011-02-08 16:39:31 -0800 | [diff] [blame] | 82 | } |