Tuesday 19 November 2013

Raspberry Pi Setup As MPD Sever - Part 2

This is to continue last post about Raspberry Pi setup as MPD server. With Arch Linux setup and ready to play music using MPD, the next thing to do is to make it read-only so as to minimize the wrap n' wear to the SD card.



1. (This step is copied from Voyage MPD with some modification. Credit goes to the creator of this script in Voyage MPD.)

1a. Create the following new service:

vi /etc/systemd/system/voyage.service
===========================================================
[Unit]
Description=Voyage Sync
Wants=network.target
After=systemd-udevd.service

[Service]
Type=oneshot
RemainAfterExit=yes

ExecStart=/usr/local/sbin/voyage-sync start
ExecStart=/usr/local/sbin/voyage-util start

ExecStop=/usr/local/sbin/voyage-util stop
ExecStop=/usr/local/sbin/voyage-sync stop

[Install]
WantedBy=multi-user.target

===========================================================

1b. Execute command to enable the new service, so that it starts automatically in every boot up.

systemctl enable voyage.service

1c. Copy from Voyage MPD, the files in "/usr/local/sbin" to the same folder in Arch Linux.
1d. chmod -Rf 755 /usr/local/sbin



2. Auto mounting of USB media and update MPD music library on-the-fly
(source from a tool called USBFlash  with some modification: http://code.google.com/p/yad/wiki/USBFlash)
vi /etc/udev/rules.d/11-auto-mount.rules
===========================================================
KERNEL!="sd[a-z]*", GOTO="auto_mount_end"
KERNEL=="sd[a-z]", GOTO="auto_mount_end"
ACTION=="add", PROGRAM!="/sbin/blkid %N", GOTO="auto_mount_end"

# Set environment
ACTION=="add", IMPORT{program}="/sbin/blkid -o udev -p -s TYPE -s LABEL %N"

# Global mount options
ACTION=="add", ENV{mount_options}="relatime,users,umask=0,ro"

# Filesystem specific options
ACTION=="add", ENV{ID_FS_TYPE}=="ntfs", ENV{mount_options}="%E{mount_options},utf8"

# Get mount point
ACTION=="add", ENV{ID_FS_LABEL}=="?*", PROGRAM="/usr/bin/basename '%E{ID_FS_LABEL}'", ENV{dir_name}="%c"
ACTION=="add", ENV{dir_name}!="?*", ENV{dir_name}="USB-%k"
 

# Main action
ACTION=="add", ENV{dir_name}=="?*", RUN+="/bin/mkdir '/var/lib/mpd/music/%E{dir_name}'", RUN+="/bin/mount -o %E{mount_options} /dev/%k '/var/lib/mpd/music/%E{dir_name}'", RUN+="find /var/lib/mpd/music -type d -empty -delete", RUN+="/usr/bin/mpc update"
ACTION=="remove", ENV{dir_name}=="?*", RUN+="/bin/umount -l '/var/lib/mpd/music/%E{dir_name}'", RUN+="find /var/lib/mpd/music -type d -empty -delete", RUN+="/usr/bin/mpc update"

LABEL="auto_mount_end"

# label must be cleared
ENV{ID_FS_LABEL}=""

===========================================================

(Afterword: I still prefer loading PiCorePlayer in my Pi. The next thing to do is to make a case for Pi.)

Monday 18 November 2013

My Linear Power Supply for (CAS) PCs

After months of work, my linear power supply is almost complete.
This is a one box solution with 7 outputs:12Vx4 & 5Vx3. The toroidal transformer is a 300VA O-shape transformer made by Simon62:
http://item.taobao.com/item.htm?id=19559581859

Different outputs are designed for different PCs:
1 - 12V 5A - NAS (Atom 2800MT, 4T 3.5" WD Red) + My desktop PC (Haswell i3 35W TDP, SSD)
2 - 12V 3A - PC dedicated for CD ripping (AMD E2100 9W TDP, 2T 3.5" WD Red + CD-ROM)
3 - 12V 3A - PC dedicated for CAS (Celeron 1037u 18W TDP, SSD + 500G 2.5" WD Blue)
4 - 12V 3A - reserved
5 - 5V 3A - Network Hub
6 - 5V 1.5A - Fiber-Ethernet Media Converters
7 - 5V 1.5A - Power for hard drives of CAS PC.





HOLO Audio T.Rex MK II

前天收到了, 這是去年 Jeff Zhu 出的一台解碼的改版. 更新如下:

1. 供電重新設計
2. 不使用 IC op. amp, 改用discrete op. amp.
3. 增加了 RCA 輸出, 之前的XLR -> RCA 的方法現在不適用
4. USB 輸入改用 XMOS 方案, 跟之前的北極鷗 DDC一樣




 因為新的機箱未完成, 我收到的工程樣版用的箱是舊版的箱,至使尾板不適用.


 上面的是我的(舊版), 下面的是MK II 工程樣版.