bash warning setlocale LC_CTYPE cannot change locale

OS: ubuntu 12.10

问题

bash: warning: setlocale: LC_CTYPE: cannot change locale

解决

在/etc/profile中加入下行:

export  LC_ALL= C

Android源码编译错误

OS : ubuntu10.04 64bit

问题

Android编译过程中报错:

You are attempting to build with the incorrect version
of java.
Your version is: java version "1.6.0_22".
The correct version is: Java SE 1.6.

解决

  • 从java官方地址http://www.oracle.com/technetwork/java/javase/downloads/jdk-6u31-download-1501634.html 下载Java SE Development Kit 6 Update 31文件

  • 移到/opt目录下

    执行

    chmod +x jdk-6u27-linux-i586.bin
    

    使该文件变为可执行文件

  • 开始安装

    sudo ./jdk-6u27-linux-i586.bin
    
  • 打开 /etc/profile

    在文件最后添加:

    #set java environment
    export JAVA_HOME=/opt/jdk1.6.0_27
    export JRE_HOME=/opt/jdk1.6.0_27/jre
    export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
    export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
    
  • 执行

    source /etc/profile
    

    使环境变量生效

  • 查看当前java版本

    $ java -version
    

adb shell insufficient permissions for device

问题

adb shell – insufficient permissions for device

解决方法

sudo chown root:root adb
sudo chmod u+s adb
adb kill-server 
adb start-server

Using rt2x00 wireless driver with hostapd

The problem

A few month ago i bought an rt73-base usb wifi dongle to make a low-cost access-point from my old linux box. Unfortunately i couldn’t make it work until last week, when i finally figured out the root of the problem. First of all, i used the latest rt2x00 development kernel (how to get it), and the latest hostapd from the git repository. The official howto on the rt2x00 wiki is quite good, but it didn’t work with my TL-WN321G wifi dongle, so i had to find out what’s the problem. First the hostapd started up, and the clients could associate, but when i tried to send packages, the hostapd dropped error messages in an infinite loop:

wlan0: STA 00:12:f0:76:03:b9 IEEE 802.11: association OK (aid 1)MGMT (TX callback) failmgmt::assoc_resp cbwlan0: STA 00:12:f0:76:03:b9 IEEE 802.11: did not acknowledge associationresponseSending disassociation info to STA 00:12:f0:76:03:b9MGMT (TX callback) failunknown mgmt cb frame subtype 10

Investigation

And then it reassociates with the client, does it again and again. So after few days spent on trying to figure out what is the problem, i found some interesting posts on hostapd, and rt2x00 mailing lists on this topic. The most interesting is this thread. The discussion is about three patch, and the first one is the important one. They say, that the driver can not ackowledge the completion of sending certain frames, because of hardware limitations. So, the case is, that the driver can’t acknowledge these frames, but the hostapd wants an acknowledgement, or it won’t function function properly.

The possible solutions

There are two solutions.

  • Patch the driver to acknowledge the frames even if it is not sure that they have been succesfully sent.
  • Patch hostapd to ignore the lack of acknowledgement.

The second one seems to be the easier way, so i have chosen to patch hostapd.

Patching hostapd

You have to comment out two lines in the ieee802_11.c file. Search for “did not acknowledge” in the file, and comment out the “return;” command after the lines that contain the “did not acknowledge” string. So after commenting out the return lines, the two blocks look like this:

if (!ok) {
hostapd_logger(hapd, mgmt->da, HOSTAPD_MODULE_IEEE80211,
HOSTAPD_LEVEL_NOTICE,
"did not acknowledge authentication response");
//return;
}

if (!ok) {
hostapd_logger(hapd, mgmt->da, HOSTAPD_MODULE_IEEE80211,
HOSTAPD_LEVEL_DEBUG,
"did not acknowledge association response");
//return;
}

ref:http://eznemegy.blog.hu/2008/12/14/using_rt2x00_wireless_driver_with_hostapd/fullcommentlist

移植tslib到Android

环境变量

export  env
export TSLIB_TSEVENTTYPE=INPUT
export TSLIB_TSDEVICE=/dev/input/event4
export TSLIB_CALIBFILE=/system/etc/pointercal
export TSLIB_CONFFILE=/system/etc/ts.conf
export TSLIB_PLUGINDIR=/system/lib/ts/plugs
export TSLIB_FBDEVICE=/dev/fb0
export TSLIB_CONSOLEDEVICE=none
export TSTS_INFO_FILE=/sys/devices/virtual/input/input1/uevent
export QWS_MOUSE_PROTO=tslib:/dev/input/event4

交叉编译过程中的问题

arm-eabi/bin/ld: crt0.o: No such file: No such file or directory
解决:configure加 CFLAGS="-nostdlib"

我的Android.mk ,测试通过

LOCAL_PATH:=$(call my-dir)
include $(CLEAR_VARS)
TSLIB_PLUGINDIR:=/system/lib/ts/plugins
LOCAL_SRC_FILES:=\
        src/ts_attach.c\
        src/ts_close.c \
        src/ts_config.c \
        src/ts_error.c \
        src/ts_fd.c \
        src/ts_load_module.c \
        src/ts_open.c \
        src/ts_parse_vars.c \
        src/ts_read.c \
        src/ts_option.c \
        src/ts_read_raw.c \

LOCAL_C_INCLUDES += $(LOCAL_PATH)/src/ \
        /usr/include/
LOCAL_SHARED_LIBRARIES += libdl
LOCAL_MODULE := libts
include $(BUILD_SHARED_LIBRARY)
#
# plugin: input-raw
#
include $(CLEAR_VARS)
LOCAL_SRC_FILES := plugins/input-raw.c
LOCAL_C_INCLUDES += $(LOCAL_PATH)/src/
LOCAL_SHARED_LIBRARIES := libdl \
        libts
LOCAL_MODULE := ts/plugins/input-raw
include $(BUILD_SHARED_LIBRARY)
#
# plugin: pthres
#
include $(CLEAR_VARS)
LOCAL_SRC_FILES := plugins/pthres.c
LOCAL_C_INCLUDES += $(LOCAL_PATH)/src/
LOCAL_SHARED_LIBRARIES := libdl \
        libts
LOCAL_MODULE := ts/plugins/pthres
include $(BUILD_SHARED_LIBRARY)
#
# plugin: linear
#
include $(CLEAR_VARS)
LOCAL_SRC_FILES := plugins/linear.c
LOCAL_C_INCLUDES += $(LOCAL_PATH)/src/
LOCAL_SHARED_LIBRARIES := libdl \
        libts
LOCAL_MODULE := ts/plugins/linear
include $(BUILD_SHARED_LIBRARY)
#
# plugin: dejitter
#
include $(CLEAR_VARS)
LOCAL_SRC_FILES := plugins/dejitter.c
LOCAL_C_INCLUDES += $(LOCAL_PATH)/src/
LOCAL_SHARED_LIBRARIES := libdl \
        libts
LOCAL_MODULE := ts/plugins/dejitter
include $(BUILD_SHARED_LIBRARY)
#
# plugin: variance
#
include $(CLEAR_VARS)
LOCAL_SRC_FILES := plugins/variance.c
LOCAL_C_INCLUDES += $(LOCAL_PATH)/src/
LOCAL_SHARED_LIBRARIES := libdl \
        libts
LOCAL_MODULE := ts/plugins/variance
include $(BUILD_SHARED_LIBRARY)
#
# ts_calibrate
#
include $(CLEAR_VARS)
LOCAL_SRC_FILES := tests/testutils.c \
        tests/fbutils.c \
        tests/font_8x8.c \
        tests/ts_calibrate.c
LOCAL_C_INCLUDES += $(LOCAL_PATH)/src/ \
        tests/ts_calibrate.h \
        /usr/include/
LOCAL_SHARED_LIBRARIES := libdl \
        libts
LOCAL_MODULE := ts_calibrate
include $(BUILD_EXECUTABLE)
#
# ts_test
#
include $(CLEAR_VARS)
LOCAL_SRC_FILES := tests/testutils.c \
        tests/fbutils.c \
        tests/font_8x8.c \
        tests/ts_test.c
LOCAL_C_INCLUDES += $(LOCAL_PATH)/src/ \
        /usr/include/
LOCAL_SHARED_LIBRARIES := libdl \
        libts
LOCAL_MODULE := ts_test
include $(BUILD_EXECUTABLE)
#
# ts_print
#
include $(CLEAR_VARS)
LOCAL_SRC_FILES := tests/testutils.c \
        tests/fbutils.c \
        tests/font_8x8.c \
        tests/ts_print.c
LOCAL_C_INCLUDES += $(LOCAL_PATH)/src/ \
        /usr/include/
LOCAL_SHARED_LIBRARIES := libdl \
        libts
LOCAL_MODULE := ts_print
include $(BUILD_EXECUTABLE)
#
# ts_print_raw
#
include $(CLEAR_VARS)
LOCAL_SRC_FILES := tests/testutils.c \
        tests/fbutils.c \
        tests/font_8x8.c \
        tests/ts_print_raw.c
LOCAL_C_INCLUDES += $(LOCAL_PATH)/src/ \
        /usr/include/
LOCAL_SHARED_LIBRARIES := libdl \
        libts
LOCAL_MODULE := ts_print_raw
include $(BUILD_EXECUTABLE)
#
# ts_harvest
#
include $(CLEAR_VARS)
LOCAL_SRC_FILES := tests/testutils.c \
        tests/fbutils.c \
        tests/font_8x8.c \
        tests/ts_harvest.c
LOCAL_C_INCLUDES += $(LOCAL_PATH)/src/ \
        /usr/include/
LOCAL_SHARED_LIBRARIES := libdl \
        libts
LOCAL_MODULE := ts_harvest
include $(BUILD_EXECUTABLE)