Top

A Linux User Reference

Search tips
  • search ignores words that are less than 4 characters in length
  • searches are case insensitve
  • if a search does not return anything try it in Boolean mode then Query expansion mode by checking the appropriate radio button e.g. searching for 'cron' in just the Administration category returns nothing - presumably because the 50% threshold is reached. Boolean mode ignores this threshold so a search for 'cron' returns several hits
  • in Boolean mode preceding a word with a '+' means the result must include that word, a '-' means it must not
  • in Boolean mode '+crontab -anacron' means match articles about crontab that DO NOT mention anacron
  • to match a phrase e.g. 'manage system' check the Boolean mode radio button and enclose the phrase in quotes "some phrase ..."
  • in Query expansion mode the search context is expanded beyond the keywords you entered - relevancy of hits may well be degraded

HARDWARE

Sound and Modems

  • Two competing sound implementations
    Open Sound System (OSS)

    initially free software but support for newer sound devices and improvements proprietary. In response, the Linux community abandoned the OSS/free implementation included in the kernel and development effort switched to the replacement Advanced Linux Sound Architecture (ALSA).

    some Linux distributions, such as Ubuntu, have chosen to disable OSS support in their kernels and ignore any bugs filed against OSS4 packages(although OSS support may be re-enabled on Ubuntu.

    Open Sound System - wiki

    Advanced Linux Sound Architecture (ALSA)

    abstraction layer for the hardware device. Support is provided via kernel modules. With Kernels 2.4 and earlier settings are stored in /etc/modules.conf. With Kernels 2.6 and later they are stored in /etc/modprobe.conf

    PulseAudio is a software mixing layer. It permits multiple streams to converge as one stream presented to a single hardware source.

  • Working with sound modules

    List currently loaded kernel sound modules

    (2008/9)
    $ lsmod | grep snd 
    snd_hda_intel         559028  3 
    snd_pcm_oss            52352  0 
    snd_mixer_oss          24960  1 snd_pcm_oss
    snd_pcm                99464  2 snd_hda_intel,snd_pcm_oss
    snd_seq_dummy          11524  0 
    snd_seq_oss            41984  0 
    .....
    
    (2013)
    $ lsmod | grep snd
    snd_hda_codec_conexant    62000  1 
    snd_hda_intel          39619  1 
    snd_hda_codec         136498  2 snd_hda_codec_conexant,snd_hda_intel
    snd_hwdep              13602  1 snd_hda_codec
    snd_pcm                97451  2 snd_hda_codec,snd_hda_intel
    snd_page_alloc         18710  2 snd_pcm,snd_hda_intel
    snd_seq_midi           13324  0 
    snd_seq_midi_event     14899  1 snd_seq_midi
    snd_rawmidi            30180  1 snd_seq_midi
    snd_seq                61554  2 snd_seq_midi_event,snd_seq_midi
    snd_seq_device         14497  3 snd_seq,snd_rawmidi,snd_seq_midi
    snd_timer              29425  2 snd_pcm,snd_seq
    snd                    68876  11 snd_hwdep,snd_timer,snd_hda_codec_conexant, \
                                     snd_pcm,snd_seq,snd_rawmidi,snd_hda_codec,  \
                                     snd_hda_intel,snd_seq_device
    soundcore              12680  1 snd
    
    $ cat /proc/asound/modules
     0 snd_hda_intel
    

    Can remove the sound modules 'snd_hda_intel' does not depend on, directly or indirectly e.g. 'snd' depends on 'soundcore', 'snd_hda_intel' depends on 'snd' so it indirectly depends on 'soundcore'.

    To be sure ..

    $ modprobe --show-depends snd_hda_intel
    insmod /lib/modules/3.8.0-31-generic/kernel/sound/soundcore.ko 
    install /sbin/modprobe --ignore-install snd $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist snd-ioctl32 ; \
            /sbin/modprobe --quiet --use-blacklist snd-seq ; } 
    insmod /lib/modules/3.8.0-31-generic/kernel/sound/core/snd-timer.ko 
    insmod /lib/modules/3.8.0-31-generic/kernel/sound/core/snd-page-alloc.ko 
    install /sbin/modprobe --ignore-install snd-pcm $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist snd-pcm-oss ; : ; } 
    insmod /lib/modules/3.8.0-31-generic/kernel/sound/core/snd-hwdep.ko 
    insmod /lib/modules/3.8.0-31-generic/kernel/sound/pci/hda/snd-hda-codec.ko 
    insmod /lib/modules/3.8.0-31-generic/kernel/sound/pci/hda/snd-hda-intel.ko 
    

    Remove unused sound modules (effective till next reboot) - /sbin/modprobe

    Old example:

    $ sudo modprobe -r snd_pcm_oss
    $ sudo modprobe -r snd_mixer_oss snd_seq_oss snd_seq_dummy snd_seq_midi
    
    $ lsmod | grep snd
    snd_hda_intel         559028  5 
    snd_pcm                99464  2 snd_hda_intel
    snd_timer              34064  1 snd_pcm
    snd                    78920  13 snd_hda_intel,snd_pcm,snd_timer
    soundcore              16800  1 snd
    snd_page_alloc         18704  2 snd_hda_intel,snd_pcm
    
  • Player for ALSA soundcard driver
    /usr/bin/aplay
    $ aplay --help
    Usage: aplay [OPTION]... [FILE]...
    
    -h, --help              help
        --version           print current version
    -l, --list-devices      list all soundcards and digital audio devices
    -L, --list-pcms         list device names
    -D, --device=NAME       select PCM by name
    

    Many more options - see man pages.

    List audio devices

    $ aplay --list-devices
    **** List of PLAYBACK Hardware Devices ****
    card 0: Generic [HD-Audio Generic], device 0: CONEXANT Analog [CONEXANT Analog]
      Subdevices: 1/1
      Subdevice #0: subdevice #0
    

    Determine PCI bus-id of sound card

    $  lspci | grep [Aa]ud
    00:14.2 Audio device: Advanced Micro Devices [AMD] FCH Azalia Controller (rev 01)
    
  • Query kernel for sound card information
    /proc/asound

    The kernel should have created directories in /proc virtual filesystem, under /proc/asound, for each sound card found.

    $ ls /proc/asound
    card0  cards  devices  Generic  hwdep  modules  pcm  seq  timers  version
    
    $ cat /proc/asound/cards
     0 [Generic        ]: HDA-Intel - HD-Audio Generic
                          HD-Audio Generic at 0xf0340000 irq 16
    
    $ cat /proc/asound/devices
      1:        : sequencer
      2: [ 0- 0]: digital audio playback
      3: [ 0- 0]: digital audio capture
      4: [ 0- 0]: hardware dependent
      5: [ 0]   : control
     33:        : timer
    
    $ cat /proc/asound/modules
     0 snd_hda_intel
    
  • Test default (alsa) confiuration
    /usr/bin/aplay
    $ cat /dev/urandom | aplay
    Playing raw data 'stdin' : Unsigned 8 bit, Rate 8000 Hz, Mono
    ^CAborted by signal Interrupt...
    

    If the default card worked you'll hear hissing - like a modem. CTRL-C to abort.

    Get device hw address and test using that

    $ cat /proc/asound/card0pcm0c/info
    card: 0
    device: 0
    subdevice: 0
    stream: CAPTURE
    .....
    
    $ cat /dev/urandom | aplay -D hw:0,0 --format=S16_LE --channels=2
    Playing raw data 'stdin' : Signed 16 bit Little Endian, Rate 8000 Hz, Stereo
    Warning: rate is not accurate (requested = 8000Hz, got = 44100Hz)
             please, try the plug plugin 
    ^CAborted by signal Interrupt...
    

    HW = 0,0 (card, device). This way you can target a specfic device if you have more than 1 sound card.

    Flash test with the 'dd' command

    $ dd if=/dev/urandom count=5 | aplay
    

    Source - wiki

  • Not ALSA, not OSS

    Guess we're going back in time a bit here - seems like yesterday ...

    • when neither ALSA or OSS are installed supported sound cards can still be configured.
    • in 'theory' the resource data (descriptions, IO ports, interrupts, DMA channels ...) that a card requires or needs in order to work should be stored in the card's ROM.
    • on Windows OS the 'Plug and Play subsystem' can access a card's ROM, on Linux this is the sndconfig's role.
    • unfortunately the information stored in a card's ROM can be inaccurate or absent - as in the case of cards 'designed' for a Windows OS only. In such cases drivers along with installation software are provided with the card.

    Modules for supported cards can be found under /lib/modules//kernel/sound.

  • Text based sound configuration tool
    sndconfig (obsolete)

    By obsolete I mean it is no longer in this (lubuntu's) distribution's repository.

    • a text based tool, it uses 'pnpdump' to probe for ISA and PCI sound devices and updates /etc/modules.conf (or modprobe.conf). If none are found it prompts for device name and IO settings.
    • it aims to configure the correct kernel module for the card and configure it to use the resource data it can find in the card's ROM.
    • it does not detect IO conflicts.
    • if 'sndconfig' is unable to find a card a list is presented from which the appropriate card can be selected (if it is supported). Once done a further screen is presented through which the card's resources can be configured.
    sndconfig [--noprobe | --noautoconfig | --help]
    

    Card reported as not supported and is fairly common

    # sndconfig --noprobe
    

    Probing for the card is by-passed and the 'card type selection screen' is presented. If still no joy look to installing ALSA or OSS.

  • Modems (dated)
    Type Connection
    External Attached via RS-232 to serial port, can get USB ones now
    Internal ISA or PCI representing themselves (usually) as a standard serial device /dev/ttyS0, ttyS1, ...
    WinModems

    also known as Softmodem, HCF, HSP and HSF modem or controllerless modem.

    Linux will generally not work with these modems as part of their control functionality is handled by software which has been designed specifically for MS Windows systems.

    LinModems

    more commonly known as Controllerless modems. Many of these will work with Linux (check out www.linmodems.org). The communication device needs to match the system's bus type and be supported by Linux.

    Technology Configuration mode
    ISDN Synchronous, block mode, PPP
    Modems Asynchronous, character mode
    ADSL Often PPPoE (point-to-point over ethernet), ISP has provided a username and password
    ATM May use PPPoA (point-to-point over Asynchronous Transfer Mode) though this is very rare
  • Get, set Linux serial port information
    /bin/setserial
    • a program designed to set and/or report the configuration information associated with a serial port.
    • during normal boot serial ports COM 1-4 are initialised with default IOport an IRQ values.
    • typically called from an 'rc.serial' script, which is usually run out of '/etc/rc.local', to configure additional serial ports.

    Relevant files include:

    /etc/serial.conf          Command configuration file
    /etc/init.d/setserial     Start/stop script
    /proc/interrupts          If serial device isn't in use there will be NO interrupts listed for it
    /proc/ioports             Does not show actual hardware configuration, ONLY shows same info
    /proc/tty/driver/serial   Possibly erroneous, if not, same info as setserial
    

    Command usage

    setserial [-abqvVWz] device [parameter1 [arg] ] ...
    setserial -g [-abGv] device1 ...
    
    Some options:
     -a        Print all available information.
     -b        Print a summary of information that may be useful in a /etc/rc script.
     -g        Use if more than one device given on the cmd-line.
     -G        Print in a format that can be used as cmd-line args to setserial.
     -q        Quiet. Print less information.
     -v        Verbose. Print more information.
     -V        Display version information and exit
     -z        Zero flags.
    

    Get,set Linux serial port information

    $ setserial -g /dev/ttyS[0-3]
    /dev/ttyS0, UART: 16550A,  Port: 0x03f8, IRQ: 4   (COM1)
    /dev/ttyS1, UART: unknown, Port: 0x02f8, IRQ: 3   (COM2)
    /dev/ttyS2, UART: unknown, Port: 0x03e8, IRQ: 4   (COM3)
    /dev/ttyS3, UART: unknown, Port: 0x02e8, IRQ: 3   (COM4)
    

    Print out configuration in a format that can be used as args to setserial cmd

    $ setserial -G /dev/ttyS0
    /dev/ttyS0 uart 16550A port 0x03f8 irq 4 baud_base 115200 spd_normal skip_test