Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b7780ce4 authored by Darin Petkov's avatar Darin Petkov
Browse files

Remove obsolete hardware_class script.

BUG=chromium-os:15257
TEST=emerge-x86-mario metrics

Change-Id: I496121c47394dc81b7f414655940dddc8d5cc992
Reviewed-on: http://gerrit.chromium.org/gerrit/1314


Tested-by: default avatarDarin Petkov <petkov@chromium.org>
Reviewed-by: default avatarChris Sosa <sosa@chromium.org>
parent 817016a8
Loading
Loading
Loading
Loading

metrics/hardware_class

deleted100755 → 0
+0 −76
Original line number Original line Diff line number Diff line
#!/bin/sh

# Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# This script prints the hardware class (e.g., the hardware
# qualification ID) of this device, or "unknown" if it can't determine
# the hardware class.

# TODO(petkov): If the hardware qualification ID is not available on
# the systems, the script uses alternative ways to identify different
# system classes (e.g., the WiFi adapter PCI vendor and device
# IDs). Switch the script to use only real hardware qualification ID
# when that becomes available on all systems.

HARDWARE_CLASS=
readonly HWID_PATH=/sys/bus/platform/devices/chromeos_acpi/HWID

# Appends a new component ID to the hardware class. Separates IDs with
# dashes.
append_class() {
  [ -n "$1" ] || return
  [ -n "$HARDWARE_CLASS" ] && HARDWARE_CLASS="${HARDWARE_CLASS}-"
  HARDWARE_CLASS="${HARDWARE_CLASS}$1"
}

hwid() {
  [ -r  "$HWID_PATH" ] || return
  local acpihwid
  acpihwid=$(cat "$HWID_PATH")
  [ -n "$acpihwid" ] || return
  append_class "$acpihwid"
}

# Adds the CPU family, model and stepping info, if available, to the
# class.
cpu() {
  [ -r /proc/cpuinfo ] || return
  local family
  family=$(grep -m1 '^cpu family' /proc/cpuinfo \
    | sed 's/cpu family\s\+:\s\+\([0-9]\+\)$/\1/')
  local model
  model=$(grep -m1 '^model' /proc/cpuinfo \
    | sed 's/model\s\+:\s\+\([0-9]\+\)$/\1/')
  local stepping
  stepping=$(grep -m1 '^stepping' /proc/cpuinfo \
    | sed 's/stepping\s\+:\s\+\([0-9]\+\)$/\1/')
  if [ -n "$family" ] && [ -n "$model" ] && [ -n "$stepping" ]; then
    append_class "cpu/$family:$model:$stepping"
  fi
}

# Adds the wlan0 PCI vendor and device ID, if available, to the class.
wlan() {
  local dev=/sys/class/net/wlan0/device
  if [ -r $dev/vendor ] && [ -r $dev/device ]; then
    local id
    id=$(paste -d ':' $dev/vendor $dev/device | sed s/0x//g)
    append_class "wlan0/$id"
  fi
}

main() {
  hwid
  # If the HWID is not available, use system component IDs.
  if [ -z "$HARDWARE_CLASS" ]; then
    cpu
    wlan
    [ -z "$HARDWARE_CLASS" ] && HARDWARE_CLASS=unknown
  fi

  echo $HARDWARE_CLASS
}

main $@