ubuntu 在 R40e 上 還有 Debian 在 Sempron 2600 上

2014年9月26日 星期五

HUAWEI HiLink - E3131 3G Dongle

[99274.544647] usb-storage: device scan complete
[99274.545218] scsi 36:0:0:0: CD-ROM            HUAWEI   Mass Storage     2.31 PQ: 0 ANSI: 2
[99274.547006] sr1: scsi-1 drive
[99274.547156] sr 36:0:0:0: Attached scsi CD-ROM sr1
[99274.547246] sr 36:0:0:0: Attached scsi generic sg6 type 5
[99475.187782] usb 3-1.1.4: USB disconnect, address 35
[100478.559739] usb 3-1.1.3: new high speed USB device using ehci_hcd and address 36
[100478.664682] usb 3-1.1.3: New USB device found, idVendor=12d1, idProduct=1f01
[100478.664688] usb 3-1.1.3: New USB device strings: Mfr=2, Product=1, SerialNumber=0
[100478.664692] usb 3-1.1.3: Product: HUAWEI HiLink
[100478.664695] usb 3-1.1.3: Manufacturer: HUAWEI
[100478.664820] usb 3-1.1.3: configuration #1 chosen from 1 choice
[100478.666119] scsi37 : SCSI emulation for USB Mass Storage devices
[100478.666249] usb-storage: device found at 36
[100478.666253] usb-storage: waiting for device to settle before scanning
ref: http://www.pcduino.com/3g-cellular-usb-dongle-for-pcduino-huawei-e303s/

檢查一下 usb_modeswitch:

/lib/udev/rules.d/40-usb_modeswitch.rules:
# Huawei E3131
ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1f01", RUN+="usb_modeswitch '%b/%k'"
如果沒有,就加上去。

然後是 /etc/usb_modeswitch.d/
有沒有 12d1:1f01 這個 file.

雖然有 google 到一些不同得,最後是..
#Huawei E3131
DefaultVendor= 0x12d1
DefaultProduct= 0x1f01
TargetVendor= 0x12d1
RargetProduct= 0x1f01
MessageEndPoint = "0x01"
MessageContent="55534243000000000000000000000011060000000000000000000000000000"
NoDriverLoading=1

這樣,插入 3G dongle,, dmesg:
[97530.910739] usb 3-1.3.4: new high speed USB device using ehci_hcd and address 66
[97531.015681] usb 3-1.3.4: New USB device found, idVendor=12d1, idProduct=1f01
[97531.015688] usb 3-1.3.4: New USB device strings: Mfr=2, Product=1, SerialNumber=0
[97531.015691] usb 3-1.3.4: Product: HUAWEI HiLink
[97531.015694] usb 3-1.3.4: Manufacturer: HUAWEI
[97531.015825] usb 3-1.3.4: configuration #1 chosen from 1 choice
[97531.017289] scsi49 : SCSI emulation for USB Mass Storage devices
[97531.017547] usb-storage: device found at 66
[97531.017551] usb-storage: waiting for device to settle before scanning
[97531.723149] usb 3-1.3.4: USB disconnect, address 66
[97536.787599] usb 3-1.3.4: new high speed USB device using ehci_hcd and address 67
[97536.891893] usb 3-1.3.4: New USB device found, idVendor=12d1, idProduct=1001
[97536.891896] usb 3-1.3.4: New USB device strings: Mfr=2, Product=1, SerialNumber=0
[97536.891898] usb 3-1.3.4: Product: HUAWEI HiLink
[97536.891900] usb 3-1.3.4: Manufacturer: HUAWEI
[97536.891984] usb 3-1.3.4: configuration #1 chosen from 1 choice
[97536.892444] option 3-1.3.4:1.0: GSM modem (1-port) converter detected
[97536.892521] usb 3-1.3.4: GSM modem (1-port) converter now attached to ttyUSB0
[97536.892587] option 3-1.3.4:1.1: GSM modem (1-port) converter detected
[97536.892637] usb 3-1.3.4: GSM modem (1-port) converter now attached to ttyUSB1
[97536.892688] option 3-1.3.4:1.2: GSM modem (1-port) converter detected
[97536.892736] usb 3-1.3.4: GSM modem (1-port) converter now attached to ttyUSB2
pid 變成 1001, 並且出現了 ttyUSB0.1.2

有關 usb_modeswitch, 可以修改 /etc/usb_modeswitch.conf. 把 log 打開:
# Enable logging (results in a extensive report file in /var/log, named
# "usb_modeswitch_"

EnableLogging=1

這隻 dongle 好像有好多種 configuration.
ref: http://mybroadband.co.za/vb/showthread.php/507680-Huawei-HiLink-modems-%28E303-E3131-etc-%29/page2

在 modeswitch 後,minicom 開啟 ttyUSB0. 下:
AT^U2DIAG=0
AT+CFUN=4
AT+CFUN=6
之後 dongle reboot, 然後變成 網路裝置,pid 也變了...

--- 這是安裝過 CDROM mode driver 才會出現。

一但變成這個模式後,dongle 會紀錄這個模式。
以後每次插入都是這個 vid, pid, 插入 linux 也一樣。

要切回原來的模式,要 follow 上面的 link ,重新對 comport 下:
AT^U2DIAG=119
AT+CFUN=4
AT+CFUN=6
但是在 windows 下沒有出現 COM Port,插入 linux 也一樣。
認不得這個 vid, pid

[ 6369.326587] usb 2-1.3.4: new high speed USB device using ehci_hcd and address 10
[ 6369.431758] usb 2-1.3.4: New USB device found, idVendor=12d1, idProduct=1c05
[ 6369.431764] usb 2-1.3.4: New USB device strings: Mfr=2, Product=1, SerialNumber=0
[ 6369.431768] usb 2-1.3.4: Product: HUAWEI HiLink
[ 6369.431770] usb 2-1.3.4: Manufacturer: HUAWEI
[ 6369.431901] usb 2-1.3.4: configuration #1 chosen from 1 choice
[ 6369.793255] usbcore: registered new interface driver cdc_ether
[ 6369.795967] usb 2-1.3.4: bad CDC descriptors
[ 6369.795991] usb 2-1.3.4: bad CDC descriptors
[ 6369.796014] usb 2-1.3.4: bad CDC descriptors
[ 6369.796046] usbcore: registered new interface driver rndis_host
[ 6369.833178] cfg80211: Using static regulatory domain info
[ 6369.833183] cfg80211: Regulatory domain: US
[ 6369.833186]  (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
[ 6369.833192]  (2402000 KHz - 2472000 KHz @ 40000 KHz), (600 mBi, 2700 mBm)
[ 6369.833223]  (5170000 KHz - 5190000 KHz @ 40000 KHz), (600 mBi, 2300 mBm)
[ 6369.833227]  (5190000 KHz - 5210000 KHz @ 40000 KHz), (600 mBi, 2300 mBm)
[ 6369.833232]  (5210000 KHz - 5230000 KHz @ 40000 KHz), (600 mBi, 2300 mBm)
[ 6369.833237]  (5230000 KHz - 5330000 KHz @ 40000 KHz), (600 mBi, 2300 mBm)
[ 6369.833242]  (5735000 KHz - 5835000 KHz @ 40000 KHz), (600 mBi, 3000 mBm)
[ 6369.833556] cfg80211: Calling CRDA for country: US
[ 6369.838314] usb 2-1.3.4: bad CDC descriptors
[ 6369.839245] usb 2-1.3.4: bad CDC descriptors
[ 6369.839326] usb 2-1.3.4: bad CDC descriptors
[ 6369.839378] usbcore: registered new interface driver rndis_wlan
ref: http://www.draisberghof.de/usb_modeswitch/bb/viewtopic.php?t=571

就是:
# echo "12d1 1c05" >/sys/bus/usb-serial/drivers/option1/new_id 
很奇怪,一定要是 root 才行。
用 sudo 的話,會是 permission deny

然後 kernel msg:
[ 6846.542169] option 2-1.3.4:1.0: GSM modem (1-port) converter detected
[ 6846.542302] usb 2-1.3.4: GSM modem (1-port) converter now attached to ttyUSB0
[ 6846.542346] option 2-1.3.4:1.1: GSM modem (1-port) converter detected
[ 6846.542420] usb 2-1.3.4: GSM modem (1-port) converter now attached to ttyUSB1
[ 6846.542461] option 2-1.3.4:1.2: GSM modem (1-port) converter detected
[ 6846.542538] usb 2-1.3.4: GSM modem (1-port) converter now attached to ttyUSB2
這樣就出現 COM port 了。
之後用 minicom 打開 ttyUSB0.
輸入:
AT^U2DIAG=119
AT+CFUN=4
AT+CFUN=6
dongle 會重開,然後 dmesg 出來是..
[ 7832.680140] usb 2-1.3.4: new high speed USB device using ehci_hcd and address 13
[ 7832.785372] usb 2-1.3.4: New USB device found, idVendor=12d1, idProduct=1f01
[ 7832.785378] usb 2-1.3.4: New USB device strings: Mfr=2, Product=1, SerialNumber=0
[ 7832.785382] usb 2-1.3.4: Product: HUAWEI HiLink
[ 7832.785384] usb 2-1.3.4: Manufacturer: HUAWEI
[ 7832.785511] usb 2-1.3.4: configuration #1 chosen from 1 choice
[ 7832.786962] scsi11 : SCSI emulation for USB Mass Storage devices
[ 7832.787105] usb-storage: device found at 13
[ 7832.787109] usb-storage: waiting for device to settle before scanning
[ 7833.490017] usb 2-1.3.4: USB disconnect, address 13
[ 7838.553987] usb 2-1.3.4: new high speed USB device using ehci_hcd and address 14
[ 7838.659009] usb 2-1.3.4: New USB device found, idVendor=12d1, idProduct=1001
[ 7838.659015] usb 2-1.3.4: New USB device strings: Mfr=2, Product=1, SerialNumber=0
[ 7838.659019] usb 2-1.3.4: Product: HUAWEI HiLink
[ 7838.659021] usb 2-1.3.4: Manufacturer: HUAWEI
[ 7838.659149] usb 2-1.3.4: configuration #1 chosen from 1 choice
[ 7838.659589] option 2-1.3.4:1.0: GSM modem (1-port) converter detected
[ 7838.659732] usb 2-1.3.4: GSM modem (1-port) converter now attached to ttyUSB0
[ 7838.659874] option 2-1.3.4:1.1: GSM modem (1-port) converter detected
[ 7838.659977] usb 2-1.3.4: GSM modem (1-port) converter now attached to ttyUSB1
[ 7838.660088] option 2-1.3.4:1.2: GSM modem (1-port) converter detected
[ 7838.660186] usb 2-1.3.4: GSM modem (1-port) converter now attached to ttyUSB2
回到以前的 1f01, 然後 modeswitch 到 1001


撥號連線...用 wvdial 撥號,接 ppp..
寫 /etc/wvdial.conf

[Dialer e3131]
Modem = /dev/ttyUSB0
Init1 = ATZ
Init2 = AT^CURC=0
Init3 = AT+CGDCONT=1,"IP","internet"
Phone = *99#
Stupid mode = yes
Dial Attempts = 0
Auto Reconect = yes
Password=''
Username=''
然後下命令:sudo wvdial e3131..
--> WvDial: Internet dialer version 1.60
--> Cannot get information for serial port.
--> Initializing modem.
--> Sending: ATZ
ATZ
OK
--> Sending: AT^CURC=0
AT^CURC=0
OK
--> Sending: AT+CGDCONT=1,"IP","internet"
AT+CGDCONT=1,"IP","internet"
OK
--> Modem initialized.
--> Sending: ATDT*99#
--> Waiting for carrier.
ATDT*99#
CONNECT
--> Carrier detected.  Starting PPP immediately.
--> Starting pppd at Fri Sep 26 11:09:15 2014
--> Pid of pppd: 4065
--> Using interface ppp0
--> local  IP address 42.68.94.228
--> remote IP address 10.64.64.64
--> primary   DNS address 168.95.1.1
--> secondary DNS address 168.95.192.1

之後用 ifconfig 看,OK

wvdial.conf 如果沒有寫
Password=''
Username=''
wvdial 會 complain 沒有給 username, password

2014年9月19日 星期五

test piracast ..

上一篇文章其實是為了試這個: https://github.com/codemonkeyricky/piracast

mircast 真的就是Wifi Direct 連線,然後 streaming H264.

有關 Wifi Direct 連線,跟 Wifi Module 有關。
ref: http://rtl8192cu.googlecode.com/hg-history/bdd3a2265bdd6a92f24cef3d52fa594b2844c9c1/document/RTK_Wi-Fi_Direct_Programming_guide.pdf

換位子了...RTK_WiFi_Direct_Programming_guide.pdf

2014年9月18日 星期四

wifi dongle on Raspberry Pi

ref: http://www.fars-robotics.net/ dongle 就是piracast 唯一支援的 TP-LINK TL-WN725N

安裝 driver..
lsusb:
Bus 001 Device 011: ID 0bda:8179 Realtek Semiconductor Corp. 
uname -a:
Linux raspberrypi 3.12.20+ #687 PREEMPT Fri May 30 16:39:11 BST 2014 armv6l GNU/Linux
所以屬於:
rtl8188eu drivers for 3.12.18+ to 3.12.25+

3.12.20+ #687       - 8188eu-20140509.tar.gz

所以我要 download 的是...
https://dl.dropboxusercontent.com/u/80256631/8188eu-20140509.tar.gz

ko 裝完後,用 wpa_supplicant 的方式。
修改 /etc/wpa_supplicant/wpa_supplicant.conf
加上 ssid 和 psk 後,重新開機。

OK.


為防止page 不見,copy 一下:
Installing rtl8188cus and rtl8188eu based wifi adaptors for raspbian using wpa_supplicant.

Default /etc/network/interfaces file as supplied in the raspbian image - do not edit

auto lo

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

Edit the file /etc/wpa_supplicant/wpa_supplicant.conf and add the network={.....} section. Use the command sudo nano 
/etc/wpa_supplicant/wpa_supplicant.conf to open and edit the file. Exit the editor and save the file using keys cntl-X, 
Y, Enter.

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
    ssid="Your-Network-Name"
    psk="Your-Network-Password"
}

You may add additional network={.....} sections defining different networks if your Pi is mobile and you carry it 
around with you. This will allow you to connect to these other networks at various different locations without needing 
to change your set up.


變成 4.1 版了。所以根據https://www.raspberrypi.org/forums/viewtopic.php?p=462982#p462982, uname -a 是 4.1.19+ #858
要 download 的就是..https://dl.dropboxusercontent.com/u/80256631/8188eu-4.1.19-858.tar.gz

2014年9月15日 星期一

1.5 T, 2700,  USB3. 0

socket, android 4.2 init.rc 啟動和手動啟動的 socket fd , access mode 不同

一個 service create 一個 socket 作 service 入口。
在 init.rc 中 service 啟動這個 service.

結果
在 2.3 版, create 出來的 permission 是 0777
在 4.2 版, create 出來的 permission 是 0700

但是若是不用 init.rc 的 service 啟動,
在 console 手動launch 的話,
無論 2.3 還是 4.2, create 出來的 socket 都是 0777


... 雖然是這樣,
但是在程式中,當socket create 完,bind OK 後,
用 chmod( ) 改成 0777, 是 OK 的。

USB_EHCI_TT_NEWSCHED 最後好像還是沒有接受

是在 ehci 處理 1.1 連線的時候,出問題,所設計的 新 ehci scheduler.

但是最後好像還是沒被納入成 default:

http://permalink.gmane.org/gmane.linux.usb.general/96451
最後:
It's not a matter of sloppy coding but of design.  The main issues are:

 We don't handle siTD back link pointers.  Therefore we can't
 allow full-speed isochronous IN transfers to be scheduled in
 B-uframe 4 or later.

 We don't handle FSTN nodes in the schedule.  Therefore we can't
 allow full- or low-speed interrupt transfers to be scheduled
 in B-uframe 4 or later.  (In principle, that is -- in practice
 we do allow uframes 4 and 5, at the cost of having too few
 CSPLIT packets.)

 We don't compute the full-speed budget according to the USB 
 spec.  The spec says that budgets are to be computed in terms
 of best-case full-speed bytes, not worst-case microseconds.

 If an URB's bandwidth can't be accomodated in the current
 schedule, we don't try to rebalance the schedule to make the
 bandwidth fit.

 We don't obey various restrictions on allowable schedules.
 For example, the EHCI spec says that any full-speed isochronous
 transfer of length >= 588 bytes must be the first one in its
 frame, but we don't enforce this.

 We reserve an endpoint's bandwidth when the first URB is 
 submitted rather than when the alternate setting is installed.

There's a bunch of smaller issues under each of those categories, but 
those are the biggies.

Alan Stern

2014年9月9日 星期二

Usbee DX 使用心得

跟一般的示波器比起來..

1 chan sampling rate 有到 24M, (有效到 2M 已經算 OK)
PC 端雖然一定要 windows 和 .net 有點鳥,, UI 也有點...
但是算堪用

最大的問題,也就是看出專業示波器和玩具的差別就是:
信號放大器。

USBee 缺這個,
所以他一直用最大檔 +-10V 來量,
加上 AD 解析度不夠,

所以小信號是悲劇。
size wave 最少要有 +- 1.5V 才會看得出來。
否則會變成階梯狀。

數位部份就還好,因為只有 0 ~ 5.5V,
加上數位也不 care 暫態.

2014年9月5日 星期五

hardware/libhardware_legacy/audio/AudioPolicyManagerBase.cpp
    ALOGV("setOutputDevice() changing device");
    // do the routing
    param.addInt(String8(AudioParameter::keyRouting), (int)device);
    mpClientInterface->setParameters(output, param.toString(), delayMs);


mixer route 的設置變成 hard-code:
AudioHardware.cpp:
   mMixer = mHardware->openMixer_l();
    if (mMixer) {
        ALOGV("open playback normal");
        
        headphone_l_ctl = mixer_get_ctl_by_name(mMixer, "Left dac to hp left amp Switch");
        headphone_r_ctl = mixer_get_ctl_by_name(mMixer, "Right dac to hp right amp Switch");
        speaker_l_ctl = mixer_get_ctl_by_name(mMixer, "Left dac to speaker lineout Switch");
        speaker_r_ctl = mixer_get_ctl_by_name(mMixer, "Right dac to speaker lineout Switch");
        
    }
    
    if (headphone_l_ctl && headphone_r_ctl && speaker_l_ctl && speaker_r_ctl) {
        unsigned int num_values;
        unsigned int hp_num_values;
        unsigned int i;
        num_values = mixer_ctl_get_num_values(speaker_l_ctl);
        hp_num_values = mixer_ctl_get_num_values(headphone_l_ctl);
        
     for (i = 0; i < num_values; i++) {
     if (mDevices & (AudioSystem::DEVICE_OUT_SPEAKER | AudioSystem::DEVICE_OUT_EARPIECE)) {
                mixer_ctl_set_value(speaker_l_ctl, i, 1);
                mixer_ctl_set_value(speaker_r_ctl, i, 1);
     } else {
                mixer_ctl_set_value(speaker_l_ctl, i, 0);
                mixer_ctl_set_value(speaker_r_ctl, i, 0);
     }
 }
 for (i = 0; i < hp_num_values; i++) {
     if (mDevices & AudioSystem::DEVICE_OUT_WIRED_HEADSET) {
                mixer_ctl_set_value(headphone_l_ctl, i, 1);
                mixer_ctl_set_value(headphone_r_ctl, i, 1);
            } else {
                mixer_ctl_set_value(headphone_l_ctl, i, 0);
                mixer_ctl_set_value(headphone_r_ctl, i, 0);
            }
 }
以前這一段是寫在 asound.conf。
改為 tinyalsa 後就變成 hard-coded

這只是 4.2 的作法, 4.4 以後會是一個專職的 libaudioroute library..

2014年9月2日 星期二

dtb, dtc, dts

上次說的,kernel config 改成 dts,然後用 dtc compile 成 dtb

dtc 在 kernel/script/dtc

dts 到 dtb 的 Makfile rule 在.. (以 arm 為例):
%.dtb: scripts
        $(Q)$(MAKE) $(build)=$(boot)/dts MACHINE=$(MACHINE) $(boot)/dts/$@

dtbs: scripts
        $(Q)$(MAKE) $(build)=$(boot)/dts MACHINE=$(MACHINE) dtbs

所以 make dtbs 就會 make platform 的 dtb
make abc.dtb 就會把 abc.dts compile 成 abc.dtb

標籤

網誌存檔