顯示具有 linux 標籤的文章。 顯示所有文章
顯示具有 linux 標籤的文章。 顯示所有文章

2017年6月20日 星期二

Linux - How to find the GPIO usage status ?

$cat /sys/kernel/debug/gpio

GPIOs 576-607, platform/qcom,smp2pgpio-ssr-smp2p-4-out.19, master-kernel:

GPIOs 608-639, platform/qcom,smp2pgpio-ssr-smp2p-4-in.18, slave-kernel:

GPIOs 640-671, platform/qcom,smp2pgpio-ssr-smp2p-1-out.13, master-kernel:

GPIOs 672-703, platform/qcom,smp2pgpio-ssr-smp2p-1-in.12, slave-kernel:

GPIOs 704-735, platform/qcom,smp2pgpio-smp2p-4-out.16, smp2p:

GPIOs 736-767, platform/qcom,smp2pgpio-smp2p-4-in.14, smp2p:

GPIOs 768-799, platform/qcom,smp2pgpio-smp2p-1-out.10, smp2p:

GPIOs 800-831, platform/qcom,smp2pgpio-smp2p-1-in.8, smp2p:

GPIOs 832-863, platform/qcom,smp2pgpio-smp2p-7-out.6, smp2p:

GPIOs 864-895, platform/qcom,smp2pgpio-smp2p-7-in.4, smp2p:

GPIOs 896-899, spmi/qpnp-pin-ffffffc03161cc00, pm8916-gpio:
 gpio-896 (qcom,hub-reset-gpio ) out hi
 gpio-897 (qcom,sw-sel-gpio    ) in  lo

GPIOs 900-901, spmi/qpnp-pin-ffffffc03161c800, pm8916-mpp:

GPIOs 902-1023, platform/1000000.pinctrl, msm_tlmm_gpio:
 gpio-922 (adv7533_hpd_irq_gpio) in  lo
 gpio-923 (led1                ) out lo
 gpio-927 (disp_rst_n          ) in  lo
 gpio-933 (adv7533_irq_gpio    ) in  lo
 gpio-934 (adv7533_switch_gpio ) out lo
 gpio-940 (7864900.sdhci cd    ) in  hi
 gpio-1009 (volume_up           ) in  hi
 gpio-1012 (USB_ID_GPIO         ) in  hi
 gpio-1022 (led2                ) out lo

reference : https://stackoverflow.com/questions/16033748/how-do-can-i-find-out-which-linux-driver-is-hogging-my-gpio

2016年5月26日 星期四

MPLABX - 如何解決 MPLABX 在 Linux 版本下 editor 字體模糊問題?

1. 找到 MPLABX 安裝路徑,以 v3.15 在 ubuntu 16.04 為例:

$cd /opt/microchip/mplabx/v3.15/

2. 找到 ide 安裝路徑並且編輯設定檔

$sudo vim mplab_ide/etc/mplab_ide.conf

3. 修改設定值

default_options="-J-Dcrownking.stream.verbosity=very-quiet -J-Xss2m -J-Xms256m -J-XX:PermSize=128m -J-XX:MaxPermSize=384m -J-Dapple.awt.graphics.UseQuartz=true -J-XX:+CMSClassUnloadingEnabled -J-Dapt.limit.expanded.params=1000 -J-Dplugin.manager.check.interval=EVERY_DAY"

修改為...

default_options="-J-Dcrownking.stream.verbosity=very-quiet -J-Xss2m -J-Xms256m -J-XX:PermSize=128m -J-XX:MaxPermSize=384m -J-Dapple.awt.graphics.UseQuartz=true -J-XX:+CMSClassUnloadingEnabled -J-Dapt.limit.expanded.params=1000 -J-Dplugin.manager.check.interval=EVERY_DAY -J-Dawt.useSystemAAFontSettings=on"

4. 重開 MPLABX

2014年10月2日 星期四

Linux - warning: override XXX

Because your kconfig have "choice" !

This mean that only have "1" module can be enable.
But, you enabled 2 or more module on your config file belong this item.

After "make xxxx_config", it found 2 enable module on this item.

it will show ... warning: override.

You must to disable unnecessary module on this item.

2014年4月15日 星期二

How to install line on ubuntu ?

1. sudo add-apt-repository ppa:ubuntu-wine/ppa
2. sudo apt-get update
3. sudo apt-get install wine
4. winetricks vcrun2008
5. Download Line and install from http://cdn.line-apps.com/client/win/LineInst.exe

Reference : http://longbao738.blogspot.tw/2013/10/ubuntu-line.html

2014年2月22日 星期六

Python - How to install mysql-python on ubuntu?

$> sudo apt-get install python-dev

$> sudo apt-get install libmysqlclient-dev

$> pip install mysql-python

Reference :

1. http://lucaswei.blogspot.tw/2012/02/pythonh-no-such-file-or-directory.html
2. http://stackoverflow.com/questions/5178292/pip-install-mysql-python-fails-with-environmenterror-mysql-config-not-found

2013年9月2日 星期一

QT4 - How to build the QT for arm ?

1. 安裝之後編譯需要的套件
#sudo apt-get install libxtst-dev

2. 取得 qt x11 server and qt embedded 並且編譯
#wget http://ftp.heanet.ie/mirrors/trolltech/pub/qt/source/qt-x11-opensource-src-4.5.3.tar.gz
#tar -zxvf qt-x11-opensource-src-4.5.3.tar.gz
#cd qt-x11-opensource-src-4.5.3/
#sudo ./configure
#sudo make;sudo make install

#cd tools/qvfb
#sudo make

#wget http://ftp.heanet.ie/mirrors/trolltech/pub/qt/source/qt-embedded-linux-opensource-src-4.5.3.tar.gz
#tar -zxvf qt-embedded-linux-opensource-src-4.5.3.tar.gz qt-embedded-linux-opensource-src-4.5.3/
#cd qt-embedded-linux-opensource-src-4.5.3/
#sudo ./configure -prefix /qt-library-4.5.3 -release -shared -fast -pch -no-qt3support -qt-sql-sqlite -no-libtiff -no-libmng -qt-libjpeg -qt-zlib -qt-libpng -qt-freetype -nomake tools -nomake examples -nomake demos -optimized-qmake -no-nis -no-opengl -no-cups -no-xcursor -no-xfixes -no-xrandr -no-xrender -no-xkb -no-sm -no-xinerama -no-xshape -no-separate-debug-info -xplatform qws/linux-arm-g++ -embedded arm -depths 16 -confirm-license -little-endian
#sudo make;sudo make install
PS. /qt-library-4.5.3就是之後編譯安裝之後的目標 library 

3. 壓縮剛剛編譯完成的QT library
#cd /
#sudo tar -czvf qt-library-4.5.3.tar.gz /qt-library-4.5.3/
4. 接下就可以把製作完成的壓縮檔拿到開發版上面讓已經編譯完成的 QT 程式引用。

reference :
http://it1688.blog.hexun.com.tw/81109706_d.html
http://it1688.blog.hexun.com.tw/81109675_d.html

2013年1月30日 星期三

ubuntu - 更換 console 的語系

小素之前有提供讓 console mode 可以顯示中文的方法。
可是那方法每次登入時就要執行一次,再進行軟體開發的時候有些 script 又都只吃英文介面的訊息。因此根本的方法還是讓 console mode 一些訊息全部回到英文。

1. sudo vim /etc/default/locale
2. 更改內容 ...

LANG="en_US"
LANGUAGE="en_US:en"

3. sudo locale-gen

4. 登出再登入

Reference : http://jackden-diary.blogspot.tw/2010/05/ubuntu-lang-en.html

2013年1月29日 星期二

Android - 安裝 Sun Java 6 for android 4.0.x

ubuntu 12.10 在 build android 2.2.x 的時候可以使用 ubuntu 預設的 open JDK.
但是當在build android 4.0.x 的時候一開始確認 Java 的版本就會失敗。
錯誤訊息如下:

************************************************************
You are attempting to build with the incorrect version
of java.
Your version is: java version "1.6.0_31".
The correct version is: Java SE 1.6.
Please follow the machine setup instructions at
    http://source.android.com/source/download.html
************************************************************

似乎 Android 4.0.x 一定要使用 Sun 的 Java SDK.

1. 去 JAVA 的官方網頁,選擇下載JDK。


2. 選擇適合自己的版本:

Note : 小素是選擇 jdk-6u38-linux-x64.bin 。

3. 切換到下載的目錄:

sudo chmod a+x jdk-6u38-linux-x64.bin
./jdk-6u38-linux-x64.bin
mv jdk1.6.0_38/ /opt/sun-jdk1.6.0_38

4. 在 ~/.bashrc 裡面加入以下幾行:
export JAVA_HOME=/opt/sun-jdk1.6.0_38
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH

5. 重新讀取環境變數
source ~/.profile

6. 確認 Java 版本:
java version "1.6.0_38"
Java(TM) SE Runtime Environment (build 1.6.0_38-b05)
Java HotSpot(TM) 64-Bit Server VM (build 20.13-b02, mixed mode)







2012年12月27日 星期四

Android - Memory leak note

1. Used the StringBuilder to avoid the memory leak:

Error :
for (int i=1; i<65535 i="i" p="p">{
    String aaa = aaa + "test sting"; // this will have memory leak
    String aaa = null;
}

Solution :

for (int i=1; i<65535 i="i" p="p">{

    StringBuilder sb;
    sb.append("test sting");
    String aaa = sb.ToString();
    sb.setLength(0);
}

2. Recycle the message

a.removeMessages(0);
Message msg = a.obtainMessage();
a.sendMessage(msg);

2012年12月25日 星期二

2012年10月15日 星期一

Linux - How to open device of type of input ?

0. Include file
#include

1. Get device name :
int GetDevices()
{
int fd = -1;
char name[80];

fd = open("/dev/input/event1", O_RDONLY); // open "dev/input/event1" and read only

if (ioctl(fd, EVIOCGNAME(sizeof(name) - 1), &name) < 1)
{
    name[0] = '\0';
    DBGMSG("ioctl fail, path = %s \n",devname);
    close(fd);
    return fd;
}
DBGMSG("ioctl OK, name = %s \n",name);

close(fd);
return fd;
}

2. Read data from devices

int fd = -1;
fd = GetDevices();
if (fd <0 devices="devices" err="%d\n" errno="errno" fail="fail" nbsp="nbsp" open="open" p="p">
struct input_event ev;
ret = read(fd, &ev, sizeof(struct input_event));

if (ret < 0)
{
DBGMSG("read data from devices fail, err = %d\n",errno);
}
else
{
DBGMSG("ev.type = %d\n",ev.type);
DBGMSG("ev.code = %d\n",ev.code);
DBGMSG("ev.value = %d\n",ev.value);
}

close(fd);
return fd;
}


2012年9月5日 星期三

ubuntu - How to boot ubuntu 12.04 on EUFI system ?

1. Format the USB disk to fat32.
mkfs.vfat /dev/sdb1
2. Used the live CD and entry the OS.
3. Following the cmd ..

sudo -s
mkdir /mnt/ubuntu && mount /dev/sda5 /mnt/ubuntu
mount --bind /dev /mnt/ubuntu/dev
mount -t sysfs /sys /mnt/ubuntu/sys
mount -t proc /proc /mnt/ubuntu proc
chroot /mnt/ubuntu bash

4. Install the "grub-efi-amd64-bin"
apt-get install grub-efi-amd64-bin grub-efi-amd64
5. Execute the grub 
grub-install

6. Make the grub config file
cd /etc/grub.d
cp 40_custom 06_custom

and edit this file ...

menuentry "Windows 7 (loader) (on /dev/sda1)" --class windows --class os {
insmod part_gpt
insmod fat
set root='(hd0,gpt1)'
search --no-floppy --fs-uuid --set=root 46bd-600e
chainloader ($root)/EFI/Boot/bootx64.efi
}

7. Execute the grub ...
update-grub2

8. Create the folder on USB disk
mkdir -p efi/boot

9. copy the grub file to USB disk
cp /boot/grub/grub.efi /efi/boot/bootx64.efi

2012年3月27日 星期二

Ubuntu - amule setting

1.install amule into ubuntu
>sudo apt-get install amule-daemon

2.edit your amule file
>sudo vim /etc/default/amule

AMULED_USER="your name"
AMULED_HOME="home patch"

3.start your amule
>sudo /etc/init.d/amule-daemon start

4.create
echo -n YourPassword | md5sum

5.stop your amule
>sudo /etc/init.d/amule-daemon stop

6.edit your amule file
>sudo vim /home/amule/.aMule/amule.conf

[ExternalConnect]
AcceptExternalConnections=1
ECAddress=
ECPort=4712
ECPassword=YourPassword
[WebServer]
Enabled=1
Password=YourPassword
PasswordLow=
Port=4711
UseGzip=1
UseLowRightsUser=0
PageRefreshTime=120
Template=

7.restart your amule
>sudo /etc/init.d/amule-daemon start

8.You can use your amule web on "http://localhsol:4711/"

reference : http://blog.c2sr.com/?p=12

Ubuntu - eth0 static ip

sudo vim /etc/network/interfaces

auto eth0
iface eth0 inet static
address 10.0.0.100
netmask 255.255.255.0
gateway 10.0.0.1

sudo /etc/init.d/networking restart

2010年3月10日 星期三

ubuntu - 英文版開機自動執行ibus

英文版預設輸入法沒有安裝ibus。

當安裝好之後,也沒辦法自動執行。

這時候開啟命令列視窗,輸入:

sudo im-switch -s ibus

就可以開機自動執行ibus。

2010年2月4日 星期四

ubuntu:Acer TravelMate 3260WXMi sound card and wifi (intel 3945abg) seting

自從公司的舊筆電Acer TravelMate 3260 WXMi 升級到 ubuntu 9.10 之後,我的無線網路跟聲音就消失了。後來發現原來是因為我之前把Linux Kernel 改道PAE版本之後,相對映的一些Header沒有安裝。在網路上找了一堆資料都沒有幫助,最後發現連module都沒辦法Load到Kernel。才去檢查相對映的Header。
1.Kernel :

linux-image-2.6.31-17-generic-pae
linux-headers-2.6.31-17-generic-pae

2.Intel 3945abg :
linux-backports-modules-headers-karmic-generic-pae
linux-backports-modules-2.6.31-17-generic-pae
3.Alsa Sound card

linux-backports-modules-alsa-2.6.31-17-generic-pae

安裝這幾個之後,重開機就有可以用wifi也有聲音了。
PS.搞這個搞了一整天,最後成功還真感動。

2009年12月14日 星期一

Linux - 在console環境下,如何顯示中文?

現在介紹的,不是進入到圖形介面下的console。
而是一開機之後先進入的console環境。(例如ctrl + alt + F1~F6)

1.安裝unifont jfbterm

$ sudo apt-get install unifont jfbterm

2.更改grub 的menu list。主要是因為我們需要一開機的時候,就讓kernel使用framm buffer

$ sudo vim /boot/grub/menu.list

載你目前使用的kernel 後面加上 vga=<你的螢幕解析度轉換後的參數>
參數表:
===================================================================
螢幕解析度 (X) | 320 640 640 800 800 896 1024 1024 1152 1552 1280 1440 1600
螢幕解析度 (Y) | 200 400 480 500 600 672 640 768 720 864 1024 900 1200
---------------+-----------------------------------------------------------------
4 bits | 770 772 774
8 bits | 768 769 879 771 815 874 773 869 353 775 864 796
15 bits | 781 801 784 880 787 816 875 790 870 354 793 865 797
16 bits (5:6:5)| 782 802 785 881 788 817 876 791 871 355 794 866 798
24 bits (8:8:8)| 783 803 786 882 789 818 877 792 872 795 867 799
32 bits (8:8:8)| 804 809 883 814 819 878 824 873 356 829 868 834
====================================================================================
3.執行jfbterm

$ jfbterm

參考資料:

2009年9月30日 星期三

Linux - Firefox 3.x( 3.5.x or last version) 中文包

最近小素剛把ubuntu 9.04升級到9.10。
想當然,我的firefox也隨著升到了3.5.3。

不知道為什麼竟然是英文版的!
不過因為目前ubuntu 9.10只有到Alpha 6的階段!
等到未來正式版來的時候,應該就會變成中文版!

但是小素就是不想等到那時候,所以教大家可以去Mozilla release Firefox的地方自己抓語言包來安裝!
因為Firefox的語言包是以xpi的形式發布,所以可以跨平台使用!

ftp://ftp.mozilla.org/pub/mozilla.org/firefox/releases/(Firefox Version)/win32/xpi/zh-TW.xpi

大家只要根據你所使用的版本替代掉-Firefox Version 這個名稱就可以囉!

2009年8月26日 星期三

Android - 在uBuntu系統裡讓PC能透過adb 使用USB連接device

1.建立文件並且加入對應的內容

建立文件 vim /etc/udev/rules.d/11-android.rules
文件內容 SUBSYSTEMS=="usb", SYSFS{idVendor}=="22b8", SYSFS{idProduct}=="41db", MODE="0666"

建立文件 vim /etc/udev/rules.d/50-android.rules
文件內容 SUBSYSTEMS=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"

建立文件 vim /etc/udev/rules.d/51-android.rules
文件內容 SUBSYSTEMS=="usb", ATTRS{idVendor}=="0bb4", ATTRS{idProduct}=="0c02", MODE="0666"


2.更改文件權限

sudo chmod a+rx /etc/udev/rules.d/11-android.rules /etc/udev/rules.d/50-android.rules /etc/udev/rules.d/51-android.rules

4.切換到放置Android的目錄下面

./adb kill-server

5.確認連線狀況

sudo ./adb devices

6.如果出現device就代表已經成功了!

參考來源:http://android-newbe.blogspot.com/2009/04/ubuntu-linux-gphone-android-driver.html


PS.20100114 更新加入另外兩個rule