Permalink
Browse files

修改usb挂载,支持内外sd卡

  • Loading branch information...
1 parent fcb772a commit f8ff591193ed9d5ddd0023960c60d97407a7e8bb @syhost syhost committed Dec 2, 2012
View
7 patch_device/ef39s/device.conf
@@ -1,8 +1,8 @@
ini_set("rom_device", "A800S");
ini_set("rom_name", "MIUI Recovery for A800S");
-ini_set("rom_version", "2.03");
+ini_set("rom_version", "2.04");
ini_set("rom_author", "syhost");
-ini_set("rom_date", "2012-12-01");
+ini_set("rom_date", "2012-12-02");
ini_set("dp", "4");
ini_set("sd_ext", "1");
@@ -13,4 +13,7 @@ ini_set("customkeycode_select", "116");
ini_set("customkeycode_menu", "229");
ini_set("customkeycode_back", "158");
+#set mass_storage, if not set do not echo item
+ini_set("lun_file", "/sys/devices/platform/usb_mass_storage/lun");
+
View
12 patch_device/ef39s/root/default.prop
@@ -9,13 +9,13 @@ persist.sys.usb.config=mass_storage,adb
# begin build properties
# autogenerated by buildinfo.sh
ro.build.id=IMM76L
-ro.build.display.id=full_ef39s-eng 4.0.4 IMM76L eng.syhost.20121201.033838 test-keys
-ro.build.version.incremental=eng.syhost.20121201.033838
+ro.build.display.id=full_ef39s-eng 4.0.4 IMM76L eng.syhost.20121202.131544 test-keys
+ro.build.version.incremental=eng.syhost.20121202.131544
ro.build.version.sdk=15
ro.build.version.codename=REL
ro.build.version.release=4.0.4
-ro.build.date=2012年 12月 01日 星期六 03:39:26 CST
-ro.build.date.utc=1354304366
+ro.build.date=2012年 12月 02日 星期日 13:16:55 CST
+ro.build.date.utc=1354425415
ro.build.type=eng
ro.build.user=syhost
ro.build.host=soyu-ubuntu
@@ -33,8 +33,8 @@ ro.board.platform=msm8660
# ro.build.product is obsolete; use ro.product.device
ro.build.product=ef39s
# Do not try to parse ro.build.description or .fingerprint
-ro.build.description=full_ef39s-eng 4.0.4 IMM76L eng.syhost.20121201.033838 test-keys
-ro.build.fingerprint=pantech/full_ef39s/ef39s:4.0.4/IMM76L/eng.syhost.20121201.033838:eng/test-keys
+ro.build.description=full_ef39s-eng 4.0.4 IMM76L eng.syhost.20121202.131544 test-keys
+ro.build.fingerprint=pantech/full_ef39s/ef39s:4.0.4/IMM76L/eng.syhost.20121202.131544:eng/test-keys
ro.build.characteristics=default
# end build properties
#
View
11 patch_device/ef39s/root/res/device.conf
@@ -1,11 +0,0 @@
-#ini_set("force_colorspace", "bgra");
-#ini_set("force_colorspace", "argb");
-ini_set("dp", "4");
-ini_set("force_colorspace", "rgba");
-ini_set("customkeycode_up", "115");
-ini_set("customkeycode_down", "114");
-ini_set("customkeycode_select", "116");
-ini_set("customkeycode_menu", "229");
-ini_set("customkeycode_back", "158");
-
-ini_set("rom_device", "A820L");
View
7 patch_device/ef40s/device.conf
@@ -1,8 +1,8 @@
ini_set("rom_device", "A810S");
ini_set("rom_name", "MIUI Recovery for A810S");
-ini_set("rom_version", "2.03");
+ini_set("rom_version", "2.04");
ini_set("rom_author", "syhost");
-ini_set("rom_date", "2012-12-01");
+ini_set("rom_date", "2012-12-02");
ini_set("dp", "4");
ini_set("sd_ext", "1");
@@ -13,4 +13,7 @@ ini_set("customkeycode_select", "116");
ini_set("customkeycode_menu", "229");
ini_set("customkeycode_back", "158");
+#set mass_storage, if not set do not echo item
+ini_set("lun_file", "/sys/devices/platform/usb_mass_storage/lun");
+
View
12 patch_device/ef40s/root/default.prop
@@ -9,13 +9,13 @@ persist.sys.usb.config=mass_storage,adb
# begin build properties
# autogenerated by buildinfo.sh
ro.build.id=IMM76L
-ro.build.display.id=full_ef40s-eng 4.0.4 IMM76L eng.syhost.20121201.033838 test-keys
-ro.build.version.incremental=eng.syhost.20121201.033838
+ro.build.display.id=full_ef40s-eng 4.0.4 IMM76L eng.syhost.20121202.131544 test-keys
+ro.build.version.incremental=eng.syhost.20121202.131544
ro.build.version.sdk=15
ro.build.version.codename=REL
ro.build.version.release=4.0.4
-ro.build.date=2012年 12月 01日 星期六 03:39:26 CST
-ro.build.date.utc=1354304366
+ro.build.date=2012年 12月 02日 星期日 13:16:55 CST
+ro.build.date.utc=1354425415
ro.build.type=eng
ro.build.user=syhost
ro.build.host=soyu-ubuntu
@@ -33,8 +33,8 @@ ro.board.platform=msm8660
# ro.build.product is obsolete; use ro.product.device
ro.build.product=ef40s
# Do not try to parse ro.build.description or .fingerprint
-ro.build.description=full_ef40s-eng 4.0.4 IMM76L eng.syhost.20121201.033838 test-keys
-ro.build.fingerprint=pantech/full_ef40s/ef40s:4.0.4/IMM76L/eng.syhost.20121201.033838:eng/test-keys
+ro.build.description=full_ef40s-eng 4.0.4 IMM76L eng.syhost.20121202.131544 test-keys
+ro.build.fingerprint=pantech/full_ef40s/ef40s:4.0.4/IMM76L/eng.syhost.20121202.131544:eng/test-keys
ro.build.characteristics=default
# end build properties
#
View
11 patch_device/ef40s/root/res/device.conf
@@ -1,11 +0,0 @@
-#ini_set("force_colorspace", "bgra");
-#ini_set("force_colorspace", "argb");
-ini_set("dp", "4");
-ini_set("force_colorspace", "rgba");
-ini_set("customkeycode_up", "115");
-ini_set("customkeycode_down", "114");
-ini_set("customkeycode_select", "116");
-ini_set("customkeycode_menu", "229");
-ini_set("customkeycode_back", "158");
-
-ini_set("rom_device", "A820L");
View
2 patch_device/ef65l/Android.mk
@@ -8,5 +8,5 @@ MIUI_KERNEL_PAGESIZE := 2048
MIUI_KERNEL_CMDLINE := console=ttyHSL0,115200,n8 androidboot.hardware=qcom androidboot.carrier=LGT-KOR loglevel=0
MIUI_PRODUCT_ROOT := $(LOCAL_PATH)/root
-MIUI_DEVICE_CONFIG := $(LOCAL_PATH)/device.conf
+MIUI_DEVICE_CONFIG := $(LOCAL_PATH)/*.conf
include $(MIUI_RECOVERY)
View
7 patch_device/ef65l/device.conf
@@ -1,8 +1,8 @@
ini_set("rom_device", "A820L");
ini_set("rom_name", "MIUI Recovery for A820L");
-ini_set("rom_version", "2.03");
+ini_set("rom_version", "2.04");
ini_set("rom_author", "syhost");
-ini_set("rom_date", "2012-12-01");
+ini_set("rom_date", "2012-12-02");
ini_set("dp", "4");
ini_set("sd_ext", "1");
@@ -13,4 +13,7 @@ ini_set("customkeycode_select", "116");
ini_set("customkeycode_menu", "229");
ini_set("customkeycode_back", "158");
+#set mass_storage, if not set do not echo item
+ini_set("lun_file", "/sys/devices/platform/usb_mass_storage/lun");
+
View
14 patch_device/ef65l/root/default.prop
@@ -5,17 +5,17 @@ ro.secure=0
ro.allow.mock.location=1
ro.debuggable=1
persist.sys.timezone=Asia/Shanghai
-persist.sys.usb.config=mass_storage, adb
+persist.sys.usb.config=mass_storage,adb
# begin build properties
# autogenerated by buildinfo.sh
ro.build.id=IMM76L
-ro.build.display.id=full_ef65l-eng 4.0.4 IMM76L eng.syhost.20121201.033838 test-keys
-ro.build.version.incremental=eng.syhost.20121201.033838
+ro.build.display.id=full_ef65l-eng 4.0.4 IMM76L eng.syhost.20121202.131544 test-keys
+ro.build.version.incremental=eng.syhost.20121202.131544
ro.build.version.sdk=15
ro.build.version.codename=REL
ro.build.version.release=4.0.4
-ro.build.date=2012年 12月 01日 星期六 03:39:26 CST
-ro.build.date.utc=1354304366
+ro.build.date=2012年 12月 02日 星期日 13:16:55 CST
+ro.build.date.utc=1354425415
ro.build.type=eng
ro.build.user=syhost
ro.build.host=soyu-ubuntu
@@ -33,8 +33,8 @@ ro.board.platform=msm8660
# ro.build.product is obsolete; use ro.product.device
ro.build.product=ef65l
# Do not try to parse ro.build.description or .fingerprint
-ro.build.description=full_ef65l-eng 4.0.4 IMM76L eng.syhost.20121201.033838 test-keys
-ro.build.fingerprint=pantech/full_ef65l/ef65l:4.0.4/IMM76L/eng.syhost.20121201.033838:eng/test-keys
+ro.build.description=full_ef65l-eng 4.0.4 IMM76L eng.syhost.20121202.131544 test-keys
+ro.build.fingerprint=pantech/full_ef65l/ef65l:4.0.4/IMM76L/eng.syhost.20121202.131544:eng/test-keys
ro.build.characteristics=default
# end build properties
#
View
6 src/miui/src/libs/miui_screen.c
@@ -95,9 +95,9 @@ static void *screen_black_thread(void *cookie)
static pthread_t screen_thread_t;
static int screen_init()
{
- //default interval 15 seconds
- time_interval = 60;
- screen_set_light(80);
+ //default interval 120 seconds
+ time_interval = 120;
+ screen_set_light(60);
screen_set_time(time((time_t*)NULL));
screen_set_black(0);
View
10 src/miui/src/main/miui_ui.c
@@ -189,9 +189,9 @@ static int _miui_draw_battery(CANVAS *win, int x, int y, color fg, color bg)
int txtH = ag_fontheight(0);
int txtW = ag_fontheight(0)*2;
int battW = 12*agdp();
- ag_rect(win, txtX - 2, y+1, battW, txtH-3, fg);
- ag_rect(win, txtX - 1, y+2, battW - 2, txtH-5, bg);
- txtX += agdp()-4;
+ ag_rect(win, txtX, y+1, battW, txtH-3, fg);
+ ag_rect(win, txtX+1, y+2, battW - 2, txtH-5, bg);
+ txtX += agdp();
ag_textf(win, txtW, txtX+1, txtY+1, batt_name, bg, 0);
ag_textf(win, txtW, txtX, txtY, batt_name, fg, 0);
int rectH = agdp() * 3;
@@ -1373,8 +1373,8 @@ STATUS miui_langmenu(char *title_name, char *title_icon) {
//-- Check Box
ACONTROLP menu1 = acsdmenu(hWin,0,chkY,chkW,chkH,6);
//-- Populate Checkbox Items
- acsdmenu_add(menu1, "简体中文", "欢迎使用A820L中文恢复系统 syhost制作 @anzhi.com", "@lang.cn");
- acsdmenu_add(menu1, "English", "Welcome to MIUI Recovery for A820L by syhost @anzhi.com", "@lang.en");
+ acsdmenu_add(menu1, "简体中文", "欢迎使用中文恢复系统 syhost制作 @anzhi.com", "@lang.cn");
+ acsdmenu_add(menu1, "English", "Welcome to MIUI Recovery by syhost @anzhi.com", "@lang.en");
//-- Dispatch Message
aw_show(hWin);
View
4 src/miui/src/utils.h
@@ -32,9 +32,9 @@ typedef int u32;
//
#define MIUI_NAME "MIUI Recovery by syhost"
//rom_version
-#define MIUI_VERSION "2.03"
+#define MIUI_VERSION "2.04"
//rom date
-#define MIUI_BUILD "2012-12-01"
+#define MIUI_BUILD "2012-12-02"
#define MIUI_BUILD_CN "Weekend"
#define MIUI_BUILD_L "Dennis"
#define MIUI_BUILD_A "<yanhao@xiaomi.com>"
View
105 src/mount.c
@@ -39,54 +39,90 @@
* Available state: DISCONNECTED, CONFIGURED, CONNECTED
*/
#define BOARD_USB_CONFIG_FILE "/sys/class/android_usb/android0/state"
+
+// USB_STATE_CONFIGURED
+#define BOARD_USB_CONFIG_FILE1 "/sys/devices/platform/msm_hsusb/gadget/usb_state"
#endif
-static int is_usb_connected() {
+static int is_usb_connected()
+{
char state[255];
+ char sel_config_file = 0;
int fd = open(BOARD_USB_CONFIG_FILE, O_RDONLY);
- if (fd < 0) {
- LOGE("Unable to open usb_configuration state file(%s)\n",
- strerror(errno));
- return 0;
+ if (fd < 0)
+ {
+ fd = open(BOARD_USB_CONFIG_FILE1, O_RDONLY);
+ if (fd < 0)
+ {
+ LOGE("Unable to open usb_configuration state file(%s)\n",strerror(errno));
+ close(fd);
+ return 0;
+ }
+ else
+ {
+ sel_config_file = 1;
+ }
}
+ else
+ {
+ sel_config_file = 0;
+ }
- if (read(fd, state, sizeof(state)) < 0) {
- LOGE("Unable to read usb_configuration state file(%s)\n",
- strerror(errno));
+ if (read(fd, state, sizeof(state)) < 0)
+ {
+ LOGE("Unable to read usb_configuration state file(%s)\n", strerror(errno));
close(fd);
return 0;
}
state[254] = '\0';
- LOGE("%s: state=%s\n", __func__, state);
-
+ LOGI("%s: state=%s\n", __func__, state);
close(fd);
- return state[0] == 'C';
+
+ return state[10*sel_config_file] == 'C';
}
-static int mount_usb() {
+static int mount_usb()
+{
int ret = 0;
int fd;
char value[PROPERTY_VALUE_MAX];
Volume *vol = volume_for_path("/sdcard");
+ Volume *vol_ext = volume_for_path("/external_sd");
+ char lunfilename[PATH_MAX];
property_get("sys.usb.state", value, "");
value[PROPERTY_VALUE_MAX - 1] = '\0';
LOGE("%s: sys.usb.state=%s\n", __func__, value);
if (strncmp("mass_storage,adb", value, 16))
property_set("sys.usb.config", "mass_storage,adb");
- if ((fd = open(acfg()->lun_file, O_WRONLY)) < 0) {
- LOGE("Unable to open ums lunfile (%s)", strerror(errno));
+ sprintf(lunfilename, "%s%d/file", acfg()->lun_file, 0);
+ if ((fd = open(lunfilename, O_WRONLY)) < 0)
+ {
+ LOGE("Unable to open ums lunfile 0 (%s)", strerror(errno));
+ ret = -1;
+ goto next;
+ }
+ if ((write(fd, vol->device, strlen(vol->device)) < 0) && (!vol->device2 || (write(fd, vol->device2, strlen(vol->device2)) < 0)))
+ {
+ LOGE("Unable to write to ums lunfile 0 (%s)", strerror(errno));
+ ret = -1;
+ }
+
+next:
+ sprintf(lunfilename, "%s%d/file", acfg()->lun_file, 1);
+ if ((fd = open(lunfilename, O_WRONLY)) < 0)
+ {
+ LOGE("Unable to open ums lunfile 1 (%s)", strerror(errno));
ret = -1;
goto out;
}
- if ((write(fd, vol->device, strlen(vol->device)) < 0) &&
- (!vol->device2 || (write(fd, vol->device, strlen(vol->device2)) < 0))) {
- LOGE("Unable to write to ums lunfile (%s)", strerror(errno));
+ if ((write(fd, vol_ext->device, strlen(vol_ext->device)) < 0) && (!vol_ext->device2 || (write(fd, vol_ext->device2, strlen(vol_ext->device2)) < 0)))
+ {
+ LOGE("Unable to write to ums lunfile 1 (%s)", strerror(errno));
ret = -1;
}
-
close(fd);
out:
return ret;
@@ -97,17 +133,36 @@ static int umount_usb() {
int fd;
char ch = 0;
char value[PROPERTY_VALUE_MAX];
-
- if ((fd = open(acfg()->lun_file, O_WRONLY)) < 0) {
- LOGE("Unable to open ums lunfile (%s)", strerror(errno));
+ char lunfilename[PATH_MAX];
+
+ sprintf(lunfilename, "%s%d/file", acfg()->lun_file, 0);
+ if ((fd = open(lunfilename, O_WRONLY)) < 0)
+ {
+ LOGE("Unable to open ums lunfile 0 (%s)", strerror(errno));
ret = -1;
- goto out;
+ goto next;
}
- if (write(fd, &ch, 1) < 0) {
- LOGE("Unable to write to ums lunfile (%s)", strerror(errno));
+ if (write(fd, &ch, 1) < 0)
+ {
+ LOGE("Unable to write to ums lunfile 0 (%s)", strerror(errno));
ret = -1;
}
+
+next:
+ sprintf(lunfilename, "%s%d/file", acfg()->lun_file, 1);
+ if ((fd = open(lunfilename, O_WRONLY)) < 0)
+ {
+ LOGE("Unable to open ums lunfile 1 (%s)", strerror(errno));
+ ret = -1;
+ goto next;
+ }
+
+ if (write(fd, &ch, 1) < 0)
+ {
+ LOGE("Unable to write to ums lunfile 1 (%s)", strerror(errno));
+ ret = -1;
+ }
close(fd);
out:
@@ -132,6 +187,7 @@ intentResult* intent_toggle(int argc, char *argv[])
{
umount_usb();
ensure_path_unmounted("/sdcard");
+ ensure_path_unmounted("/external_sd");
return miuiIntent_result_set(result, "ok");
}
//wait for usb connected
@@ -144,6 +200,7 @@ intentResult* intent_toggle(int argc, char *argv[])
LOGE("USB not connect\n");
umount_usb();
ensure_path_unmounted("/sdcard");
+ ensure_path_unmounted("/external_sd");
return miuiIntent_result_set(result, "ok");
}

0 comments on commit f8ff591

Please sign in to comment.