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

Reply via email to