JTK – Notes and Ramblings Things we have found …

12/30/2012

Reset the Haupauge WinTV unit

Filed under: General,MythTV — taing @ 11:24 pm

Once again after a restart the Haupauge unit was not seen by the backend.

The systems here are all upgraded to mythbuntu 12.04LTS and Myth .26.

I tried:

sudo usb_modeswitch -v 2040 -p 7501 -R

And had success. A “sudo shutdown -r now” with no sucess. In the past a power cycle of the devvice and the PC were required.

1/22/2012

hostapd and mythbuntu

Filed under: General,MythTV — taing @ 10:16 pm

We were looking to use the wireless card in the Acer Revo mythbuntu box as a wireless access point to extend the wifi coverage in the system. The solution is the hostapd package and a bit of configuration.

In our setup, there is a separate machine acting as primary gateway/router to the internet/DSL modem. We want the new “access point” to have the same SSID and security settings as the existing WAP. We will configure it to use a different B/G channel. The Acer Revo is connected to the main WAP and the router/gateway by wired ethernet so we will bridge the wired ethernet to the wireless interface. In this configuration the existing router/gateway will provide the DHCP services and gateway to the internet.

There were two main articles on the web I used as reference: http://www.su-root.eu/computing/turn-your-linux-computer-in-a-wireless-access-point-using-hostapd and http://blog.robin.smidsrod.no/2008/08/08/how_to_setup_an_atheros_based_access_poi.

The basic steps are to install hostapd, enable IP forwarding disable “NetworkManager” and configure the bridge. The final step is to make this automatic at startup. Our systems are running Mythbuntu Lucid (10.4) and all went well.

The Avec Revo units have a wireless card based on an Atheros chipset. This allows you to use the ath9k kernel driver. For this driver the you must use hostapd to set Master mode for the card. You will not be able to do this with iwconfig alone.

After installing hostapd via apt-get, the second part of the setup is to disable “NetworkManager” and create the appropriate bridge configuration is /etc/network/interfaces :
auto lo
iface lo inet loopback

iface eth0 inet manual

auto br0
iface br0 inet dhcp
#for testing you may want to leave wlan0 out of the bridge and add manually when hostapd is running
bridge-ports eth0 wlan0

iface wlan0 inet manual

For testing you can add or remove the wlan0 interface from the bridge using brctl addif br0 wlan0 or brctl delif br0 wlan0.

You will need to enable IP forwarding with echo 1 > /proc/sys/net/ipv4/ip_forward. If you have iptables or other firewall setup you will need to edit the config to allow the correct traffic.

The sample /etc/hostapd/hostapd.conf file from the link article worked well:
#wireless interface to use as AP
interface=wlan0

#bridge device (needed for madwifi & nl80211 drivers)
bridge=br0

#driver interface type (hostapd/wired/madwifi/prism54/test/none/nl80211/bsd)
# Use nl80211 for wifi drivers that implement MAC80211 interface
#You should set this to your relevant driver interface type
driver=nl80211

#Enables logging to standard output (useful for debugging)
logger_stdout=-1
logger_stdout_level=2

#Set SSID to use
ssid=YOUR_SSID

# Operation mode (a = IEEE 802.11a, b = IEEE 802.11b, g = IEEE 802.11g)
# note your card may not support every mode.
hw_mode=g

#Channel to use (1-13)
channel=6

auth_algs=3

max_num_sta=5

#Enable WPA2
wpa=2

#Set passphrase for WPA
wpa_passphrase=YOUR_PASSWORD
wpa_key_mgmt=WPA-PSK

# Set of accepted cipher suites (encryption algorithms) for pairwise keys
wpa_pairwise=TKIP CCMP
# Pairwise cipher for RSN/WPA2 (default: use wpa_pairwise value)
rsn_pairwise=CCMP

For testing you can start hostapd with sudo hostapd -d /etc/hostapd/hostapd.conf. Once all is working well you can make this a bit more automatic. If you have wlan0 set as part of br0 in /etc/network/interfaces, the only step left is to edit /etc/defaults/hostapd to set RUN_DAEMON="yes". This will allow hostapd to start at boot and allow you to use /etc/init.d/hostapd start|stop|restart to control.

For debugging you can use brctl show to view the members of the bridge. You can use hostapd_cli to control the operation of the WAP service.

1/15/2012

Change the Master Google Account for an Android Phone

Filed under: General — taing @ 9:46 pm

For my Samsung Moment from Sprint I wanted to change the main Google account without factory defaulting the phone. I followed the instructions found at http://androidforums.com/ally-all-things-root/337386-remove-main-google-account-android-without-doing-factory-reset.html.

The core is to rename /data/system/account.db to /data/system/account.db.bak. You will ten need to enter the new account info when you attempt to access any of the google services – for example Market.

1/4/2012

Problem after Mythbuntu 11.10 upgrade

Filed under: General,MythTV — taing @ 10:28 pm

After upgrading Mythbuntu to 11.10 we encountered an error that showed in syslog as a segfault in Unity-Greeter. Fortunately the system was still accessible via SSH and console. The solution was found in a thread on ubuntuforums.com.

The core of the solution is to edit /etc/lightdm/lightdm.conf and remove this line:
greeter-session=unity-greeter

Galaxy Tab 7.0+ Root w/ recovery

Filed under: General — taing @ 12:22 pm

We found very simply instructions for rooting our Galaxy 7.0 Plus at the xda developers forum.

Copy the zip file to the root of an external microsd card.

Restart in Recovery Mode – press and hold Volume Up while powering up.

Use the volume up/down buttons to move the highlight up and down, and the power button to select the highlighted option.

1. Select “apply update from external storage”

2. Select the file you placed on your storage card (starts with “p6210_CWMR”.)

3. Sit back and watch it run. Read the information that is being sent to the screen. If there’s an error, it’ll display some message. If it works, it’ll display a message starting with the word “Done!”

4. Select “reboot system now.”

You now have a CWM-based recovery installed, and your tablet is rooted.

Install the SuperUser application directly from the android market.

….

The attached zip file is from December 10, 2011.p6210_CWMR_20111210

Galaxy Tab 7+ sdcard r/w

Filed under: General — taing @ 11:56 am

The Galaxy Tablet 7.0 Plus does not be default allow third party File management application write to the external sdcard. This is a permissions issue. The solution found at the xda developers forum is:

Simple solution for external sdcard write access on Android 3.2…if you’re rooted

I’ve found a simple solution for gaining write access to the external sdcard (/mnt/sdcard2) on Android 3.2. The sdcard is mounted r/w, but the owning group is media_rw which is linked to the WRITE_MEDIA_STORAGE permission. Unfortunately, this permission was not required for access to the external sdcard prior to 3.2 so most file management utilities do not request it when they run…meaning they only have read access to the card.

The simple solution, if you’re rooted, is as follows:
1. Using a root-enabled file manager, navigate to /system/etc/permissions and make sure you have mounted the file system r/w.
2. Edit platform.xml and find the WRITE_EXTERNAL_STORAGE permission.
3. Add an additional group definition for this permission… 4. Save the changes to the file.
5. Restart your tablet.

After this change, any apps that request the WRITE_EXTERNAL_STORAGE permission (which includes almost anything that access either of the sdcards) will gain group membership in both sdcard_rw AND media_rw, giving them r/w access to both sdcard filesystems.

To mount the filesystem read only use mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system

I found an easy solution was to copy the platform.xml file to somewhere with easy access from the PC, edit the file on the PC and copy it back to the system location with a su-ed shell.

Kies kill SyncToy

Filed under: General,Router/PC Config — taing @ 11:50 am

After installing Samsung Kies software for the Galaxy Tab SyncToy started giving a “failed to create provider” error. The solution is to “repair” the MS Sync Framework. This is easily done from “Add/Modify Programs”.

8/7/2011

AsteriskNOW Web Voicemail

Filed under: General,Router/PC Config — taing @ 11:13 pm

After all what’s the point of Asterisk Voicemail if you don’t enable a web interface. Unfortunately the web interface is not packaged with AsteriskNow.

We found some very useful instructions at http://www.voip-info.org/wiki/view/Asterisk+gui+vmail.cgi. The the biggest problem with those instructions is the need to download/install the asterisk source tree.

The instructions have you install apache, perl-suidperl with yum and the DBI module for perl(we used webmin for the perl module).

Then we found a copy of vmail.cgi and copied it directly to /var/www/cgi-bin. Once we made it executable and followed the rest of the instructions regarding Perl modules almost everything was ready to go.

You can grab a copy of what we used here: vmail.cgi

There is a broken image tag that can easily be resolved either by editting the .cgi file or downloading the file from the Asterisk source tree and copying it to the proper place in /var/www.

The remaining step was to make sure the apache cgi job had write access to the /var/spool/asterisk/voicemail tree. I’m sure there is a more complex and more secure means but simply adding the permissions og+rw to the tree made everything work.

AsteriskNOW GUI via SSL

Filed under: General,Router/PC Config — taing @ 8:40 pm

You’ve already seen how to enable the Asterisk Manager interface and the GUI webserver. What is needed now is adding SSL for the added layer of security.

The /etc/asterisk/manager.conf file contains some of the info and further hints were found scattered about on the web.

Hopefully you already have OpenSSL installed. If not then try yum install openssl.

First for the manager interface. Add the block to the config.

sslenable=yes                           ; set to YES to enable it
sslbindport=5039                        ; the port to bind to
sslbindaddr=192.168.0.100               ; address to bind to, default to bindaddr
sslcert=/etc/asterisk/cert.pem          ; path to the certificate.

You can build the sslcert with:

openssl req -new -x509 -days 365 -nodes -out /etc/asterisk/cert.pem -keyout /etc/asterisk/cert.pem

The parts above are actually pretty well documented online and adds the SSL layer for the management interface. The real secret was to add a similar block to /etc/asterisk/http.conf.

sslenable=yes                           ; set to YES to enable it
sslbindport=8089                        ; the port to bind to
sslbindaddr=192.168.0.100                ; address to bind to, default to bindaddr
sslcert=/etc/asterisk/cert.pem          ; path to the certificate.

After adding this and a service asterisk restart you should be able to browse to https://yourserver:8089.

The certificate we created above is not signed by any authority and will need to be added to your browser as an exception.

AsteriskNOW GUI startup

Filed under: General,Router/PC Config — taing @ 5:34 pm

When setting up our AsteriskNOW 1.7 box there were a few things we thought we should note.

All of the config files for Asterisk are located at /etc/asterisk.

You may want to edit /etc/asterisk/manager.conf to adjust usernames and passwords. The default is user=admin, password=password.

In our case we wanted to edit /etc/asterisk/manager.conf and /etc/asterisk/http.conf to have the management and http systems only bind to the internal lan interface not the public interface.

CentOS gateway and dynamic DNS

Filed under: General,Router/PC Config — taing @ 3:27 pm

For the AsteriskNOW box we are using as our main Internet gateway we needed to support automatic updating via dyndns.org. The solution was ddclient found at sourceforge.

After downloading the tgz file and unpacking into a temp folder with tar -xzvf ddclient*, the README file included contains good instruction for installing.

You will need to edit the /etc/ddclient/ddclient.conf file. In our case, we configured using:

daemon=300			# check every 300 seconds
syslog=yes			# log update msgs to syslog
mail=root			# mail all msgs to root
mail-failure=root		# mail failed update msgs to root
pid=/var/run/ddclient.pid 	# record PID in file.
ssl=yes 			# use ssl-support. Works with ssl-library
# postscript=script 		# run script after updating. The new IP is added as argument.
#
use=if, if=ppp0
#
login=username 			# default login
password=password 		# default password
#mx=mx.for.your.host 		# default MX
#backupmx=yes|no 		# host is primary MX?
#wildcard=yes|no 		# add wildcard CNAME?
#
server=members.dyndns.org, \
protocol=dyndns2 \
somewhere.mine.nu

AsteriskNOW and mp3 voicemail

Filed under: General,Router/PC Config — taing @ 2:57 pm

AsteriskNOW is very easy to setup for voicemail to email. The problem is the formats Asterisk likes for voicemail are not ideal choice to be received by todays mobile devices. wav49 and gsm are not support by many of the mobile devices that might receive the email. wav is uncompressed and therefore huge and unwieldy for email. I found an nearly ideal solution at http://bernaerts.dyndns.org/linux/179-asterisk-voicemail-mp3.

I’ll repeat the core of the article here.

You will need to be sure you have lame and dos2unix installed on your system. For my AsteriskNOW distro dos2unix was already present and a yum install lame solved the rest.

The main script is copied to /usr/sbin/sendmailmp3. Be sure to make the script executable.

You will need to add/modify the mailcmd line in /etc/asterisk/voicemail.conf.

mailcmd=/usr/sbin/sendmailmp3

I found it necessary to also change the format line in /etc/asterisk/voicemail.conf

format = wav|gsm|wav49

Asterisk will save the voicemail in all three formats but the first one listed is the format emailed. By putting wav first you send the uncompressed wav file to our new script and make the re-encoding process simpler.

The main script:

#! /bin/sh
# save the current directory
CURDIR=`pwd`

# create a temporary directory and cd to it
TMPDIR=/tmp/mail`head -1 /dev/urandom | od -N 1 | awk '{ print $2 }'`
if [ ! -d $TMPDIR ] ; then mkdir $TMPDIR ; fi
cd $TMPDIR

# dump the stream to a temporary file
cat >> stream.org

# get the boundary
BOUNDARY=`grep "boundary=" stream.org | cut -d'"' -f 2`

# cut the file into parts
# stream.part - header before the boundary
# stream.part1 - header after the bounday
# stream.part2 - body of the message
# stream.part3 - attachment in base64 (WAV file)
# stream.part4 - footer of the message
awk '/'$BOUNDARY'/{i++}{print > "stream.part"i}' stream.org

# cut the attachment into parts
# stream.part3.head - header of attachment
# stream.part3.wav.base64 - wav file of attachment (encoded base64)
sed '7,$d' stream.part3 > stream.part3.wav.head
sed '1,6d' stream.part3 > stream.part3.wav.base64

# convert the base64 file to a wav file
dos2unix -o stream.part3.wav.base64
base64 -di stream.part3.wav.base64 > stream.part3.wav

# convert wav file to mp3 file
# -V 2 is a good compromise between quality and size for voice audio files
lame -V 2 stream.part3.wav stream.part3.mp3

# convert back mp3 to base64 file
base64 stream.part3.mp3 > stream.part3.mp3.base64

# generate the new mp3 attachment header
# change Type: audio/x-wav to Type: audio/mpeg
# change name="msg----.wav" to name="msg----.mp3"
sed 's/x-wav/mpeg/g' stream.part3.wav.head | sed 's/.wav/.mp3/g' > stream.part3.mp3.head

# generate first part of mail body, converting it to LF only
mv stream.part stream.new
cat stream.part1 >> stream.new
cat stream.part2 >> stream.new
cat stream.part3.mp3.head >> stream.new
dos2unix -o stream.new

# append base64 mp3 to mail body, keeping CRLF
unix2dos -o stream.part3.mp3.base64
cat stream.part3.mp3.base64 >> stream.new

# append end of mail body, converting it to LF only
echo "" >> stream.tmp
echo "" >> stream.tmp
cat stream.part4 >> stream.tmp
dos2unix -o stream.tmp
cat stream.tmp >> stream.new

# send the mail thru sendmail
cat stream.new | sendmail -t

# go back to original directory
cd $CURDIR

# remove all temporary files and temporary directory
rm -Rf $TMPDIR
« Newer PostsOlder Posts »

Powered by WordPress