General NAS-Central Forums

Welcome to the NAS community
It is currently Mon Sep 25, 2017 2:44 am

All times are UTC




Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: USB Stereo Audio Adapter
PostPosted: Mon Sep 19, 2011 4:20 pm 
Offline

Joined: Tue Apr 05, 2011 8:07 am
Posts: 70
Sorry for yet another newbie question but would adding support for a USB Stereo Audio Adapter (something like the one below) require a rebuilt Kernel or is it somehow possible to add support for USB audio on current build?

Would be nice to have USB audio support in the NSA-220+ to experiment with it as a music player or maybe VOIP phone.

http://www.newegg.com/Product/Product.aspx?Item=N82E16812186035&nm_mc=AFC-C8Junction&cm_mmc=AFC-C8Junction-_-Adapters%20and%20gender%20changers-_-Syba-_-12186035&AID=10440897&PID=3238164&SID=)

/KC


Top
 Profile  
 
PostPosted: Tue Sep 20, 2011 5:56 pm 
Offline

Joined: Mon Jun 16, 2008 10:45 am
Posts: 6039
Should work fine. The USB audio modules are included with the Debian kernel.


Top
 Profile  
 
PostPosted: Thu Sep 22, 2011 11:49 am 
Offline

Joined: Tue Apr 05, 2011 8:07 am
Posts: 70
Great! Will have to get one of thoose and try it out.. will report back how it goes.

Btw: Will Debian also autodetect the USB Audio Adapter just by plugging it in?

/KC


Top
 Profile  
 
PostPosted: Thu Sep 22, 2011 1:58 pm 
Offline

Joined: Mon Jun 16, 2008 10:45 am
Posts: 6039
The kernel will autodetect it. (Duh. If it didn't, how would you ever connect an USB device?)

Device nodes will be created automagically if you installed udev. I don't know if the needed kernel modules will be loaded.


Top
 Profile  
 
PostPosted: Sun Oct 02, 2011 4:19 pm 
Offline

Joined: Tue Apr 05, 2011 8:07 am
Posts: 70
Got the USB Audio adapter and will hopefully test it out the coming week.

/KC


Top
 Profile  
 
PostPosted: Mon Oct 03, 2011 3:04 pm 
Offline

Joined: Tue Apr 05, 2011 8:07 am
Posts: 70
Here is a small "How-To" on how I got it working if anyone else is interested to use their NSA-220+ as a music player.

1. Install following packages using apt-get

udev
usbutils
alsa-base
alsaplayer-text

2. Plug in the USB Sound Card and type "lsusb", should return something like this...

root@NSA-220:/# lsusb

Bus 002 Device 002: ID 0c76:1607 JMTek, LLC. audio controller
Bus 002 Device 001: ID 0000:0000
Bus 001 Device 002: ID 05e3:0727 Genesys Logic, Inc.
Bus 001 Device 001: ID 0000:0000

3. Plug in headphones and run "speaker-test", should return something like this and
you should hear nosie...

root@NSA-220:/# speaker-test

speaker-test 1.0.16

Playback device is default
Stream parameters are 48000Hz, S16_LE, 1 channels
Using 16 octaves of pink noise
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 2048 to 16384
Period size range from 1024 to 1024
Using max buffer size 16384
Periods = 4
was set period_size = 1024
was set buffer_size = 16384
0 - Front Left
Time per period = 2.904813
...

4. play MP3-files with "alsaplayer"

alsaplayer file_name.mp3

5. Done!

The USB Sound Card I use is a cheap one (~5 USD) and is labeled "Model HY554".

/KC


Top
 Profile  
 
PostPosted: Mon Oct 03, 2011 4:49 pm 
Offline

Joined: Tue Apr 05, 2011 8:07 am
Posts: 70
So far so good!

The USB Sound Card works just fine if plugged in directly to NSA-220+ but when trying the same with a USB HUB I get the following errors when trying to use alsaplayer...

Code:
root@NSA-220:/# alsaplayer test.mp3

ALSA lib pcm_direct.c:975:(snd1_pcm_direct_initialize_slave) unable to install hw params
ALSA lib pcm_dmix.c:1008:(snd_pcm_dmix_open) unable to initialize slave
snd_pcm_open: Broken pipe (default)
Failed to initialize plugin!
Failed to register plugin: /usr/lib/alsaplayer/output/libalsa_out.so
Failed to load output plugin "alsa". Trying defaults.
ALSA lib pcm_direct.c:975:(snd1_pcm_direct_initialize_slave) unable to install hw params
ALSA lib pcm_dmix.c:1008:(snd_pcm_dmix_open) unable to initialize slave
snd_pcm_open: Broken pipe (default)
Failed to initialize plugin!
/usr/lib/alsaplayer/output/libalsa_out.so failed to load
NOTE: THIS IS THE NULL PLUGIN.      YOU WILL NOT HEAR SOUND!!
...


The USB Sound Card is still recognized and shows up with lsusb

Code:
root@NSA-220:~# lsusb

Bus 001 Device 002: ID 05e3:0727 Genesys Logic, Inc.
Bus 001 Device 001: ID 0000:0000 
Bus 002 Device 001: ID 0000:0000 
Bus 002 Device 003: ID 0c76:1607 JMTek, LLC. audio controller
Bus 002 Device 002: ID 0451:1446 Texas Instruments, Inc. TUSB2040/2070 Hub


Tried with two different USB HUB's (one powered) but same result. Would like to have it connect thru a USB HUB since there are no USB ports free and I'd hoped to get remote control for the music player (LIRC) up running as well. Any ideas?

/KC


Top
 Profile  
 
PostPosted: Mon Oct 03, 2011 6:46 pm 
Offline

Joined: Mon Jun 16, 2008 10:45 am
Posts: 6039
Have you tried to use the soundcard behind a hub on a PC?
Quote:
Would like to have it connect thru a USB HUB since there are no USB ports free and I'd hoped to get remote control for the music player (LIRC) up running as well. Any ideas?

Well, of course you can put the device on the other port on a hub.

BTW, have a look at madplay. This will be able to play your mp3's with a much lower CPU load.


Top
 Profile  
 
PostPosted: Mon Oct 03, 2011 9:35 pm 
Offline

Joined: Tue Apr 05, 2011 8:07 am
Posts: 70
Will try the same setup on Windows 7 tomorrow and thanks for the madplayer tips!

Did some more searching and found a few with similar problems...

http://comments.gmane.org/gmane.linux.usb.general/204

and

http://forum.soft32.com/linux/NSLU2-USB-Sound-error-28-CONFIG_USB_EHCI_TT_NEWSCHED-ftopict312399.html

I have the same error msg in my syslog...

Code:
...
Oct  3 21:23:29 NSA-220 kernel: ehci_platform ehci_platform.16781: iso_stream_schedule FAILED: status=-28
Oct  3 21:23:29 NSA-220 kernel: ehci_platform ehci_platform.16781: sitd_submit: can't schedule
Oct  3 21:23:29 NSA-220 kernel: cannot submit datapipe for urb 0, error -28: not enough bandwidth
...


They are talking about enabling "CONFIG_USB_EHCI_TT_NEWSCHED" in the kernel. Other info say to load "ehci-hcd" and "ohci_hcd" modules using modprobe. Is this something I could fix without recompiling the kernel?

Below are my loaded modules and (unless I'm missing something) both ehci-hcd and ohci-hcd are missing...

Code:
root@NSA-220:/var/log# lsmod

Module                  Size  Used by
snd_pcm_oss            40576  0
snd_mixer_oss          14560  1 snd_pcm_oss
linear                  4704  1
md_mod                 70676  2 linear
lm85                   29668  0
hwmon_vid               1920  1 lm85
snd_usb_audio          69536  0
snd_pcm                67301  2 snd_pcm_oss,snd_usb_audio
snd_page_alloc          7368  1 snd_pcm
snd_usb_lib            14432  1 snd_usb_audio
snd_seq_midi            6176  0
snd_seq_midi_event      6144  1 snd_seq_midi
snd_rawmidi            20096  2 snd_usb_lib,snd_seq_midi
usbhid                 40164  0
snd_seq_device          5992  2 snd_seq_midi,snd_rawmidi
snd_hwdep               7076  1 snd_usb_audio
snd_seq                50856  2 snd_seq_midi,snd_seq_midi_event
snd_timer              19236  2 snd_pcm,snd_seq
snd                    42708  9 snd_pcm_oss,snd_mixer_oss,snd_usb_audio,snd_pcm,snd_rawmidi,snd_seq_device,snd_hwdep,snd_seq,snd_timer
soundcore               7332  1 snd


As allways any help or pointers appreciated...

/KC


Top
 Profile  
 
PostPosted: Tue Oct 04, 2011 10:07 am 
Offline

Joined: Mon Jun 16, 2008 10:45 am
Posts: 6039
For this changes you'll need to compile a new kernel. (Which really isn't hard)
CONFIG_USB_EHCI_TT_NEWSCHED is not set in the current one so that could be done. Creating ehci_hcd and ohci-hcd as modules can be done too. But if you boot your Debian from an USB disk, you'll have to change your initrd. The modules usbstorage and ehci-hcd needs to be loaded before the usb disk can be mounted. I don't know if it will fit in initrd, which has a limited size. A work around could be to put these modules on internal harddisk somewhere. (preferably not in a raidarray, as that will give other problems), load them from there, mount the usb disk, and switch_root to it.


Top
 Profile  
 
PostPosted: Tue Oct 04, 2011 3:59 pm 
Offline

Joined: Tue Apr 05, 2011 8:07 am
Posts: 70
Thanks for the input Mijzelf!

I will try to gather some information and read up on compiling the kernel coming weeks and I'm sure I will be back here with some more questions ;)

If you (or anyone else) have some good links for the NSA-220 particular please post them.

/KC


Top
 Profile  
 
PostPosted: Tue Oct 04, 2011 6:22 pm 
Offline

Joined: Mon Jun 16, 2008 10:45 am
Posts: 6039
The easiest way is to compile it on the NAS itself.
Install the compiler and screen:
apt-get install gcc screen

Download the kernel sources from ftp://opensource.zyxel.com/NSA-220/3.24.update.Apr.08/ (They can be found in build_NSA-220.tar.gz)
Unpack the tarball, and the linux tarball inside. This gives you a directory linux-2.6.18.6. In this directory 'it happens'.

Edit the file Makefile. Put a # before the CROSS_COMPILE declaration.
You'll need a .config file. You can start with the one in you current kernel. run 'modprobe configs' , now you have a pseudo file /proc/config.gz, which you can decompress to .config. Put it in the linux directory. (Maybe there is one, just overwrite it).

Now, in the linux directory, run 'make menuconfig'. After some compiling you get a kernel configuration editor. In 'General setup->Local version' put some nice append. '-sound', maybe.

Your option can be found here:
Symbol: USB_EHCI_TT_NEWSCHED [=n]
│ Prompt: Improved Transaction Translator scheduling (EXPERIMENTAL)
│ Defined at drivers/usb/host/Kconfig:53
│ Depends on: USB_EHCI_HCD && EXPERIMENTAL
│ Location:
│ -> Device Drivers
│ -> USB support
│ -> Support for Host-side USB (USB [=y])
│ -> EHCI HCD (USB 2.0) support (USB_EHCI_HCD [=y])
For some reason I can't enter the USB support menu. A damaged .config, maybe. When you can't either, you can edit .config directly.

Exit the editor, save the .config, and you are ready to build. This will last several hours, so here we use screen.
Code:
nice screen
make

The compilation runs in screen, and you can close your shell. When you want to pick it up later, run 'screen -r'.

After several hours the compilation is done. Install the kernelmodules
Code:
su
make modules_install
(Here is the Local version important. If you didn't change it, this will overwrite your current modules. And probably the new modules are not compatible with your current kernel). You can find the kernel (zImage) in arch/arm/boot. Put it in /boot, and change the symlink so this kernel will be used. Reboot.


Top
 Profile  
 
PostPosted: Wed Oct 05, 2011 7:41 am 
Offline

Joined: Tue Apr 05, 2011 8:07 am
Posts: 70
Thanks alot for taking the time to list the procedure Mijzelf! Information saved and I will give it a go coming weeks/month...

/KC


Top
 Profile  
 
PostPosted: Sat Oct 08, 2011 10:41 am 
Offline

Joined: Tue Apr 05, 2011 8:07 am
Posts: 70
After testing a few days I've had some problems with madplayer freezing the NSA-220 a couple of times after it stopped played the MP3 so while searching for other alternatives I bumped into Music Player Daemon (mpd) that will suit my needs even better and it runs great (no freezes so far) and can be remote controlled from my old SimPad SL4 tablet (or other PC's) :)

While installing mpd I noticed it installed X11 stuff even if I run CLI only so just out of curiosity. Does some program need X11 stuff even in CLI only or are they included because most (desktop) ppl run Linux with GUI?

This was the X11 packages that was installed along with mpd...

x11-common 1:7.3+20
libxdmcp6 1:1.0.2-3
libxcb1 1.1-1.2
libxcb-xlib0 1.1-1.2
libx11-data 2:1.1.5-2
libx11-6 2:1.1.5-2

/KC


Top
 Profile  
 
PostPosted: Sat Oct 08, 2011 11:37 am 
Offline

Joined: Mon Jun 16, 2008 10:45 am
Posts: 6039
KeyCat wrote:
While installing mpd I noticed it installed X11 stuff even if I run CLI only so just out of curiosity. Does some program need X11 stuff even in CLI only or are they included because most (desktop) ppl run Linux with GUI?
The latter. I suppose it has some X interface (maybe just an icon which tells it is running), which pops up when an X-server is found.
It might be possible to build your own version without X support, by giving the right arguments to configure. (something like ./configure --without-x-support). This would have a smaller footprint, as the xlib doesn't need to be loaded.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group