microcom -d 1200 -s 115200 /dev/ttyUSB3
: 設定 character timeout 是 1200ms,baudrate 是 115200,對 /dev/ttyUSB3 動作。package 有問題,ref: http://r40eubuntu.blogspot.tw/2013/10/uart-terminal-with-log-microcom.html
ubuntu 在 R40e 上 還有 Debian 在 Sempron 2600 上
microcom -d 1200 -s 115200 /dev/ttyUSB3
: 設定 character timeout 是 1200ms,baudrate 是 115200,對 /dev/ttyUSB3 動作。system/core/include/private/android_filesystem_config.h
實際reference ,使用的是:
system/core/cpio/mkbootfs.c
idVendor=12d1, idProduct=140c
但是和網路上 140C 的 Huawei dongle 不一樣的是,這個(fake) E180 是同時有 3G modem, CD ROM + card reader 三種 device profile 同時啟動。10.64.64.64
route :
Destination Gateway Genmask Flags Metric Ref Use Iface
10.64.64.64 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0
169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 ppp0
0.0.0.0 10.64.64.64 0.0.0.0 UG 0 0 0 ppp0
^BOOT:32614906,0,0,0,20
^SRVST:1
^MODE:5,4
^STIN:0,0,0
^RSSI:13
^RSSI:13
..
依照 這一篇(http://forum.huawei.com/jive4/thread.jspa?threadID=328818) 的說法,下
AT^CURC=0
就可以停止這些 unsolicied response.[ 3322.275837] usb 2-1.1.4.3: new high speed USB device using ehci_hcd and address 7
[ 3322.385272] usb 2-1.1.4.3: New USB device found, idVendor=0fce, idProduct=014f
[ 3322.385277] usb 2-1.1.4.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 3322.385280] usb 2-1.1.4.3: Product: SEMC HSUSB Device
[ 3322.385282] usb 2-1.1.4.3: Manufacturer: SEMC
[ 3322.385285] usb 2-1.1.4.3: SerialNumber: XXXXXXXXXXXX
[ 3322.385429] usb 2-1.1.4.3: configuration #1 chosen from 1 choice
[ 3360.185459] usb 2-1.1.4.3: USB disconnect, address 7
[ 3360.404499] usb 2-1.1.4.3: new high speed USB device using ehci_hcd and address 8
[ 3360.513935] usb 2-1.1.4.3: New USB device found, idVendor=0fce, idProduct=714f
[ 3360.513939] usb 2-1.1.4.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 3360.513942] usb 2-1.1.4.3: Product: SEMC HSUSB Device
[ 3360.513945] usb 2-1.1.4.3: Manufacturer: SEMC
[ 3360.513947] usb 2-1.1.4.3: SerialNumber: XXXXXXXXXXXX
[ 3360.514069] usb 2-1.1.4.3: configuration #1 chosen from 1 choice
[ 3360.582488] usbcore: registered new interface driver cdc_ether
[ 3360.587738] usb0: register 'rndis_host' at usb-0000:00:1d.0-1.1.4.3, RNDIS device, XX:XX:XX:XX:XX:XX
[ 3360.587786] usbcore: registered new interface driver rndis_host
[ 3371.666534] usb0: no IPv6 routers present
所以host 要 support,要 enable cdc_ether ,還有 rndis_host。obj-$(CONFIG_USB_NET_CDCETHER) += cdc_ether.o
obj-$(CONFIG_USB_NET_RNDIS_HOST) += rndis_host.o
config USB_NET_CDCETHER
tristate "CDC Ethernet support (smart devices such as cable modems)"
depends on USB_USBNET
default y
config USB_USBNET
tristate "Multi-purpose USB Networking Framework"
select MII
還有,這些是屬於...
menu "USB Network Adapters"
depends on USB && NET
$sudo route -n
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.43.0 0.0.0.0 255.255.255.0 U 2 0 0 wlan0
169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 wlan0
0.0.0.0 192.168.43.1 0.0.0.0 UG 0 0 0 wlan0
公司內部又分很多 sub network,我的ethernet 好像是在 192.168.144.0 網段,$sudo route add -net 192.168.144.netmask 255.255.255. dev eth0
然後加上要 access 的 server:
$sudo route add -host 191.168.147.233 gw 192.168.144.254 dev eth0
因為公司有分很多 sub net, 144 網段的 gateway 是 254。sudo route add -host 192.168.147.15 gw 192.168.144.254 dev eth0
sudo route add -net 192.168.147.0 netmask 255.255.255.0 gw 192.168.144.254 dev eth0
04:00.0 Network controller: Broadcom Corporation BCM4313 802.11b/g/n Wireless LAN Controller (rev 01)
或是用 lshw --class network 看
*-network
description: Wireless interface
product: BCM4313 802.11b/g/n Wireless LAN Controller
vendor: Broadcom Corporation
physical id: 0
bus info: pci@0000:04:00.0
logical name: wlan0
version: 01
serial: 5c:ac:4c:98:d7:59
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless
configuration: broadcast=yes driver=brcm80211 ip=192.168.43.230 latency=0 multicast=yes wireless=IEEE 802.11bgn
resources: irq:17 memory:f0300000-f0303fff
知道是 BCM4313import android.app.ActivityManagerNative;
import android.util.Log;
try {
ActivityManagerNative.getDefault().setAlwaysFinish(true);
} catch (RemoteException ex) {
Log.d(TAG,"setAlwaysFinish failed!!");
}
結果可以用 adk 的 hierarchyviewer 來看。#sqilt3 /data/data/com.android.providers.settings/database/settings.db
顯示 所有內容:
sqilte>select * from system;
1|volume_music|12
2|volume_ring|5
3|volume_system|7
4|volume_voice|4
5|volume_alarm|6
6|volume_notification|5
7|volume_bluetooth_sco|7
8|mode_ringer|2
9|vibrate_on|4
10|mode_ringer_streams_affected|166
11|mute_streams_affected|46
12|dim_screen|1
13|stay_on_while_plugged_in|0
14|screen_off_timeout|-1
15|emergency_tone|0
16|xec_dls_control|0
17|call_auto_retry|0
18|dtmf_tone_type|0
19|hearing_aid|0
20|tty_mode|0
21|airplane_mode_on|0
22|airplane_mode_radios|cell,bluetooth,wifi
23|airplane_mode_toggleable_radios|bluetooth,wifi
24|auto_time|1
25|screen_brightness|255
26|screen_brightness_mode|0
27|window_animation_scale|1.0
28|transition_animation_scale|1.0
29|accelerometer_rotation|1
30|haptic_feedback_enabled|1
31|notification_light_pulse|1
32|set_install_location|0
33|default_install_location|0
34|power_sounds_enabled|1
35|low_battery_sound|/system/media/audio/ui/LowBattery.ogg
36|dock_sounds_enabled|0
37|desk_dock_sound|/system/media/audio/ui/Dock.ogg
38|desk_undock_sound|/system/media/audio/ui/Undock.ogg
39|car_dock_sound|/system/media/audio/ui/Dock.ogg
40|car_undock_sound|/system/media/audio/ui/Undock.ogg
41|lockscreen_sounds_enabled|0
42|lock_sound|/system/media/audio/ui/Lock.ogg
43|unlock_sound|/system/media/audio/ui/Unlock.ogg
44|vibrate_in_silent|1
45|notifications_use_ring_volume|1
46|next_alarm_formatted|
47|alarm_alert|content://media/internal/audio/media/1
48|notification_sound|content://media/internal/audio/media/2
49|ringtone|content://media/internal/audio/media/3
50|pointer_location|0
52|ServiceIntentActionToResumeSD|
69|MediaPlaybackPath|content://media/external/audio/media/131076
70|always_finish_activities|1
sqlite>
default 沒有 show 欄位名稱,可以用:
sqlite>.header on
打開,然後再顯示一次..
sqlite> select * from system;
_id name value
---------- ------------ ----------
1 volume_music 12
2 volume_ring 5
3 volume_syste 7
4 volume_voice 4
5 volume_alarm 6
6 volume_notif 5
7 volume_bluet 7
8 mode_ringer 2
...
hierarchyviewer
是 GUI 介面,會自動 update。import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.widget.Button;
import android.widget.LinearLayout;
import android.view.View;
public class testAndroidActivity extends Activity implements View.OnClickListener
{
final String TAG = "testAndroid";
LinearLayout layout;
Button btn;
int clickcnt = 0;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
layout = new LinearLayout(this);
layout.setOrientation(LinearLayout.VERTICAL);
btn = new Button(this);
btn.setText(Integer.toString(clickcnt));
btn.setOnClickListener(this);
layout.addView(btn,150,100);
setContentView(layout);
Log.v(TAG,"onCreate");
}
public void onClick(View v) {
Log.v(TAG, "onClick");
clickcnt++;
btn.setText(Integer.toString(clickcnt));
}
結果..import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.widget.Button;
import android.widget.LinearLayout;
import android.view.View;
public class testAndroidActivity extends Activity implements View.OnClickListener
{
final String TAG = "testAndroid";
LinearLayout layout;
Button btn;
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
layout = new LinearLayout(this);
layout.setOrientation(LinearLayout.VERTICAL);
btn = new Button(this);
btn.setText("Button");
btn.setOnClickListener(this);
layout.addView(btn,150,50);
setContentView(layout);
}
public void onClick(View v) {
Log.v(TAG, "onClick");
}
..
android create project \
--target 1 \
--name MyAndroidApp \
--path ./MyAndroidAppProject \
--activity MyAndroidAppActivity \
--package com.example.myandroid
target 的內容可以用 command:
android list targets
----------
id: 1 or "android-3"
Name: Android 1.5
Type: Platform
API level: 3
Revision: 4
Skins: HVGA-L, QVGA-L, HVGA-P, QVGA-P, HVGA (default)
ABIs : armeabi
----------
id: 2 or "Google Inc.:Google APIs:3"
Name: Google APIs
Type: Add-On
Vendor: Google Inc.
Revision: 3
Description: Android + Google APIs
Based on Android 1.5 (API level 3)
Libraries:
* com.google.android.maps (maps.jar)
API for Google Maps
Skins: QVGA-P, HVGA (default), HVGA-L, QVGA-L, HVGA-P
ABIs : armeabi
----------
id: 3 or "android-4"
Name: Android 1.6
Type: Platform
API level: 4
Revision: 3
Skins: WVGA800 (default), QVGA, HVGA, WVGA854
ABIs : armeabi
path 選項,如果 path 不存在,就會幫你create。Android make apk error:This attribute must be localized.
參考這一篇:http://jjnnykimo.pixnet.net/blog/post/31996155-android-make-apk-error%3Athis-attribute-must-be-localized.有加 _init,會不會後來又再 run 一次?code:
struct tag *tags = (struct tag *)&init_tags;
struct machine_desc *mdesc;
char *from = default_command_line;
mdesc = setup_machine(machine_arch_type);
machine_name = mdesc->name;
if (mdesc->soft_reboot)
reboot_setup("s");
if (__atags_pointer)
tags = phys_to_virt(__atags_pointer);
else if (mdesc->boot_params)
tags = phys_to_virt(mdesc->boot_params);
else
init_tags.mem.start = PHYS_OFFSET;
__atags_pointer 是 uboot 傳遞參數的位址,boot_params 也是。/arch/arm/plat-mxc/include/mach/memory.h:17:#define MX1_PHYS_OFFSET UL(0x08000000)
./arch/arm/plat-mxc/include/mach/memory.h:18:#define MX21_PHYS_OFFSET UL(0xc0000000)
./arch/arm/plat-mxc/include/mach/memory.h:19:#define MX25_PHYS_OFFSET UL(0x80000000)
./arch/arm/plat-mxc/include/mach/memory.h:20:#define MX27_PHYS_OFFSET UL(0xa0000000)
./arch/arm/plat-mxc/include/mach/memory.h:21:#define MX3x_PHYS_OFFSET UL(0x80000000)
./arch/arm/plat-mxc/include/mach/memory.h:22:#define MX37_PHYS_OFFSET UL(0x40000000)
./arch/arm/plat-mxc/include/mach/memory.h:23:#define MX50_PHYS_OFFSET UL(0x70000000)
./arch/arm/plat-mxc/include/mach/memory.h:24:#define MX51_PHYS_OFFSET UL(0x90000000)
./arch/arm/plat-mxc/include/mach/memory.h:25:#define MX53_PHYS_OFFSET UL(0x70000000)
./arch/arm/plat-mxc/include/mach/memory.h:26:#define MXC91231_PHYS_OFFSET UL(0x90000000)
所以是 MX51 是 0x90000000 void start_property_service(void)
{
int fd;
load_properties_from_file(PROP_PATH_SYSTEM_BUILD);
load_properties_from_file(PROP_PATH_SYSTEM_DEFAULT);
load_properties_from_file(PROP_PATH_LOCAL_OVERRIDE);
/* Read persistent properties after all default values have been loaded. */
load_persistent_properties();
fd = create_socket(PROP_SERVICE_NAME, SOCK_STREAM, 0666, 0, 0);
if(fd < 0) return;
fcntl(fd, F_SETFD, FD_CLOEXEC);
fcntl(fd, F_SETFL, O_NONBLOCK);
listen(fd, 8);
property_set_fd = fd;
}
core/init 這個 process 最後,好像就是在做 property_service.. main() 的最後:
for(;;) {
...
...
nr = poll(ufds, fd_count, timeout);
if (nr <= 0)
continue;
for (i = 0; i < fd_count; i++) {
if (ufds[i].revents == POLLIN) {
if (ufds[i].fd == get_property_set_fd())
handle_property_set_fd();
else if (ufds[i].fd == get_keychord_fd())
handle_keychord();
else if (ufds[i].fd == get_signal_fd())
handle_signal();
}
}
}
ufds 就是剛剛 create_socket(PROP_SERVICE_NAME...) 的 fd#define PERSISTENT_PROPERTY_DIR "/data/property"
./system/core/adb/adb_client.c:251: printf("adb server is out of date. killing...\n");
是 compare version:
int adb_connect(const char *service)
{
// first query the adb server's version
int fd = _adb_connect("host:version");
....
char buf[100];
int n;
int version = ADB_SERVER_VERSION - 1;
// if we have a file descriptor, then parse version result
if(readx(fd, buf, 4)) goto error;
buf[4] = 0;
n = strtoul(buf, 0, 16);
if(readx(fd, buf, n)) goto error;
adb_close(fd);
if (sscanf(buf, "%04x", &version) != 1) goto error;
} else {
........
}
....
if(version != ADB_SERVER_VERSION) {
printf("adb server is out of date. killing...\n");
就是去詢問 host adb server 的版本,然後和自己比較。