Useful Notes

- ToC Start -
a0 Powering the RPi
a1 Verify if the the hash key is the same (optional), in the terminal run:
a3 locale problem of ssh
a4 finding raspberry's ip! --> arp -a
a8 assigning UX1-EA (usb audio dev.) as a default dev.
-
b01 fsck for raspberry pi
b02 Using scp to transfer files in Linux
b03 blocked RPi
b08 identifying sound card (ex. hw:0,1)
b09 setting file for pd
b10 make a backup of image
b13 identifying the cards.. (for jack..)
b14 where to find current stream info!
b15 starting automatically pd patch.
b16 don't use loadbang -> pd dsp 1; on RPi. NEVER!
- ToC End -



-
a0 Powering the RPi
If you use the micro-USB power input to power the RPi you might encounter sudden reboots when plugging in or unplugging USB devices. If you want to be sure your RPi doesn't reboot in such cases you can try backfeed powering your RPi by connecting the power supply to one of the USB ports or use a powered USB hub that backfeeds. Also make sure your power supply can provide at least 700mA at 5V. If you plan on using an USB interface you might need more power so try to find a power supply that provides 2A or even more.
-
a1 Verify if the the hash key is the same (optional), in the terminal run:
shasum ~/Downloads/2012-12-16-wheezy-raspbian.zip
-
a3 locale problem of ssh
-
Q. perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
   LANGUAGE = (unset),
   LC_ALL = (unset),
   LC_CTYPE = "UTF-8",
   LANG = "en_GB.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
-
A.
-
Does this problem happen if you are using a particular program on the RPi, or is it when you use SSH from another computer?

If it happens when using SSH, this is a fault on the SSH client, not the RPi. For example using an Ubuntu machine as the SSH client will cause this problem.

To fix this SSH problem, edit the file /etc/ssh/ssh_config on the SSH client (not the RPi) and remove the line
SendEnv LANG LC_*

This stops the client sending invalid locale information to the RPi.
-
Thanks bredman, your tip worked for me.
In my case, however, the conf file is /etc/ssh_config (ssh client on Mac Mountain Lion, 10.8.2). I commented like this:
# SendEnv LANG LC_*
and now I can even run python scripts on the raspberry that earlier caused errors like
"UnicodeEncodeError: 'ascii' codec can't encode character ..."
Great!
-
a4 finding raspberry's ip! --> arp -a
-
a8 assigning UX1-EA (usb audio dev.) as a default dev.
-
How to Assign USB Audio as primary sound device in ALSA
-
This is for anyone that has a fried sound card (like me) in their laptop. Instead of replacing the motherboard or tossing your old laptop in the trash, get a pair of USB speakers and follow this procedure:
(This procedure will get sound going without the need of installing pulse audio)
1) Backup the file /etc/modprobe.d/alsa-base.conf
Note: Original alsa-base.conf:
# autoloader aliases
install sound-slot-0 /sbin/modprobe snd-card-0
install sound-slot-1 /sbin/modprobe snd-card-1
install sound-slot-2 /sbin/modprobe snd-card-2
install sound-slot-3 /sbin/modprobe snd-card-3
install sound-slot-4 /sbin/modprobe snd-card-4
install sound-slot-5 /sbin/modprobe snd-card-5
install sound-slot-6 /sbin/modprobe snd-card-6
install sound-slot-7 /sbin/modprobe snd-card-7
# Cause optional modules to be loaded above generic modules
install snd /sbin/modprobe --ignore-install snd && { /sbin/modprobe --quiet snd-ioctl32 ; /sbin/modprobe --quiet snd-seq ; }
install snd-rawmidi /sbin/modprobe --ignore-install snd-rawmidi && { /sbin/modprobe --quiet snd-seq-midi ; : ; }
install snd-emu10k1 /sbin/modprobe --ignore-install snd-emu10k1 && { /sbin/modprobe --quiet snd-emu10k1-synth ; : ; }
# Prevent abnormal drivers from grabbing index 0
options bt87x index=-2
options cx88_alsa index=-2
options snd-atiixp-modem index=-2
options snd-intel8x0m index=-2
options snd-via82xx-modem index=-2
# Keep snd-pcsp from beeing loaded as first soundcard
options snd-pcsp index=-2
# Keep snd-usb-audio from beeing loaded as first soundcard
options snd-usb-audio index=-2

Add:
# Assign USB Audio as default sound card
options snd_usb_audio index=-1

Delete these last TWO lines in the file:
# Keep snd-usb-audio from beeing loaded as first soundcard
options snd-usb-audio index=-2

New file should look like this:
# autoloader aliases
install sound-slot-0 /sbin/modprobe snd-card-0
install sound-slot-1 /sbin/modprobe snd-card-1
install sound-slot-2 /sbin/modprobe snd-card-2
install sound-slot-3 /sbin/modprobe snd-card-3
install sound-slot-4 /sbin/modprobe snd-card-4
install sound-slot-5 /sbin/modprobe snd-card-5
install sound-slot-6 /sbin/modprobe snd-card-6
install sound-slot-7 /sbin/modprobe snd-card-7
# Cause optional modules to be loaded above generic modules
install snd /sbin/modprobe --ignore-install snd && { /sbin/modprobe --quiet snd-ioctl32 ; /sbin/modprobe --quiet snd-seq ; }
install snd-rawmidi /sbin/modprobe --ignore-install snd-rawmidi && { /sbin/modprobe --quiet snd-seq-midi ; : ; }
install snd-emu10k1 /sbin/modprobe --ignore-install snd-emu10k1 && { /sbin/modprobe --quiet snd-emu10k1-synth ; : ; }

# Assign USB Audio as default sound card
options snd_usb_audio index=-1

# Prevent abnormal drivers from grabbing index 0
options bt87x index=-2
options cx88_alsa index=-2
options snd-atiixp-modem index=-2
options snd-intel8x0m index=-2
options snd-via82xx-modem index=-2
# Keep snd-pcsp from beeing loaded as first soundcard
options snd-pcsp index=-2
NOTE 1: If a sound card is not found by ALSA... ALSA config will not make USB the default sound card, so this tells method tells ALSA, USB audio is what you want it to use.
NOTE 2: PCM still needs to be checked in the Alsa Mixer.
NOTE 3: The volume icon will now show up in Tint2 (needs to be unmuted) - reboot may be required.
NOTE 4: The spelling of the word "beeing", it's a typo by the original coder.
-
b01 fsck for raspberry pi

/dev/mmcblk0p2 is the root file system, so it is not easily unmounted. It could probably be re-mounted as read-only, but a simpler way is to schedule a fsck at the next reboot.

sudo touch /forcefsck
then reboot. Or reboot with

shutdown -rF now
which does the same.
-
Where are fsck results logged at boot time, after /forcefsck?
-
pi@raspberrypi /var/log/fsck $ ls -la
total 16
drwxr-xr-x 2 root root 4096 Feb  9 09:52 .
drwxr-xr-x 9 root root 4096 May 16 23:44 ..
-rw-r----- 1 root adm   125 May 16 23:44 checkfs
-rw-r----- 1 root adm   221 May 16 23:44 checkroot
pi@raspberrypi /var/log/fsck $ cat checkroot 
Log of fsck -C -f -a -t ext4 /dev/mmcblk0p2 
Thu May 16 23:44:09 2013

fsck from util-linux 2.20.1
/dev/mmcblk0p2: 67102/237568 files (0.2% non-contiguous), 384740/937984 blocks

Thu May 16 23:44:17 2013
----------------
pi@raspberrypi /var/log/fsck $ cat checkfs 
Log of fsck -C -R -A -a -f 
Thu May 16 23:44:21 2013

fsck from util-linux 2.20.1

Thu May 16 23:44:21 2013
----------------
-
b02 Using scp to transfer files in Linux
-
To copy files from the local system to a remote system:
scp file... user@host.domain:path
-
b03 blocked RPi
-
The new overclocking functionality seems to have destroyed my RasPi.

I updated everything in my Debian distro yesterday to try out the new overclocking functionality. Ran raspi_config and selected the "medium" option (900 mHz, 2 volt, etc.)

The unit ran fine, no hiccups. Just a bit faster. I've had the unit up and running for the better part of 2 weeks now without powering it down, so I left it running overnight at the new speed.

This morning it appears to be dead. Open SSH sessions to my desktop were dead, unit wasn't pingable, and no HDMI video. Removed power and rebooted. Nothing. It looks like the network traffic lights show activity when powered up, but nothing else is working.

So now what? Since this seems to have been a "sanctioned" upgrade, is this a warranty issue? Is it warning to others? Did someone not test this stuff properly?
-
Locked up again, on the very lowest raspi-config overclock setting ("modest"). It continues to require a complete unplugging of everything to get it to reboot.
-
b08 identifying sound card (ex. hw:0,1)

Use "aplay -l" to get a list of the devices on your system. The hw:X,Y comes from this mapping of your hardware -- in this case, X is the card number, while Y is the device number.
-
You might be able to get away with using device aliases instead of the "hw:X,Y" -- this is what the output of "aplay -L" shows. The "something:CARD=FOO,DEV=Y" stuff is the alias, and probably won't change between different device plug-ins
-
b09 setting file for pd
-
$ nano /home/derek/.pdsettings

GNU nano 1.2.4                       File: /home/derek/.pdsettings

audioapi: 5
noaudioin: False
audioindev1: 0 4
noaudioout: False
audiooutdev1: 0 4
audiobuf: 50
rate: 44100
nomidiin: False
midiindev1: 0
nomidiout: False
midioutdev1: 0
path1: /home/derek/pd/rradical/memento
path2: /home/derek/pd/ix_toxy
path3: /home/derek/pd/berlin
path4: /home/derek/pd/rradical/memento/tutorial
path5: /home/derek/workshop_patches
path6: /usr/local/lib/pd/doc/5.reference
path7: /usr/local/lib/pd/extra/xjimmies
npath: 7
standardpath: 1
verbose: 0
loadlib1: pool
loadlib2: iemlib1
loadlib3: iemlib2
loadlib4: iem_mp3
loadlib5: iem_t3_lib
loadlib6: OSC
loadlib7: zexy
nloadlib: 7
defeatrt: 0
flags: -alsamidi -rt
-
b10 make a backup of image
-
using ubuntu live cd. boot with trial mode.
-
sudo fdisk -l
sudo dd if=/dev/sda of=./OldHD.img
-
b13 identifying the cards.. (for jack..)
-
What is the output of
cat /proc/asound/cards
with the DAC attached?

And could you also post the output of
sudo lsusb -vvv
-
b14 where to find current stream info!
(how can i check what is current playback setup at the moment of playback)
-
ccrma@satellite /proc/asound/card0 $ cat stream0 
EDIROL UA-1EX at usb-bcm2708_usb-1.3, full speed : USB Audio

Playback:
  Status: Running
    Interface = 0
    Altset = 1
    Packet Size = 288
    Momentary freq = 44100 Hz (0x2c.199a)
  Interface 0
    Altset 1
    Format: S24_3LE
    Channels: 2
    Endpoint: 1 OUT (ADAPTIVE)
    Rates: 44100

Capture:
  Status: Stop
  Interface 1
    Altset 1
    Format: S24_3LE
    Channels: 2
    Endpoint: 2 IN (ASYNC)
    Rates: 44100
-
reference
-
http://guayadeque.org/index.php?p=/discussion/576/correct-switching-between-16bit-and-24bit-usb-audio-playback/p1
-
b15 starting automatically pd patch.
-
ccrma@satellite ~/on-startup $ cat load_default_patch
#!/bin/bash  
#
# This script starts pd with a default patch (please see all the way below)
#
#
#
# Copyright (C) Feb. 2012 Edgar Berdahl for the Satelite CCRMA project
#
# The above copyright notice including the copyright holders and this
# permission notice shall be included in all copies, substantial
# portions, or derivatives of the Software and Software portions.
#
# The end-user documentation included with the redistribution, if any,
# must include the following acknowledgment: "This product includes
# software developed in the course of the Satellite CCRMA project
# (http://ccrma.stanford.edu/satellite/) and its contributors", in the
# same place and form as other third-party acknowledgments. In
# addition, this acknowledgment must appear in the software itself in
# the same form and location as other such third-party acknowledgments.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation except subject to the additional
# attribution requirements described beneath the copyright notice above.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the modified GNU General Public 
# License along with this program.




# It is necessary to specify the complete path of the pd patch:
#pd -nogui /home/ccrma/on-startup/default-patch.pd
pd -nogui /home/ccrma/puredata/paperPerfm2011_B-E_RPi_nogui.pd
-
b16 don't use loadbang -> pd dsp 1; on RPi. NEVER!
-
Why Doesn't Audio Work When I Start Pd In -Nogui Mode?
When I start Pd from the commandline without the GUI in -nogui mode, it can't connect to the soundcard and no dsp seems to happen?
Currently, there is a bug in Pd where starting in -nogui mode causes patches to be run before it connects to a sound card. When running the graphical user interface (GUI), there is a delay as the GUI is being setup before patches are run and this is enough time for the sound to be connected. Basically, if you are turning on dsp with a loadbang like this:
[loadbang]
|
[; pd dsp 1(
Pd tries to start dsp, but in -nogui mode, it hasn't yet connected to the sound card and you'll get an error similar to this:
snd_pcm_open (input): Device or resource busy 
snd_pcm_open (output): Device or resource busy
If so, you can add a delay before starting the dsp:
[loadbang]
|
[delay 100]
|
[; pd dsp 1(
This should be enough time to mimic the delay taken when the GUI starts and the sound card can be setup before dsp is started.
-
http://puredata.info/docs/faq/why-doesn-t-audio-work-when-i-start-pd-in-nogui-mode