Category Archives: hw support

Cheap usb-ethernet adapter for MacOSX

I recently purchased a cheap usb-ethernet adapter for my Macbook Air for just 5 EUR.
The model name is KY-LANRD9700, it’s a usb 2.0 to ethernet 100Mbps adapter and it uses the AX88772 chipset.
The USB id is: 0x9700:0x0fe6

This chipset is fully supported under MacOSX. You can download the driver from ASIX website.

No need to spend 30 EUR on the official usb-ethernet adapter from Apple!

Share

Alpine x305s vs iTunes

I recently purchased a new headunit for my car audio entertainment. The choice fell on an Alpine x305s model.
It belongs to the “media receiver” category: it can play music files from USB drives and iPods, but not CDs. It has no moving mechanic parts and therefore it’s less likely to break with intense use.

I mostly use it with a 32GB Sandisk USB Cruzer blade drive formatted as FAT32.

It works just fine and browsing the directories is really fast, even when loading thousands of files on the USB drive (the Kendwood headunit that I bought back in 2006 was much slower).

The headunit can read both MP3 and M4A/MP4/AAC-LC files. I copied my whole iTunes Library on the USB drive and tried to play it on the Alpine X305s. Unfortunately for many files I got the infamous “Unsupported file format” error.
I decided to examine these files to find out what they have in common and discover a possible common cause for the problem. It turned out that all these files had an encoding bitrate greater than 320Kbps. I searched the headunit manual and indeed the max supported bitrate for M4A files is 320Kbps.

Apparently at least half of the albums that you can buy on iTunes have a bitrate greater than 320Kbps.

If you are not tech-savvy you might just want to convert these files to MP3 using iTunes and be done with it.

If you are a true audiophile and would like to keep the files in MP4/M4A format then keep on reading.
I put together a simple bash script that you can use on MacOSX/Linux/BSD to find and convert m4a files with a bitrate greater than 320Kbps to 320Kbps.
I assume that you have ffmpeg installed on your machine. It’s available in macports, apt, yum.


#!/bin/bash
BASEDIR=$1
TEMPFILE=”$(mktemp /tmp/temp-XXXXXXX).m4a”

if ! [ -d “$BASEDIR” ]; then
echo Syntax: $0 /path
exit 1
fi

IFS=”

for i in $(find $BASEDIR -size +5M -type f -name ‘*.m4a’);do
IFS=” ”
BITRATE=$(ffmpeg -i “$i” 2>&1|grep Duration|grep bitrate|cut -d ‘ ‘ -f 8)
echo $i has bitrate $BITRATE
if [ “$BITRATE” -gt “320” ]; then
ffmpeg -v 5 -y -i “$i” -acodec libfaac -ac 2 -ab 320k \
-map_metadata 0 $TEMPFILE
mv $TEMPFILE “$i”
fi
#exit
done

I recommend working on a copy of your iTunes library and not the original files.
Depending on your installed version of ffmpeg, you might need to adjust the BITRATE= line to extract the value of the bitrate from “ffmpeg -i file.m4a” output.

After running the script against the m4a files on my USB thumb drive, I was able to play all the files on my x305s!

Share

Huawei E1750 3G USB modem on OpenWRT Kamikaze

I recently configured a Netgear WGT634U access point running OpenWRT Kamikaze 8.09.2 to use a HUAWEI E1750 3G modem.

The HUAWEI E1750 is sold under different names, some people report it as E220 or E1752. You should check in /proc/bus/usb/devices what is the vendor and product id of your 3G modem. You should see the following values:
vendor=0x12d1 product=0x1446

This howto should apply to all 3G USB modems with the same vendor and product id and any AP running OpenWRT Kamikaze 8.09.2.
Here is how I got the whole thing running:

1. Install the required kernel modules and utilities:


# opkg update
# opkg install kmod-usb-acm kmod-usb-core kmod-usb-ohci kmod-usb-serial comgt \
kmod-usb-serial-option kmod-usb-storage kmod-usb-uhci kmod-usb2 usb-modeswitch

2. Create or edit the file /etc/modules.d/60-usb-serial so that it only contains the following line:

usbserial vendor=0x12d1 product=0x1446

3. Create or edit the file/etc/usb_modeswitch.conf so that it looks as follows:

DefaultVendor= 0x12d1
DefaultProduct=0x1446
TargetVendor= 0x12d1
TargetProductList="1001,1406,140c,14ac"
CheckSuccess=20
MessageEndpoint=0×01
MessageContent="55534243123456780000000000000011060000000000000000000000000000"

4. Add the following section to /etc/config/network:

WARNING!!! Depending on the model of your 3G modem you may need to replace ttyUSB0 with ttyUSB1, ttyUSB2, etc. Check the output of “dmesg” to know which is the correct port. If you are unsure, find out by trial-and-error.

config 'interface' 'ppp0'
option 'ifname' 'ppp0'
option 'proto' '3g'
option 'device' '/dev/ttyUSB0'
option 'apn' 'YOURAPNHERE'
option 'pincode' 'YOURPINCODEHERE'

Replace YOURAPNHERE with the name of your APN (e.g. “tre.it” for H3G Italy) and YOURPINCODEHERE with the PIN code of your SIM.

WARNING!!! If you have disabled PIN code verification for your SIM, you can omit the pincode option but you’ll need to workaround a bug in /lib/network/3g.sh. Open /lib/network/3g.sh in your editor and comment out the following lines:

# PINCODE="$pincode" gcom -d "$device" -s /etc/gcom/setpin.gcom || {
# echo "$cfg(3g): Failed to set the PIN code."
# set_3g_led 0 0 0
# return 1
# }

5. Reboot your OpenWRT device.

6. Manually run the following commands and after a minute verify that your 3G connection is working:

usb_modeswitch
ifup ppp0

7. Add the following lines to the top of /etc/rc.local:

sleep 3
/usr/sbin/usb_modeswitch
sleep 3
/sbin/ifup ppp0

8. Log on the web interface of your OpenWRT device and click on Administration/Networks/Interfaces/ppp0 and add it to the WAN zone.

You may need to adjust the DNS settings manually.

Credits: Peter Andersson

Share