diff --git a/BerrybootGUI2.0/bootmenudialog.cpp b/BerrybootGUI2.0/bootmenudialog.cpp index 63626efa6..e923e9620 100644 --- a/BerrybootGUI2.0/bootmenudialog.cpp +++ b/BerrybootGUI2.0/bootmenudialog.cpp @@ -207,6 +207,12 @@ void BootMenuDialog::initialize() ui->list->setCurrentItem(item); } + if (_i->bootoptions().contains("sound")) + { + /* Set sound channel (HDMI/headphones) */ + _i->loadSoundModule(_i->bootParam("sound")); + } + if (!_i->bootoptions().contains("nobootmenutimeout")) { // start timer @@ -552,7 +558,7 @@ void BootMenuDialog::startNetworking() QProcess *proc = new QProcess(); connect(proc, SIGNAL(finished(int)), proc, SLOT(deleteLater())); - proc->start("/sbin/ifup eth0"); + proc->start("sh -c \"/sbin/ifup eth0 || /sbin/ifup eth0\""); } void BootMenuDialog::umountSystemPartition() diff --git a/BerrybootGUI2.0/driveformatthread.cpp b/BerrybootGUI2.0/driveformatthread.cpp index 835dd9e45..94352a493 100644 --- a/BerrybootGUI2.0/driveformatthread.cpp +++ b/BerrybootGUI2.0/driveformatthread.cpp @@ -160,6 +160,12 @@ void DriveFormatThread::run() param += " mac_addr="+mac; } + /* Sound channel selection (hdmi audio/headphones) */ + if (!_i->sound().isEmpty()) + { + param += " sound="+_i->sound(); + } + QByteArray qmap = _i->keyboardlayout().toAscii(); if (!qmap.isEmpty() && qmap != "us") param += " qmap="+qmap; diff --git a/BerrybootGUI2.0/icons.qrc b/BerrybootGUI2.0/icons.qrc index 6f5cfac3a..dd12afe3b 100644 --- a/BerrybootGUI2.0/icons.qrc +++ b/BerrybootGUI2.0/icons.qrc @@ -108,5 +108,6 @@ icons/luminous_lines.jpg icons/help.png icons/document_revert.png + icons/audio_headset.png diff --git a/BerrybootGUI2.0/installer.cpp b/BerrybootGUI2.0/installer.cpp index ec1dfe132..ef8e8b988 100644 --- a/BerrybootGUI2.0/installer.cpp +++ b/BerrybootGUI2.0/installer.cpp @@ -479,6 +479,16 @@ bool Installer::fixateMAC() const return _fixMAC; } +void Installer::setSound(const QByteArray &sound) +{ + _sound = sound; +} + +QByteArray Installer::sound() const +{ + return _sound; +} + bool Installer::isSquashFSimage(QFile &f) { quint32 magic = 0; @@ -551,6 +561,25 @@ void Installer::loadCryptoModules() QProcess::execute("/sbin/modprobe algif_hash"); } +void Installer::loadSoundModule(const QByteArray &channel) +{ + if (cpuinfo().contains("BCM2708")) + { + /* Raspberry Pi */ + prepareDrivers(); + QProcess::execute("/sbin/modprobe snd-bcm2835"); + + if (channel == "headphones") + { + QProcess::execute("amixer cset numid=3 1"); + } + else if (channel == "hdmi") + { + QProcess::execute("amixer cset numid=3 2"); + } + } +} + void Installer::startWifi() { loadDrivers(); diff --git a/BerrybootGUI2.0/installer.h b/BerrybootGUI2.0/installer.h index 8deeb0c51..ec12d1819 100644 --- a/BerrybootGUI2.0/installer.h +++ b/BerrybootGUI2.0/installer.h @@ -57,6 +57,7 @@ class Installer : public QObject void prepareDrivers(); void loadDrivers(); void loadCryptoModules(); + void loadSoundModule(const QByteArray &channel); void startWifi(); void setKeyboardLayout(const QString &layout); @@ -67,6 +68,8 @@ class Installer : public QObject bool disableOverscan() const; void setFixateMAC(bool fix); bool fixateMAC() const; + void setSound(const QByteArray &sound); + QByteArray sound() const; QMap listInstalledImages(); QString imageFilenameToFriendlyName(const QString &name); @@ -99,7 +102,7 @@ public slots: QString _keyboardlayout, _timezone; bool _disableOverscan, _fixMAC; QSettings *_settings; - QByteArray _bootoptions; + QByteArray _bootoptions, _sound; void log_error(const QString &msg); diff --git a/BerrybootGUI2.0/localedialog.cpp b/BerrybootGUI2.0/localedialog.cpp index 2ccb9e2ab..d69ba313a 100644 --- a/BerrybootGUI2.0/localedialog.cpp +++ b/BerrybootGUI2.0/localedialog.cpp @@ -175,6 +175,10 @@ void LocaleDialog::done(int r) _i->setTimezone(ui->timezoneCombo->currentText()); _i->setDisableOverscan(ui->disableOverscanRadio->isChecked()); _i->setFixateMAC(_i->hasDynamicMAC() && ui->fixMACbox->isChecked()); + if (ui->audioHDMIradio->isChecked()) + _i->setSound("hdmi"); + else if (ui->audioHeadphonesRadio->isChecked()) + _i->setSound("headphones"); bool wifi = ui->wifiRadio->isChecked(); if (_gbd) diff --git a/BerrybootGUI2.0/localedialog.ui b/BerrybootGUI2.0/localedialog.ui index 1a99ef4a3..2691825a6 100644 --- a/BerrybootGUI2.0/localedialog.ui +++ b/BerrybootGUI2.0/localedialog.ui @@ -13,8 +13,8 @@ Welcome - - + + @@ -26,27 +26,12 @@ - - - - - 12 - - - - Welcome to BerryBoot installation. Please double check the following settings, and press "ok" - - - true - - - - + 0 - 110 + 100 @@ -85,12 +70,18 @@ - + + + + 0 + 0 + + - 0 - 75 + 240 + 95 @@ -157,7 +148,7 @@ - + @@ -249,7 +240,100 @@ - + + + + + 0 + 0 + + + + + 0 + 95 + + + + + 12 + + + + Audio + + + + + + + 0 + 0 + + + + Auto + + + true + + + + + + + + 0 + 0 + + + + HDMI + + + + + + + + 0 + 0 + + + + Headphones + + + + :/icons/audio_headset.png:/icons/audio_headset.png + + + + + + + + + + + 0 + 0 + + + + + 12 + + + + Welcome to BerryBoot installation. Please double check the following settings, and press "ok" + + + true + + + + Qt::Horizontal diff --git a/buildroot-2012.05/.config b/buildroot-2012.05/.config index 836a6a807..5c618392b 100644 --- a/buildroot-2012.05/.config +++ b/buildroot-2012.05/.config @@ -1,6 +1,6 @@ # # Automatically generated make config: don't edit -# Buildroot 2012.05-gb49fa59-dirty Configuration +# Buildroot 2012.05-gb8c4806-dirty Configuration # BR2_HAVE_DOT_CONFIG=y BR2_arm=y @@ -239,7 +239,24 @@ BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y # # Audio and video applications # -# BR2_PACKAGE_ALSA_UTILS is not set +BR2_PACKAGE_ALSA_UTILS=y + +# +# ALSA utils selection +# +# BR2_PACKAGE_ALSA_UTILS_ALSACONF is not set +# BR2_PACKAGE_ALSA_UTILS_ALSACTL is not set +# BR2_PACKAGE_ALSA_UTILS_ALSAMIXER is not set +# BR2_PACKAGE_ALSA_UTILS_AMIDI is not set +BR2_PACKAGE_ALSA_UTILS_AMIXER=y +# BR2_PACKAGE_ALSA_UTILS_APLAY is not set +# BR2_PACKAGE_ALSA_UTILS_IECSET is not set +# BR2_PACKAGE_ALSA_UTILS_ACONNECT is not set +# BR2_PACKAGE_ALSA_UTILS_APLAYMIDI is not set +# BR2_PACKAGE_ALSA_UTILS_ARECORDMIDI is not set +# BR2_PACKAGE_ALSA_UTILS_ASEQDUMP is not set +# BR2_PACKAGE_ALSA_UTILS_ASEQNET is not set +# BR2_PACKAGE_ALSA_UTILS_SPEAKER_TEST is not set # BR2_PACKAGE_AUMIX is not set # BR2_PACKAGE_BELLAGIO is not set # BR2_PACKAGE_FAAD2 is not set @@ -617,7 +634,22 @@ BR2_PACKAGE_SQUASHFS_LZO=y # # Audio/Sound # -# BR2_PACKAGE_ALSA_LIB is not set +BR2_PACKAGE_ALSA_LIB=y + +# +# ALSA lib selection +# +BR2_PACKAGE_ALSA_LIB_DEVDIR="/dev/snd" +BR2_PACKAGE_ALSA_LIB_PCM_PLUGINS="" +BR2_PACKAGE_ALSA_LIB_CTL_PLUGINS="all" +# BR2_PACKAGE_ALSA_LIB_ALOAD is not set +BR2_PACKAGE_ALSA_LIB_MIXER=y +BR2_PACKAGE_ALSA_LIB_PCM=y +# BR2_PACKAGE_ALSA_LIB_RAWMIDI is not set +# BR2_PACKAGE_ALSA_LIB_HWDEP is not set +BR2_PACKAGE_ALSA_LIB_SEQ=y +# BR2_PACKAGE_ALSA_LIB_ALISP is not set +# BR2_PACKAGE_ALSA_LIB_OLD_SYMBOLS is not set # BR2_PACKAGE_AUDIOFILE is not set # BR2_PACKAGE_LIBAO is not set # BR2_PACKAGE_LIBCDAUDIO is not set