---------- Forwarded message ----------
From: Petter Reinholdtsen <p...@hungry.com>
Date: Sun, Aug 25, 2013 at 2:29 PM
Subject: [Freedombox-discuss] Add dreamplug-detect script?
To: freedombox-discuss@lists.alioth.debian.org


Hi.

To make it easier for scripts in packages to know if the current
environment is a dreamplug or not, I suggest we provide a
/sbin/dreamplug-detect script for this purpose.  This script should
work, but might not be robust enough:

#!/bin/sh
#
# Return true if running on a dreamplug, and false otherwise.
#
# Currently look for an armel machine with USB devices with IDS
# 0d8c:000c and 05e3:0726.  Perhaps a better way exist?
# Based on details from <URL: https://wiki.debian.org/DreamPlugTesting >

case $(dpkg --print-architecture) in
     armel)
        audiofound=false
        sdcardreaderfound=false
        for modalias in $(find /sys -name modalias -exec cat '{}' \;) ; do
            case $modalias in
                usb:v0D8Cp000Cd*) # C-Media Electronics, Inc. Audio Adapter
                    audiofound=true
                    ;;
                usb:v05E3p0726d*) # Genesys Logic, Inc. SD Card Reader
                    sdcardreaderfound=true
                    ;;
                esac
        done
        if $audiofound && $sdcardreaderfound ; then
            return 0
        fi
        return 1
        ;;
    *)
        return 1
        ;;
esac

Any objections?  Suggestions for better implementation?

--
Happy hacking
Petter Reinholdtsen

_______________________________________________
Freedombox-discuss mailing list
Freedombox-discuss@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/freedombox-discuss



-- 
*"Anything created must necessarily be inferior to the essence of the
creator."
-- Claude Shouse (sho...@macomw.arpa)
"Einstein's mother must have been one heck of a physicist."
-- Joseph C. Wang (j...@athena.mit.edu)

*
_______________________________________________
Freedombox-discuss mailing list
Freedombox-discuss@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/freedombox-discuss

Reply via email to