• 車種別
  • パーツ
  • 整備手帳
  • ブログ
  • みんカラ+

mlj72のブログ一覧

2015年02月21日 イイね!

RasperrypPI kernel 3.18.xでi2s仕様変更?

RasperrypPI kernel 3.18.xでi2s仕様変更?前回USBドングルにBuffaloを使いましたが、発熱が大きく車内で使用は厳しそうなので、
比較的安価で入手性がよい←にしてみました。
Kernelは3.14辺りから突然音質がよくなったので、
Archの最新3.18にしたところi2sの指定方法が変わっていて嵌りました…
起動時にbootの中にあるconfig.txtを読んで設定される。
Configure device tree overlay fileだそうです。

肝心の音はRuneaudioの0.3に比べワイドレンジで非常に歪み感のないクリアな音質です。
(kernel,mpdともにインストール時の最新verです)

ArchのインストールはInstlationのとおりなので割愛します。

SSHでrootログインです。

お約束のアップデート
# pacman -Syu

ユーザーの追加(後でパッケージをビルドするときに必須になります。)
# useradd -m -g users -G wheel ****
いつの間にか-asrootオプションが使えなくなってます。

パスワードの設定
# passwd *****
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

sudoのインストール
# pacman -S sudo

sudoの設定
# visudo

root ALL=(ALL) ALL

## Uncomment to allow members of group wheel to execute any command
%wheel ALL=(ALL) ALL

## Uncomment to allow members of group sudo to execute any command
%sudo ALL=(ALL) ALL


開発環境の構築
# pacman -S --needed base-devel

mpd関連のインストール
# pacman -S alsa-utils nfs-utils mpd

Boot用のconfig.txtの修正が必要なのでマウントポイント作成
# mkdir boot

config.txtの修正ためにマウントします。
# mount -t vfat /dev/mmcblk0p1 boot

# ls -a boot
. bootcode.bin fixup_cd.dat start.elf
.. cmdline.txt fixup_x.dat start_cd.elf
bcm2708-rpi-b-plus.dtb config.txt kernel.img start_x.elf
bcm2708-rpi-b.dtb fixup.dat overlays

config.txtの修正
# nano boot/config.txt

# Uncomment one of these lines to enable an audio interface
device_tree_overlay=hifiberry-dac ←今回使うDACの#を削除します。
#device_tree_overlay=hifiberry-dacplus
#device_tree_overlay=hifiberry-digi
#device_tree_overlay=hifiberry-amp
#device_tree_overlay=iqaudio-dac
#device_tree_overlay=iqaudio-dacplus


RaspberryPI自身のアナログ出力を停止します。
# nano /etc/modules-load.d/raspberrypi.conf

bcm2708-rng
snd_bcm2835 ←削除します


alsa設定ファイルの作成
# nano /etc/asound.conf

pcm.!default {
type hw card 0
}
ctl.!default {
type hw card 0
}



一旦リブートします。
# reboot

USBドングルをAPモードで使用するためにhostapdをビルドします。
ここからはuserモードで作業しています。

ビルド用ディレクトリへ移動
$ cd /usr/src

wgetのインストール
$ sudo pacman -S wget

WCD-150SU2M用hostapdのPKGBUILDをAURから入手
$ sudo git clone https://aur.archlinux.org/packages/ho/hostapd-8188eu/hostapd-8188eu.tar.gz

入手したファイルの解凍
$ sudo tar zxvf hostapd-8188eu.tar.gz
hostapd-8188eu/
hostapd-8188eu/.AURINFO
hostapd-8188eu/hostapd.service
hostapd-8188eu/hostapd.install
hostapd-8188eu/PKGBUILD

オーナーの変更
$ chown *****.users hostapd-8188eu/*
$ chown *****.users hostapd-8188eu

ビルド用ディレクトリに移動
$ cd hostapd-8188eu

パッケージのビルド(時間が掛かります)
$ makepkg -s ←-asrootが効きません…
==> Making package: hostapd-8188eu 0.8-1 (Sat Feb 21 07:47:42 UTC 2015)
==> Checking runtime dependencies...
==> Installing missing dependencies...
resolving dependencies...
looking for conflicting packages...

Packages (1) libnl-3.2.25-1 ←依存関係のため必要なものをインストール

Total Download Size: 0.21 MiB
Total Installed Size: 1.02 MiB

:: Proceed with installation? [Y/n] y

Packages (2) perl-error-0.17023-1 git-2.3.0-1 ←依存関係のため必要なものをインストール

Total Download Size: 3.54 MiB
Total Installed Size: 21.02 MiB

==> Retrieving sources...
-> Cloning hostapd-8188eu-0.8 git repo...
Cloning into bare repository '/usr/src/hostapd-8188eu/hostapd-8188eu-0.8'...
remote: Counting objects: 797, done.
remote: Total 797 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (797/797), 2.62 MiB | 575.00 KiB/s, done.
Resolving deltas: 100% (82/82), done.
Checking connectivity... done.
-> Found hostapd.install
-> Found hostapd.service
==> Validating source files with sha512sums...
hostapd-8188eu-0.8 ... Skipped
hostapd.install ... Passed
hostapd.service ... Passed
==> Extracting sources...
-> Creating working copy of RTL8188-hostapd git repo...
Cloning into 'hostapd-8188eu-0.8'...
done.
==> Starting build()...
CC main.c
CC config_file.c
|
|
|
CC ../src/ap/ieee802_11_ht.c
LD hostapd
CC hostapd_cli.c
CC ../src/common/wpa_ctrl.c
LD hostapd_cli
==> Entering fakeroot environment...
==> Starting package()...
==> Tidying install...
-> Purging unwanted files...
-> Removing libtool files...
-> Removing static library files...
-> Compressing man and info pages...
-> Stripping unneeded symbols from binaries and libraries...
==> Creating package "hostapd-8188eu"...
-> Generating .PKGINFO file...
-> Adding install file...
-> Generating .MTREE file...
-> Compressing package...
==> Leaving fakeroot environment.
==> Finished making: hostapd-8188eu 0.8-1 (Sat Feb 21 08:00:39 UTC 2015)

ビルドしたhostapdのインストール
$ sudo pacman -U hostapd-8188eu-0.8-1-armv6h.pkg.tar.xz
[sudo] password for *****:
loading packages...
resolving dependencies...
looking for conflicting packages...

Packages (1) hostapd-8188eu-0.8-1

Total Installed Size: 0.49 MiB

DHCPのインストール
$ sudo pacman -S dhcp
resolving dependencies...
looking for conflicting packages...

Packages (1) dhcp-4.3.1-1

Total Download Size: 0.79 MiB
Total Installed Size: 4.60 MiB

USBドングルの認識状況
$ lsusb
Bus 001 Device 004: ID 056e:4008 Elecom Co., Ltd

モジュールの読み込み状況
$ lsmod
Module Size Used by
r8188eu 430207 0                ←USBドングル
snd_soc_bcm2708_i2s 6863 2             ←i2s   
snd_soc_hifiberry_dac 2699 0              ←i2s
snd_soc_pcm5102a 1932 1              ←DAC
snd_soc_core 164794 3 snd_soc_hifiberry_dac,snd_soc_pcm5102a,snd_soc_bcm2708_i2s

サウンドデバイスの状態
$ sudo aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: sndrpihifiberry [snd_rpi_hifiberry_dac], device 0: HifiBerry DAC HiFi pcm5102a-hifi-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0

LANインターフェイスの状況
$ ifconfig -a
eth0: flags=4163 mtu 1500
inet 192.168.1.6 netmask 255.255.255.0 broadcast 192.168.1.255


wlan0: flags=4098 mtu 1500
ether 00:90:fe:c6:92:18 txqueuelen 1000 (Ethernet)
wlan0のIPアドレスはなくてokです。

DHCPの設定ファイルのBackup
$ sudo mv /etc/dhcpd.conf /etc/dhcpdbk.conf

DHCPの設定
$ sudo nano /etc/dhcpd.conf

option domain-name-servers 8.8.8.8, 8.8.4.4;
option subnet-mask 255.255.255.0;
option routers 10.0.0.1;
subnet 10.0.0.0 netmask 255.255.255.0 {
range 10.0.0.100 10.0.0.150;
}


kernel-headerのインストール
$sudo pacman -S linux-raspberrypi-headers

hostapdの設定
$ sudo nano /etc/hostapd/hostapd.conf

interface=wlan0
#driver=nl80211     ←コメントにします
driver=rtl871xdrv
ssid=mljarchap
hw_mode=g
channel=3
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=************
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP CCMP
rsn_pairwise=CCMP
macaddr_acl=0
#macaddr_acl=1
#accept_mac_file=/etc/hostpad/accept_macaddress.conf
ieee80211n=1
wmm_enabled=1
#ht_capab=[HT40+][GF][SHORT-GI-40][TX-STBC][RX-STBC1]
logger_syslog_level=3


hostapdの動作確認
sudo hostapd /etc/hostapd/hostapd.conf

Configuration file: /etc/hostapd/hostapd.conf
drv->ifindex=5
l2_sock_recv==l2_sock_xmit=0x0x95e638
+rtl871x_sta_deauth_ops, ff:ff:ff:ff:ff:ff is deauth, reason=2
  |
  |
rtl871x_set_hidden_ssid ignore_broadcast_ssid:0, mljarchap,9
rtl871x_set_acl

[ctrl]+cで終了

AP関連をまとめて起動するようにスクリプトの作成
$ sudo nano /etc/systemd/system/AP.service

[Unit]
Description=AP
Wants=network.target
Before=network.target
BindsTo=sys-subsystem-net-devices-wlan0.device
After=sys-subsystem-net-devices-wlan0.device

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/sbin/ip link set dev wlan0 up
ExecStart=/sbin/ip addr add 10.0.0.1/24 broadcast 10.0.0.255 dev wlan0
ExecStart=/usr/bin/hostapd -B /etc/hostapd/hostapd.conf
#ExecStart=/usr/bin/dhcpd -4 -q -pf /run/dhcpd4.pid %I
ExecStart=/usr/sbin/dhcpd -4 -q wlan0

ExecStop=/sbin/ip addr flush dev wlan0
ExecStop=/sbin/ip link set dev wlan0 down

[Install]
WantedBy=multi-user.target


AP関連の起動確認
$ sudo systemctl start AP.service

問題なければ自動起動設定
$ sudo systemctl enable AP.service

mpd用フォルダー、ファイルの作成とオーナー変更
$ sudo mkdir -p /mnt/MPD /mnt/MPD/NAS /mnt/MPD/LocalStorage
[sudo] password for *****:

$ sudo mkdir -p /var/lib/mpd/playlists
$ cd /var/lib/mpd
$ sudo touch tag_cache mpdstate
$ cd /var/log
$ sudo mkdir mpd
$ sudo chown -R mpd /var/log/mpd
$ sudo chown -R mpd /var/lib/mpd

シンボリックの作成
$ sudo ln -s /mnt/MPD /var/lib/mpd/music

mpd.confの設定のためaudio deviceの確認
$ sudo aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: sndrpihifiberry [snd_rpi_hifiberry_dac], device 0: HifiBerry DAC HiFi pcm5102a-hifi-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0

$ sudo cp /usr/share/doc/mpd/mpdconf.example /etc/mpd.conf

設定ファイルの変更
$ sudo nano /etc/mpd.conf

music_directory "/var/lib/mpd/music"
user "mpd"
#bind_to_address "localhost"
audio_output {
type "alsa"
name "My ALSA Device"
device "hw:0,0" # optional
## format "44100:16:2" # optional
## mixer_type "hardware" # optional
## mixer_device "default" # optional
## mixer_control "PCM" # optional
## mixer_index "0" # optional
}


手動でマウント確認
$ sudo mount -t ext4 /dev/mmcblk0p3 /mnt/MPD/LocalStorage

起動時にマウントようにfstabに追加
$ nano /etc/fstab
/dev/mmcblk0p3 /mnt/MPD/LocalStorage ext4 defaults 0 0

相変わらず長い…
Posted at 2015/02/21 20:59:19 | コメント(0) | トラックバック(0) | オーディオ | パソコン/インターネット
2015年02月07日 イイね!

BUFFALO WLI-UC-GNM2でAP(親機)モード

BUFFALO WLI-UC-GNM2でAP(親機)モードRaspberry PI RuneAudioネタです。

WLI-UC-GNM2
以前のブログで質問頂いたり、気にもなっていたのでやってみました。
以下すべてrootでの操作です。
コマンドを太字に、設定ファイルの中身は斜体としてみました。

Runeを書き込んだSDから起動します。

# lsusb
Bus 001 Device 004: ID 0411:01ee BUFFALO INC. (formerly MelCo., Inc.) WLI-UC-GNM2 Wireless LAN Adapter [Ralink RT3070]

# lsmod
Module Size Used by
snd_soc_hifiberry_dac 2115 0
snd_soc_pcm5102a 1414 1
rt2800usb 17461 0
rt2800lib 80408 1 rt2800usb
rt2x00usb 11701 1 rt2800usb
rt2x00lib 44813 3 rt2x00usb,rt2800lib,rt2800usb

# pacman -Syy
:: Synchronizing package databases...
core 165.8 KiB 101K/s 00:02 [######################] 100%
extra 2.3 MiB 369K/s 00:06 [######################] 100%
community 2.6 MiB 265K/s 00:10 [######################] 100%
alarm 28.0 KiB 46.5K/s 00:01 [######################] 100%
aur 67.2 KiB 56.5K/s 00:01 [######################] 100%

hostapdのインストール
# pacman -S hostapd
resolving dependencies...
looking for inter-conflicts...

Packages (1): hostapd-2.3-2

Total Download Size: 0.25 MiB
Total Installed Size: 0.77 MiB
Net Upgrade Size: 0.01 MiB

:: Proceed with installation? [Y/n] y
:: Retrieving packages ...
hostapd-2.3-2-armv6h 255.6 KiB 122K/s 00:02 [######################] 100%
(1/1) checking keys in keyring [######################] 100%
(1/1) checking package integrity [######################] 100%
(1/1) loading package files [######################] 100%
(1/1) checking for file conflicts [######################] 100%
(1/1) checking available disk space [######################] 100%
(1/1) upgrading hostapd [######################] 100%

dhcpのインストール
# pacman -S dhcp
resolving dependencies...
looking for inter-conflicts...

Packages (1): dhcp-4.3.1-1

Total Download Size: 0.79 MiB
Total Installed Size: 4.60 MiB

:: Proceed with installation? [Y/n] y
:: Retrieving packages ...
dhcp-4.3.1-1-armv6h 812.7 KiB 98.1K/s 00:08 [######################] 100%
(1/1) checking keys in keyring [######################] 100%
(1/1) checking package integrity [######################] 100%
(1/1) loading package files [######################] 100%
(1/1) checking for file conflicts [######################] 100%
(1/1) checking available disk space [######################] 100%
(1/1) installing dhcp [######################] 100%

hostapdの設定ファイル
SSID,passphraseはご自由にどうぞ(ダブるとオフ会で大変なことになるかも?)

# nano /etc/hostapd/hostapd.conf

interface=wlan0
driver=nl80211
#driver=rtl871xdrv←変更する必要はありません。
ssid=runeaudioap
hw_mode=g
channel=3
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=************
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP CCMP
rsn_pairwise=CCMP
macaddr_acl=0
#macaddr_acl=1
#accept_mac_file=/etc/hostpad/accept_macaddress.conf
ieee80211n=1
wmm_enabled=1
#ht_capab=[HT40+][GF][SHORT-GI-40][TX-STBC][RX-STBC1]
logger_syslog_level=3


dhcpの設定ファイルのBackup
# mv /etc/dhcpd.conf /etc/dhcpdbk.conf

dhcpの設定
# nano /etc/dhcpd.conf
option domain-name-servers 8.8.8.8, 8.8.4.4;
option subnet-mask 255.255.255.0;
option routers 10.0.0.1;
subnet 10.0.0.0 netmask 255.255.255.0 {
range 10.0.0.100 10.0.0.150;
}


hostapdの起動確認
# hostapd /etc/hostapd/hostapd.conf
Configuration file: /etc/hostapd/hostapd.conf
Using interface wlan0 with hwaddr b0:c7:45:ee:ea:e2 and ssid "runeaudioap"
wlan0: interface state UNINITIALIZED->ENABLED
wlan0: AP-ENABLED
wlan0: STA 78:1c:5a:52:16:8a IEEE 802.11: authenticated
wlan0: STA 78:1c:5a:52:16:8a IEEE 802.11: associated (aid 1)
WPA: wpa_sm_step() called recursively
wlan0: STA 78:1c:5a:52:16:8a IEEE 802.11: deauthenticated due to local deauth request

[Ctrl]+cでキャンセル


AP関係をまとめて起動するようにスクリプトの作成

# nano /etc/systemd/system/AP.service
[Unit]
Description=AP
Wants=network.target
Before=network.target
BindsTo=sys-subsystem-net-devices-wlan0.device
After=sys-subsystem-net-devices-wlan0.device

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/sbin/ip link set dev wlan0 up
ExecStart=/sbin/ip addr add 10.0.0.1/24 broadcast 10.0.0.255 dev wlan0
ExecStart=/usr/bin/hostapd -B /etc/hostapd/hostapd.conf
#ExecStart=/usr/bin/dhcpd -4 -q -pf /run/dhcpd4.pid %I
ExecStart=/usr/sbin/dhcpd -4 -q wlan0

ExecStop=/sbin/ip addr flush dev wlan0
ExecStop=/sbin/ip link set dev wlan0 down

[Install]
WantedBy=multi-user.target


AP関連の起動確認
# systemctl start AP.service

問題なければ自動起動設定
# systemctl enable AP.service

bootでAP関連が自動起動しない場合は、
wlan0がクライアントモードとコンフリクトしている可能性があります。
対処方法はwlanの接続を止めて対応しましたが、もっとスマートな方法がありそうな気がします。

# nano /etc/netctl/wlan0
Description='wlan0 connection'
Interface=wlan0
#ForceConnect=yes
ForceConnect=no
#SkipNoCarrier=yes
#Connection=wireless
#Security=wpa-config
#WPAConfigFile='/etc/wpa_supplicant/wpa_supplicant.conf'
#IP=dhcp
#ExecUpPost='/usr/bin/ntpd -gq || true'


もっと簡潔に書きたかったのですが、まただらだらと長くなってしまいした…

何も設定してないので接続状態のみです。


AP関連の起動時間です。(ちょっと遅くなりました)
# systemd-analyze blame
5.952s AP.service
Posted at 2015/02/07 18:14:19 | コメント(4) | トラックバック(0) | PC | パソコン/インターネット

プロフィール

「17年間 111,500km乗ってみました http://cvw.jp/b/659678/43805418/
何シテル?   03/10 21:59
mljです。よろしくお願いします。
みんカラ新規会員登録

ユーザー内検索

<< 2015/2 >>

123456 7
891011121314
151617181920 21
22232425262728

リンク・クリップ

[三菱 アイ] i -miev用LEDヘッドライト交換 修正 
カテゴリ:その他(カテゴリ未設定)
2023/05/14 14:23:39
[三菱 アイ] HID化に挑戦 ① 
カテゴリ:その他(カテゴリ未設定)
2023/05/14 13:57:01

愛車一覧

ホンダ S2000 ホンダ S2000
09年8月に一台目を購入したものの、 色と程度を妥協したのが災いして愛着もなく、 相場高 ...
三菱 アイ 三菱 アイ
かれこれ2年以上前から物色していました。HIDとシートヒータ付き物件にはなかなか巡り会え ...
三菱 eKスポーツ 三菱 eKスポーツ
RCサーキットに通うために2003年2月に新車購入しました。 買って一週間もしないうちに ...
マツダ RX-7 マツダ RX-7
2001年に知人から譲りうけ7年ほど乗りました。(ほとんど車庫の中だったので「持っていた ...

過去のブログ

2024年
01月02月03月04月05月06月
07月08月09月10月11月12月
2023年
01月02月03月04月05月06月
07月08月09月10月11月12月
2022年
01月02月03月04月05月06月
07月08月09月10月11月12月
2021年
01月02月03月04月05月06月
07月08月09月10月11月12月
2020年
01月02月03月04月05月06月
07月08月09月10月11月12月
2019年
01月02月03月04月05月06月
07月08月09月10月11月12月
2018年
01月02月03月04月05月06月
07月08月09月10月11月12月
2017年
01月02月03月04月05月06月
07月08月09月10月11月12月
2016年
01月02月03月04月05月06月
07月08月09月10月11月12月
2015年
01月02月03月04月05月06月
07月08月09月10月11月12月
2014年
01月02月03月04月05月06月
07月08月09月10月11月12月
ヘルプ利用規約サイトマップ
© LY Corporation