<div dir="ltr"><br><br><div class="gmail_quote">---------- Forwarded message ----------<br>From: <b class="gmail_sendername">Petter Reinholdtsen</b> <span dir="ltr"><<a href="mailto:pere@hungry.com">pere@hungry.com</a>></span><br>
Date: Sun, Aug 25, 2013 at 2:29 PM<br>Subject: [Freedombox-discuss] Add dreamplug-detect script?<br>To: <a href="mailto:freedombox-discuss@lists.alioth.debian.org">freedombox-discuss@lists.alioth.debian.org</a><br><br><br>
Hi.<br>
<br>
To make it easier for scripts in packages to know if the current<br>
environment is a dreamplug or not, I suggest we provide a<br>
/sbin/dreamplug-detect script for this purpose.  This script should<br>
work, but might not be robust enough:<br>
<br>
#!/bin/sh<br>
#<br>
# Return true if running on a dreamplug, and false otherwise.<br>
#<br>
# Currently look for an armel machine with USB devices with IDS<br>
# 0d8c:000c and 05e3:0726.  Perhaps a better way exist?<br>
# Based on details from <URL: <a href="https://wiki.debian.org/DreamPlugTesting" target="_blank">https://wiki.debian.org/DreamPlugTesting</a> ><br>
<br>
case $(dpkg --print-architecture) in<br>
     armel)<br>
        audiofound=false<br>
        sdcardreaderfound=false<br>
        for modalias in $(find /sys -name modalias -exec cat '{}' \;) ; do<br>
            case $modalias in<br>
                usb:v0D8Cp000Cd*) # C-Media Electronics, Inc. Audio Adapter<br>
                    audiofound=true<br>
                    ;;<br>
                usb:v05E3p0726d*) # Genesys Logic, Inc. SD Card Reader<br>
                    sdcardreaderfound=true<br>
                    ;;<br>
                esac<br>
        done<br>
        if $audiofound && $sdcardreaderfound ; then<br>
            return 0<br>
        fi<br>
        return 1<br>
        ;;<br>
    *)<br>
        return 1<br>
        ;;<br>
esac<br>
<br>
Any objections?  Suggestions for better implementation?<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Happy hacking<br>
Petter Reinholdtsen<br>
<br>
_______________________________________________<br>
Freedombox-discuss mailing list<br>
<a href="mailto:Freedombox-discuss@lists.alioth.debian.org">Freedombox-discuss@lists.alioth.debian.org</a><br>
<a href="http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/freedombox-discuss" target="_blank">http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/freedombox-discuss</a><br>
</font></span></div><br><br clear="all"><br>-- <br><div dir="ltr"><div><i>"Anything created must necessarily be inferior to the essence of the creator."<br>-- Claude Shouse (shouse@macomw.ARPA)<br>"Einstein's mother must have been one heck of a physicist."<br>
-- Joseph C. Wang (<a href="mailto:joe@athena.mit.edu" target="_blank">joe@athena.mit.edu</a>)<br><br></i><div><br></div>
</div></div>
</div>