Fun openwrt (2)-Build a wireless music player with Android phones

Source: Internet
Author: User


In the previous article, we introduced the introduction of the app with the ADSL driver.OpenwrtAnd simple configuration. This time, we will summarize the next interesting application, using Android mobile phone +MPDCreates a wireless music player.

Required equipment:
    • One route entry for db120, rg100a, or other bcm6358 chips
    • One USB sound card (two sound cards in my hand can work well, one is steelseries
      5hv2: one is the North Blue mouse USB sound card 7.1 sound card, which is more inclined to steelseries 5hv2 in terms of sound quality)
    • One USB flash drive or USB disk
    • Mobile phones or tablets running Android

 

First, make sure that the router has been flushedOpenwrtAnd the Internet can be accessed normally.

Install the USB and file system kernel modules

Opkg update
Opkg install kmod-USB-core
Opkg install kmod-USB-storage
Opkg install kmod-USB-OHCI
Opkg install kmod-USB-OHCI
Opkg install kmod-fs-ext2
Opkg install kmod-fs-ext3
Opkg install kmod-FS-vfat
Opkg install kmod-Fuse
Opkg install ntfs-3g

Configure Automatic mounting of USB storage devices

Install the Mount Tool

Opkg install Mount-utils

Edit configuration file

VI/ETC/Hotplug. d/block/10-mount
#! /Bin/sh

# Copyright (c) 2009 openwrt.org (c) 2010 openwrt.org.cn

Blkdev = 'dirname $ devpath'
If ['basename $ blkdev '! = "Block"]; then

Device = 'basename $ devpath'
Case "$ action" in
Add)
Mkdir-P/mnt/$ Device
# Vfat & ntfs-3g check
If ['which fdisk']; then
Isntfs = 'fdisk-L | grep $ device | grep NTFS'
Isvfat = 'fdisk-L | grep $ device | grep fat'
Isfuse = 'lsmod | grep fuse'
Isntfs3g = 'which ntfs-3g'
Else
Isntfs = ""
Isvfat = ""
Fi

# Mount with ntfs-3g if pOSSVisible, else with default Mount
If ["$ isntfs"-a "$ isfuse"-a "$ isntfs3g"]; then
Ntfs-3g-o nls = utf8/dev/$ device/mnt/$ Device
Elif ["$ isvfat"]; then
Mount-T vfat-O iocharset = utf8, RW, sync, umask = 0000, dmask = 0000, fmask = 0000/dev/$ device/mnt/$ Device
Else
Mount/dev/$ device/mnt/$ Device
Fi
If [-F/dev/$ {Device}/swapfile]; then
Mkswap/dev/$ {Device}/swapfile
Swapon/dev/$ {Device}/swapfile
Fi
;;
Remove)
If [-F/dev/$ {Device}/swapfile]; then
Swapoff/dev/$ {Device}/swapfile
Fi
Umount/dev/$ Device
;;
Esac

Fi

Modify executable permissions

Chmod 777/etc/hotplug. d/block/10-mount

Configure a USB sound card

Install the sound card kernel module

Opkg install kmod-input-core
Opkg install kmod-soundcore
Opkg install kmod-USB-Audio

Check whether DSP, audio, and mixer are available in/dev.
Test whether the sound card works properly. Connect the sound card to the speaker and insert a USB storage device containing MP3 files.
Assume that the Mount path of the USB device is/mnt/sdb1.

Opkg install madplay
Madplay/mnt/sba1/*. MP3

If the voice is normal, the audio card is successfully driven.

Install and configure MPD

Opkg install mDNSResponder
Opkg install libspeex
Opkg installMPD

Edit the MPD configuration file
VI/etc/MPD. conf
To:

#=== Edit options as follows ====
Music_directory "/mnt/sdb1 ″
Playlist_directory "/mnt/sdb1/. MPD/playlist"
Db_file "/mnt/sdb1/. MPD/MPD. DB"
LOG_FILE "/mnt/sdb1/. MPD/MPD. log"
Error_file "/mnt/sdb1/. MPD/MPD. error"
Pid_file "/mnt/sdb1/. MPD/MPD. PID"
State_file "/mnt/sdb1/. MPD/mpdstate"

# Use this if you want to use OSS audio output
Audio_output {
Type"OSS"
Name "My OSS sound card"
Device "/dev/DSP" # optional
Format "44100: 16: 2" # optional
}

# OSS Mixer
Mixer_type"OSS"
Mixer_device "/dev/mixer"
Mixer_control "PCM"

#=== Edit end ====

Create directories and files required for MPD

Mkdir-P/mnt/sdb1/. MPD/playlist
Touch/mnt/sdb1/. MPD/{MPD. DB, MPD. Log, MPD. error, MPD. PID, mpdstate}

Run MPD

/Usr/bin/MPD-create-DB

Install the MPC to control playback

Opkg install MCM
Nmlistall | nmadd
Nmplay

Use mobile phone to control playback

Connect to the vro by using a mobile phone. Search for the mpdroid In the Android marketplace and install it.
Run mpdroid and select the Essid to connect to the wireless route in WLAN Based connection.
Enter the IP address of the vro in the host option. Otherwise, the default IP address is displayed.
In this case, you can use your mobile phone to wirelessly control the playback, pause, and other operations of the vro.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.