Friday, August 22, 2014

One Way to Bypass ISP DNS Interception on Linux


There are multiple ways to bypass ISP DNS interception. If you are using Linux, one of the easiest way you can try is by redirecting all DNS lookups to port 53 from your PC to an "alternate" DNS port 5353 provided by OpenDNS. What you need is nothing but iptables.

Execute the following commands as root.

# iptables -t nat -A OUTPUT -p udp --dport 53 -j DNAT --to 208.67.222.222:5353
# iptables -t nat -A OUTPUT -p tcp --dport 53 -j DNAT --to 208.67.222.222:5353

The commands above will redirect all DNS lookup to port 53 from your PC to OpenDNS server on port 5353.

The advantages of using OpenDNS instead of your ISP DNS are:
  1. OpenDNS can be faster than your ISP DNS
  2. You can access websites blocked by your ISP DNS (yay!).
References:

Sunday, June 29, 2014

Epson Scanner Driver Build for Raspbian

So, what is this exactly?

This is actually a rebuild of iscan packages for Raspbian Wheezy.

What are iscan packages?

iscan packages are official packages provided by EPSON which contains linux driver and utility for their scanners and all-in-ones. They are provided in *.rpm, *.deb, and *.tar.gz format.

This build does not include EPSON Image Scan! utility!

Yes, EPSON Image Scan! utility has been disabled on this build. This is because it requires an EPSON proprietary library which is only available on i386 and AMD64.

How do I use my scanner then?

You can use XSane, Simple Scan, or any other SANE front-ends. If you are running headless, you can use scanimage (man scanimage).

How does it perform?

75 dpi is okay. 150 dpi is slow - but still acceptable. Above 150 dpi, it is very very slow.

Files

iscan_2.29.3-1local1_armhf.deb
iscan-data_1.28.0-2_all.deb
iscan_2.29.3-1local1.dsc
iscan_2.29.3-1local1.tar.gz


Monday, May 5, 2014

BCM43142 Bluetooth: Getting It to Work on Debian Jessie

UPDATE 2015-04-30: These steps are now OBSOLETE. The updated steps are here.
UPDATE 2014-05-08: Add info to keep bluetooth working after suspend/hibernate.


Overview

In this post, I will write the steps that I took to get BCM43142 bluetooth (105b:e065) working on Debian Jessie by porting patches from Ubuntu. Basically, there are two (2) things that need to be done.
  1. Patch and recompile btusb kernel module to support BCM43142 firmware loading.
  2. Get the actual hex firmware for BCM43142 from a Windows installation (yes, you read that right) and convert it to hcd format by using hex2hcd.

Patching and Recompiling btusb Kernel Module

  1. Download and unpack kernel source: $ apt-get source linux.
  2. Download patches for Ubuntu kernel git.
    • $ wget -O bcm43142-1.patch -c "http://kernel.ubuntu.com/git?p=ubuntu/ubuntu-trusty.git;a=patch;h=a0d51082d501dfa1238d591707472d19ce145334"
    • $ wget -O bcm43142-2.patch -c "http://kernel.ubuntu.com/git?p=ubuntu/ubuntu-trusty.git;a=patch;h=176cc999e91c322cbdf8d0812198d5c93377e4de"
    • $ wget -O bcm43142-3.patch -c "http://kernel.ubuntu.com/git?p=ubuntu/ubuntu-trusty.git;a=patch;h=d48ff3f7cec9528442bae8775312092098c99078"
    • $ wget -O bcm43142-4.patch -c "http://kernel.ubuntu.com/git?p=ubuntu/ubuntu-trusty.git;a=patch;h=e9ec28bf29304076f1f51a274cafa92c114e3417"
    • $ wget -O bcm43142-5.patch -c "http://kernel.ubuntu.com/git?p=ubuntu/ubuntu-trusty.git;a=patch;h=6e9c2318d11c3b144ef51e7bac5aa8dbf138565b"
    • $ wget -O bcm43142-6.patch -c "http://kernel.ubuntu.com/git?p=ubuntu/ubuntu-trusty.git;a=patch;h=679a33feea93e910a05614c8abe50a2e9aec7228"
  3. Switch to unpacked kernel source dir and apply the six (6) patches downloaded earlier in sequence.
    • $ cd linux-3.13.10 
    • $ patch -p1 < ../bcm43142-*.patch
  4. Still inside the unpacked kernel source dir, recompile btusb module and install it.
    • $ cp /lib/modules/$(uname -r)/build/Module.symvers ./
    • $ make oldconfig
    • $ make prepare
    • $ make modules_prepare
    • $ make modules SUBDIRS=drivers/bluetooth
    • # cp drivers/bluetooth/btusb.ko /lib/modules/$(uname -r)/kernel/drivers/bluetooth/btusb.ko
    • # depmod

Getting HEX Firmware for BCM43412 and Convert It to HCD Format

  1. Get hex firmware for BC43412 from a Windows installation under C:\Windows\System32\Drivers. The file name should be like BCM43142A0_*.hex.
  2. Download and compile hex2hcd from https://github.com/jessesung/hex2hcd/archive/master.zip.
    • $ wget "https://github.com/jessesung/hex2hcd/archive/master.zip"
    • $ unzip master.zip
    • $ cd hex2hcd-master
    • $ make
  3. Convert the hex firmware to hcd format and place it in /lib/firmware with the file name "fw-105b_e065.hcd" (since according to the lsusb, the hardware is 105b:e065).
    • # ./hex2hcd BCM43142A0_*.hex /lib/firmware/fw-105b_e065.hcd
After executing all the steps above, reboot the laptop. When the laptop started again, the bluetooth might still be blocked by rfkill. Unblock it using the following command.

# rfkill unblock bluetooth

The bluetooth should be working now.

To keep bluetooth working after suspend/hibernate, make btusb kernel module to be reloaded automatically every after suspend/hibernate. You can use the following command to do this.

# cat << EOF > /etc/pm/config.d/btusb
SUSPEND_MODULES="$SUSPEND_MODULES btusb"
EOF

Any feedback, please write it on the comments below.