# -*- shell-script -*-

# 01adapter_defs - Basic definitions for adapters.

# (C) Copyright IBM Corp. 2002, 2003, 2004, 2005

# Maintained by Martin Schwenke <martins@au.ibm.com>

# This file is part of the Linux lsvpd package.

# 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, 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.
    
# $Id: 01adapter_defs,v 1.6 2005/05/13 03:34:24 martins Exp $

true || return 0

######################################################################

make_multiplexed adapter_set_ds

adapter_set_ds_DEFAULT ()
{
    # Sets: ds

    local type="$1"
    local adapter_bus_dir="$2"
    local adapter_is_a_channel="$3"

    case "$type" in
	(scsi)     ds="SCSI I/O Controller"         ;;
	(ethernet) ds="Ethernet PCI Adapter"        ;;
	(ide)      ds="IDE I/O Controller"          ;;
	(usb)      ds="USB Host Controller"         ;;
	(display)  ds="Display Adapter"             ;;
	(serial)   ds="Serial Adapter"              ;;
	(sound)    ds="Multimedia Audio Controller" ;;
	(*)        ds="Unknown Adapter"             ;;
    esac

    $adapter_is_a_channel && ds="${ds} Channel"
}

######################################################################

# These will never be overridden, so using multiplexing is wasteful.

adapter_set_output_prefix ()
{
    type="$1"

    case "$type" in
	(scsi)     output_prefix="scsi"        ;;
	(ethernet) output_prefix="eth"         ;;
	(ide)      output_prefix="ide"         ;;
	(usb)      output_prefix="usb"         ;;
	(display)  output_prefix="disp"        ;;
	(serial)   output_prefix="sa"          ;;
	(sound)    output_prefix="sound"       ;;
	(*)        output_prefix="${type:0:4}" ;;
    esac
}

adapter_set_os_prefix ()
{
    type="$1"

    case "$type" in
	(scsi) os_prefix="host"    ;;
	*)
	    local output_prefix
	    adapter_set_output_prefix "$type"
	    os_prefix="$output_prefix"
    esac
}

adapter_set_adapter_subdir ()
{
    type="$1"

    case "$type" in
	(ethernet) adapter_subdir="net"    ;;
	*)
	    local output_prefix
	    adapter_set_output_prefix "$type"
	    adapter_subdir="$output_prefix"
    esac
}

adapter_set_minimum_unknown ()
{
    type="$1"

    case "$type" in
	(display|serial|sound) minimum_unknown=0   ;;
	(*)                    minimum_unknown=500 ;;
    esac
}

