From f52a1eae15f6a2b38a0be6e4407873bba257c3ab Mon Sep 17 00:00:00 2001 From: "giyeol.ok" Date: Wed, 24 Oct 2012 11:45:04 +0900 Subject: [PATCH] remove all features of usb host Change-Id: I4969726d4e62d6c57c6fca9c3dd796af6346625e --- CMakeLists.txt | 3 +- packaging/system-server.spec | 11 +- ss_device_change_handler.c | 250 ++++++-------------------------- ss_main.c | 1 - ss_usb_storage_handler.c | 269 ----------------------------------- udev-rules/91-system-server.rules.in | 6 +- 6 files changed, 52 insertions(+), 488 deletions(-) delete mode 100644 ss_usb_storage_handler.c diff --git a/CMakeLists.txt b/CMakeLists.txt index 69d554f..8ade278 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,8 +22,7 @@ SET(SRCS ss_procmgr.c ss_timemgr.c ss_cpu_handler.c - ss_device_plugin.c - ss_usb_storage_handler.c) + ss_device_plugin.c) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/packaging/system-server.spec b/packaging/system-server.spec index 02d6d75..7abd8cb 100755 --- a/packaging/system-server.spec +++ b/packaging/system-server.spec @@ -23,6 +23,7 @@ BuildRequires: pkgconfig(devman_plugin) BuildRequires: pkgconfig(x11) BuildRequires: pkgconfig(svi) BuildRequires: pkgconfig(notification) +BuildRequires: pkgconfig(usbutils) BuildRequires: gettext %description @@ -81,14 +82,8 @@ heynotitool set device_tvout_chgdet heynotitool set device_hdmi_chgdet heynotitool set device_charge_chgdet heynotitool set device_keyboard_chgdet -heynotitool set device_keyboard_add -heynotitool set device_keyboard_remove -heynotitool set device_mouse_add -heynotitool set device_mouse_remove -heynotitool set device_unknown_usb_add -heynotitool set device_unknown_usb_remove -heynotitool set device_camera_add -heynotitool set device_camera_remove +heynotitool set device_usb_host_add +heynotitool set device_usb_host_remove mkdir -p /etc/udev/rules.d diff --git a/ss_device_change_handler.c b/ss_device_change_handler.c index 1c94512..d44e1e9 100755 --- a/ss_device_change_handler.c +++ b/ss_device_change_handler.c @@ -40,6 +40,9 @@ #define BUFF_MAX 255 #define SYS_CLASS_INPUT "/sys/class/input" +#define USBCON_EXEC_PATH PREFIX"/bin/usb-server" +#define DEFAULT_USB_INFO_PATH "/tmp/usb_default" +#define STORE_DEFAULT_USB_INFO "usb-devices > "DEFAULT_USB_INFO_PATH struct input_event { long dummy[2]; @@ -199,187 +202,6 @@ static void keyboard_chgdet_cb(struct ss_main_data *ad) } } -static int show_tickernoti(char* msg) -{ - PRT_TRACE("show tickernoti : %s\n", msg); - int ret = -1; - - bundle *b = NULL; - - b = bundle_create(); - if (!b) { - PRT_TRACE_ERR("FAIL: bundle_create()\n"); - return -1; - } - - ret = bundle_add(b, "0", "info"); /* "0" means tickernoti style */ - if (ret != 0) { - PRT_TRACE_ERR("FAIL: bundle_add()\n"); - if (0 != bundle_free(b)) - PRT_TRACE_ERR("FAIL: bundle_free()\n"); - return -1; - } - - ret = bundle_add(b, "1", dgettext("system-server", msg)); /* "1" means popup text */ - if (ret != 0) { - PRT_TRACE_ERR("FAIL: bundle_add()\n"); - if (0 != bundle_free(b)) - PRT_TRACE_ERR("FAIL: bundle_free()\n"); - return -1; - } - - ret = bundle_add(b, "2", "0"); /* "2" means orientation of tickernoti */ - if (ret != 0) { - PRT_TRACE_ERR("FAIL: bundle_add()\n"); - if (0 != bundle_free(b)) - PRT_TRACE_ERR("FAIL: bundle_free()\n"); - return -1; - } - - ret = bundle_add(b, "3", "3"); /* "3" means timeout(second) of tickernoti */ - if (ret != 0) { - PRT_TRACE_ERR("FAIL: bundle_add()\n"); - if (0 != bundle_free(b)) - PRT_TRACE_ERR("FAIL: bundle_free()\n"); - return -1; - } - - ret = syspopup_launch("tickernoti-syspopup", b); - if (ret != 0) - PRT_TRACE_ERR("FAIL: syspopup_launch()\n"); - - if (0 != bundle_free(b)) - PRT_TRACE_ERR("FAIL: bundle_free()\n"); - - return 0; -} - -// TO DO - multi language -static void keyboard_add_cb(struct ss_main_data *ad) -{ - pm_change_state(LCD_NORMAL); - show_tickernoti("Keyboard connected"); - input_device_number++; - PRT_TRACE("keyboard added (total input device : %d)",input_device_number); -} - -static void keyboard_remove_cb(struct ss_main_data *ad) -{ - pm_change_state(LCD_NORMAL); - show_tickernoti("Keyboard removed safely"); - if (input_device_number > 0) - input_device_number--; - PRT_TRACE("keyboard removed (total input device : %d)",input_device_number); -} - -static void mouse_add_cb(struct ss_main_data *ad) -{ - pm_change_state(LCD_NORMAL); - show_tickernoti("Mouse connected"); - input_device_number++; - PRT_TRACE("mouse added (total input device : %d)",input_device_number); -} - -static void mouse_remove_cb(struct ss_main_data *ad) -{ - pm_change_state(LCD_NORMAL); - show_tickernoti("Mouse removed safely"); - if (input_device_number > 0) - input_device_number--; - PRT_TRACE("Mouse removed (total input device : %d)",input_device_number); -} - -static void camera_add_cb(struct ss_main_data *ad) -{ - int ret = -1; - pm_change_state(LCD_NORMAL); - show_tickernoti("Camera connected"); - - DIR *dp; - struct dirent *dir; - struct stat stat; - char buf[255] = "unknown_camera"; - - if ((dp = opendir("/tmp/camera")) == NULL) { - PRT_TRACE_ERR("Can not open directory\n"); - return -1; - } - chdir("/tmp/camera"); - - while (dir = readdir(dp)) { - memset(&stat, 0, sizeof(struct stat)); - lstat(dir->d_name, &stat); - if (S_ISDIR(stat.st_mode) || S_ISLNK(stat.st_mode)) { - if (strncmp(".", dir->d_name, 1) == 0 - || strncmp("..", dir->d_name, 2) == 0) - continue; - snprintf(buf, 255, "%s", dir->d_name); - } - } - closedir(dp); - - bundle *b = NULL; - b = bundle_create(); - bundle_add(b, "_SYSPOPUP_CONTENT_", "camera_add"); - bundle_add(b, "device_name", buf); - - ret = syspopup_launch("usbotg-syspopup", b); - if (ret < 0) { - PRT_TRACE_EM("popup lauch failed\n"); - } - bundle_free(b); - PRT_TRACE("Camera cannected"); -} - -static void camera_remove_cb(struct ss_main_data *ad) -{ - int ret = -1; - bundle *b = NULL; - b = bundle_create(); - bundle_add(b, "_SYSPOPUP_CONTENT_", "camera_remove"); - - ret = syspopup_launch("usbotg-syspopup", b); - if (ret < 0) { - PRT_TRACE_EM("popup lauch failed\n"); - } - bundle_free(b); - PRT_TRACE("Camera removed"); -} - - -static void unknown_usb_add_cb(struct ss_main_data *ad) -{ - int ret = -1; - pm_change_state(LCD_NORMAL); - bundle *b = NULL; - b = bundle_create(); - bundle_add(b, "_SYSPOPUP_CONTENT_", "unknown_add"); - - ret = syspopup_launch("usbotg-syspopup", b); - if (ret < 0) { - PRT_TRACE_EM("popup lauch failed\n"); - } - bundle_free(b); - PRT_TRACE("unknown usb device added"); -} - -static void unknown_usb_remove_cb(struct ss_main_data *ad) -{ - int ret = -1; - pm_change_state(LCD_NORMAL); - bundle *b = NULL; - b = bundle_create(); - bundle_add(b, "_SYSPOPUP_CONTENT_", "unknown_remove"); - - ret = syspopup_launch("usbotg-syspopup", b); - if (ret < 0) { - PRT_TRACE_EM("popup lauch failed\n"); - } - bundle_free(b); - PRT_TRACE("unknown usb device added"); -} - - static void mmc_chgdet_cb(void *data) { if (data == NULL) { @@ -428,20 +250,47 @@ static void charge_cb(struct ss_main_data *ad) } } -static void __usb_storage_cb(keynode_t *key, void *data) +static void usb_host_chgdet_cb(keynode_t *in_key, struct ss_main_data *ad) { - char *vconf_value; + PRT_TRACE("ENTER: usb_host_chgdet_cb()"); + int status; + int ret = vconf_get_int(VCONFKEY_SYSMAN_USB_HOST_STATUS, &status); + if (ret != 0) { + PRT_TRACE_ERR("vconf get failed(VCONFKEY_SYSMAN_USB_HOST_STATUS)\n"); + return ; + } - if (data == NULL) { - PRT_TRACE("USB Storage removed"); - vconf_value = vconf_get_str(VCONFKEY_INTERNAL_REMOVED_USB_STORAGE); - ss_action_entry_call_internal(PREDEF_USB_STORAGE_REMOVE, 1, vconf_value); - } else { - PRT_TRACE("USB Storage added"); - show_tickernoti("Mass storage enabled"); - vconf_value = vconf_get_str(VCONFKEY_INTERNAL_ADDED_USB_STORAGE); - ss_action_entry_call_internal(PREDEF_USB_STORAGE_ADD, 1, vconf_value); + if(VCONFKEY_SYSMEN_USB_HOST_CONNECTED == status) { + int pid = ss_launch_if_noexist(USBCON_EXEC_PATH, NULL); + if (pid < 0) { + PRT_TRACE("usb-server launching failed\n"); + return; + } } + PRT_TRACE("EXIT: usb_host_chgdet_cb()"); +} + +static void usb_host_add_cb() +{ + PRT_TRACE("ENTER: usb_host_add_cb()\n"); + int status; + int ret = vconf_get_int(VCONFKEY_SYSMAN_USB_HOST_STATUS, &status); + if (ret != 0) { + PRT_TRACE("vconf get failed ()\n"); + return; + } + + if (-1 == status) { /* '-1' means that USB host mode is not loaded yet */ + PRT_TRACE("This usb device is connected defaultly\n"); + + ret = system(STORE_DEFAULT_USB_INFO); + PRT_TRACE("Return value of usb-devices: %d\n", ret); + if (0 != access(DEFAULT_USB_INFO_PATH, F_OK)) { + ret = system(STORE_DEFAULT_USB_INFO); + PRT_TRACE("Return value of usb-devices: %d\n", ret); + } + } + PRT_TRACE("EXIT: usb_host_add_cb()\n"); } int ss_device_change_init(struct ss_main_data *ad) @@ -454,32 +303,25 @@ int ss_device_change_init(struct ss_main_data *ad) ss_noti_add("device_tvout_chgdet", (void *)tvout_chgdet_cb, (void *)ad); ss_noti_add("device_hdmi_chgdet", (void *)hdmi_chgdet_cb, (void *)ad); ss_noti_add("device_keyboard_chgdet", (void *)keyboard_chgdet_cb, (void *)ad); - ss_noti_add("device_keyboard_add", (void *)keyboard_add_cb, (void *)ad); - ss_noti_add("device_keyboard_remove", (void *)keyboard_remove_cb, (void *)ad); - ss_noti_add("device_mouse_add", (void *)mouse_add_cb, (void *)ad); - ss_noti_add("device_mouse_remove", (void *)mouse_remove_cb, (void *)ad); - ss_noti_add("device_camera_add", (void *)camera_add_cb, (void *)ad); - ss_noti_add("device_camera_remove", (void *)camera_remove_cb, (void *)ad); - ss_noti_add("device_unknown_usb_add", (void *)unknown_usb_add_cb, (void *)ad); - ss_noti_add("device_unknown_usb_remove", (void *)unknown_usb_remove_cb, (void *)ad); + + ss_noti_add("device_usb_host_add", (void *)usb_host_add_cb, (void *)ad); ss_noti_add("mmcblk_add", (void *)mmc_chgdet_cb, (void *)1); ss_noti_add("mmcblk_remove", (void *)mmc_chgdet_cb, NULL); ss_noti_add("unmount_ums", (void *)ums_unmount_cb, NULL); ss_noti_add("device_charge_chgdet", (void *)charge_cb, (void *)ad); - if (vconf_notify_key_changed(VCONFKEY_INTERNAL_ADDED_USB_STORAGE, (void *)__usb_storage_cb, (void *)1) < 0) { - PRT_TRACE_ERR("Vconf notify key chaneged failed: KEY(%s)", VCONFKEY_SYSMAN_ADDED_USB_STORAGE); + if (vconf_notify_key_changed(VCONFKEY_SYSMAN_USB_HOST_STATUS, usb_host_chgdet_cb, NULL) < 0) { + PRT_TRACE_ERR("vconf key notify failed(VCONFKEY_SYSMAN_USB_HOST_STATUS)"); } - if (vconf_notify_key_changed(VCONFKEY_INTERNAL_REMOVED_USB_STORAGE, (void *)__usb_storage_cb, NULL) < 0) { - PRT_TRACE_ERR("Vconf notify key chaneged failed: KEY(%s)", VCONFKEY_SYSMAN_REMOVED_USB_STORAGE); } /* set initial state for devices */ input_device_number = 0; keyboard_chgdet_cb(NULL); hdmi_chgdet_cb(NULL); + system(STORE_DEFAULT_USB_INFO); return 0; } diff --git a/ss_main.c b/ss_main.c index 373514f..034cc52 100644 --- a/ss_main.c +++ b/ss_main.c @@ -82,7 +82,6 @@ static void system_server_init(struct ss_main_data *ad) ss_device_change_init(ad); ss_mmc_init(); ss_bs_init(); - _ss_usb_storage_init(); } #define SS_PIDFILE_PATH "/var/run/.system_server.pid" diff --git a/ss_usb_storage_handler.c b/ss_usb_storage_handler.c deleted file mode 100644 index 31f9468..0000000 --- a/ss_usb_storage_handler.c +++ /dev/null @@ -1,269 +0,0 @@ -/* - * Copyright 2012 Samsung Electronics Co., Ltd - * - * Licensed under the Flora License, Version 1.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.tizenopensource.org/license - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "ss_device_handler.h" -#include "ss_log.h" - -#define BUF_MAX 512 - -#define FS_TYPE_CHECKER "/sbin/fs-type-checker" -#define TEMP_FILE "/tmp/mountd.tmp" -#define MTAB_FILE "/etc/mtab" -#define MOUNT_POINT "/opt/storage/usb" - -static int added_noti_value = 0; -static int removed_noti_value = 0; -static int tempfs_mounted = 0; - -static int __ss_mount_device(char *dev) -{ - if (access(dev, F_OK) != 0) { - PRT_TRACE_ERR("Failed to find device: DEVICE(%s)", dev); - return -1; - } - - int fd = -1; - int r = -1; - char *rel_mnt_point; - char buf_mnt_point[BUF_MAX]; - - rel_mnt_point = strrchr(dev, '/'); - if (rel_mnt_point == NULL) { - PRT_TRACE_ERR("Get Relative Mount Path Failed"); - return -1; - } - - snprintf(buf_mnt_point, BUF_MAX, "%s%s", MOUNT_POINT, rel_mnt_point); - - /* Make directory to mount */ - r = mkdir(buf_mnt_point, 0755); - if (r < 0) { - if (errno == EEXIST) { - PRT_TRACE("Directory is already exsited: PATH(%s)", buf_mnt_point); - } else { - PRT_TRACE_ERR("Make Directory Failed: PATH(%s)", buf_mnt_point); - return -1; - } - } - - /* Mount block device on mount point */ - r = mount(dev, buf_mnt_point, "vfat", 0, "uid=0,gid=0,dmask=0000,fmask=0111,iocharset=iso8859-1,utf8,shortname=mixed,smackfsroot=*,smackfsdef=*"); - if (r < 0) { - r = rmdir(buf_mnt_point); - PRT_TRACE_ERR("Mount failed: MOUNT PATH(%s", buf_mnt_point); - return -1; - } - PRT_TRACE("Mount Complete: MOUNT PATH(%s)", buf_mnt_point); - - return 0; -} - -static int __ss_unmount_device(char *mnt_point) -{ - if (access(mnt_point, F_OK) != 0) { - PRT_TRACE_ERR("Failed to find path: MOUNT PATH(%s)", mnt_point); - return -1; - } - - int ret = -1; - - /* Umount block device */ - ret = umount2(mnt_point, MNT_DETACH); - if (ret < 0) { - PRT_TRACE_ERR("Unmounting is unabled: MOUNT PATH(%s)", mnt_point); - ret = rmdir(mnt_point); - if (ret < 0) { - PRT_TRACE_ERR("Removing Directory is unabled: PATH(%s)", mnt_point); - } - return -1; - } - - bundle *b = NULL; - b = bundle_create(); - bundle_add(b, "_SYSPOPUP_CONTENT_", "otg_remove"); - ret = syspopup_launch("usbotg-syspopup", b); - if (ret < 0) { - PRT_TRACE_EM("popup lauch failed\n"); - } - bundle_free(b); - - /* Clean up unmounted directory */ - ret = rmdir(mnt_point); - if (ret < 0) { - PRT_TRACE_ERR("Removing Directory is unabled: PATH(%s)", mnt_point); - } - PRT_TRACE("Unmount/Remove Complete: MOUNT PATH(%s)", mnt_point); - - return 0; -} - -static int __ss_usb_storage_added(int argc, char *argv[]) -{ - if (argc != 1 || argv[0] == NULL) { - PRT_TRACE_ERR("Get Vconf Value Failed: KEY(%s)", VCONFKEY_SYSMAN_ADDED_USB_STORAGE); - return -1; - } - - int ret = -1; - int fd = -1; - int part_num = 0; - - char *buf_dev = argv[0]; - char buf_part_dev[BUF_MAX]; - char *disk_path; - char *mounted_check; - - char *rel_mnt_point; - char buf_mnt_point[BUF_MAX]; - - /* Check whether mount point directory is exist */ - if (access(MOUNT_POINT, F_OK) < 0) { - if (mkdir(MOUNT_POINT, 0755) < 0) { - PRT_TRACE_ERR("Make Mount Directory Failed: DIRECTORY(%s)", MOUNT_POINT); - return -1; - } - } - - /* Mount tmpfs for protecting user data */ - if (tempfs_mounted != 1) { - if (mount("tmpfs", MOUNT_POINT, "tmpfs", 0, "") < 0) { - if (errno != EBUSY) { - PRT_TRACE_ERR("Failed to mount USB Storage Mount Directory: DIRECTORY(%s)", MOUNT_POINT); - return -1; - } - } else { - /* Change permission to avoid to write user data on tmpfs */ - if (chmod(MOUNT_POINT, 0755) < 0) { - PRT_TRACE_ERR("Failed to change mode: DIRCTORY(%s)", MOUNT_POINT); - umount2(MOUNT_POINT, MNT_DETACH); - return -1; - } - tempfs_mounted = 1; - } - } - - rel_mnt_point = strrchr(buf_dev, '/'); - if (rel_mnt_point == NULL) { - PRT_TRACE_ERR("Get Relative Mount Path Failed"); - return -1; - } - snprintf(buf_mnt_point, BUF_MAX, "%s%s", MOUNT_POINT, rel_mnt_point); - - if (__ss_mount_device(buf_dev) < 0) { - PRT_TRACE_ERR("Failed to mount %d", buf_dev); - } - - FILE *file = setmntent(MTAB_FILE, "r"); - struct mntent *mnt_entry; - - /* Check whether block deivce is mounted */ - while (mnt_entry = getmntent(file)) { - mounted_check = strstr(mnt_entry->mnt_fsname, buf_dev); - if (mounted_check != NULL) { - if (added_noti_value < INT_MAX) { - ++added_noti_value; - } else { - added_noti_value = 1; - } - /* Broadcast mounting notification */ - if (vconf_set_int(VCONFKEY_SYSMAN_ADDED_USB_STORAGE, added_noti_value) < 0) { - PRT_TRACE_ERR("Setting vconf value is failed: KEY(%s)", VCONFKEY_SYSMAN_ADDED_USB_STORAGE); - vconf_set_int(VCONFKEY_SYSMAN_ADDED_USB_STORAGE, -1); - } - - PRT_TRACE("Setting vconf value: KEY(%s) DEVICE(%s)", VCONFKEY_SYSMAN_ADDED_USB_STORAGE, buf_dev); - fclose(file); - - bundle *b = NULL; - b = bundle_create(); - bundle_add(b, "_SYSPOPUP_CONTENT_", "otg_add"); - bundle_add(b, "path", buf_mnt_point); - ret = syspopup_launch("usbotg-syspopup", b); - if (ret < 0) { - PRT_TRACE_EM("popup lauch failed\n"); - } - bundle_free(b); - - return 0; - } - } - - /* Failed to mount storage device */ - PRT_TRACE_ERR("Nothing to be mounted: DEVICE(%s)", buf_dev); - fclose(file); - return -1; -} - -static int __ss_usb_storage_removed(int argc, char *argv[]) -{ - if (argc != 1 || argv[0] == NULL) { - PRT_TRACE_ERR("Get Vonf Value Failed: KEY(%s)", VCONFKEY_SYSMAN_REMOVED_USB_STORAGE); - return -1; - } - - int fd = -1; - int part_num = 0; - - char *buf_dev_name = argv[0]; - char buf_mnt_point[BUF_MAX]; - char *mounted_check; - - snprintf(buf_mnt_point, BUF_MAX, "%s/%s", MOUNT_POINT, buf_dev_name); - - if (__ss_unmount_device(buf_mnt_point) == 0) { - if(umount2(MOUNT_POINT, MNT_DETACH) == 0) - tempfs_mounted = 1; - - if (removed_noti_value < INT_MAX) { - ++removed_noti_value; - } else { - removed_noti_value = 1; - } - if (vconf_set_int(VCONFKEY_SYSMAN_REMOVED_USB_STORAGE, removed_noti_value) < 0) { - PRT_TRACE_ERR("Setting vconf value is failed: KEY(%s)", VCONFKEY_SYSMAN_REMOVED_USB_STORAGE); - vconf_set_int(VCONFKEY_SYSMAN_ADDED_USB_STORAGE, -1); - } - - PRT_TRACE("Setting vconf value: KEY(%s) DEVICE(%s)", VCONFKEY_SYSMAN_REMOVED_USB_STORAGE, buf_dev_name); - return 0; - } - - PRT_TRACE("Usb storage removed fail"); - return 0; -} - -int _ss_usb_storage_init() -{ - ss_action_entry_add_internal(PREDEF_USB_STORAGE_ADD, __ss_usb_storage_added, NULL, NULL); - ss_action_entry_add_internal(PREDEF_USB_STORAGE_REMOVE, __ss_usb_storage_removed, NULL, NULL); - - return 0; -} - diff --git a/udev-rules/91-system-server.rules.in b/udev-rules/91-system-server.rules.in index 44a9779..a255097 100644 --- a/udev-rules/91-system-server.rules.in +++ b/udev-rules/91-system-server.rules.in @@ -16,14 +16,14 @@ ACTION=="change" DEVPATH=="/devices/platform/jack", ENV{CHGDET}=="cdrom" RUN+="@ ACTION=="change" DEVPATH=="/devices/platform/jack", ENV{CHGDET}=="keyboard" RUN+="@PREFIX@/bin/sys_event device_keyboard_chgdet" #USB Host Device +ACTION=="add", SUBSYSTEM=="usb_device", RUN+="/usr/bin/sys_event device_usb_host_add" +ACTION=="remove", SUBSYSTEM=="usb_device", RUN+="/usr/bin/sys_event device_usb_host_remove" ACTION=="change", SUBSYSTEM=="host_notify", ENV{STATE}=="ADD", RUN+="@PREFIX@/bin/vconftool set -t int memory/sysman/usbhost_status 1 -f" ACTION=="change", SUBSYSTEM=="host_notify", ENV{STATE}=="REMOVE", RUN+="@PREFIX@/bin/vconftool set -t int memory/sysman/usbhost_status 0 -f" ACTION=="change", SUBSYSTEM=="host_notify", ENV{STATE}=="OVERCURRENT", RUN+="@PREFIX@/bin/vconftool set -t int memory/sysman/usbhost_status 2 -f" #USB Storage -ACTION=="add", KERNEL=="sd[a-z]", SUBSYSTEM=="block", RUN+="@PREFIX@/bin/vconftool set -t string memory/private/sysman/added_storage_uevent %N -f" ACTION=="add", KERNEL=="sd[a-z][0-9]", SUBSYSTEM=="block", RUN+="@PREFIX@/bin/vconftool set -t string memory/private/sysman/added_storage_uevent %N -f" -ACTION=="remove", KERNEL=="sd[a-z]", SUBSYSTEM=="block", RUN+="@PREFIX@/bin/vconftool set -t string memory/private/sysman/removed_storage_uevent $name -f" ACTION=="remove", KERNEL=="sd[a-z][0-9]", SUBSYSTEM=="block", RUN+="@PREFIX@/bin/vconftool set -t string memory/private/sysman/removed_storage_uevent $name -f" #charge @@ -35,5 +35,3 @@ ACTION=="add" SUBSYSTEM=="input" DEVPATH=="*/input[1-9]*/event[1-9]*" ENV{ID_B ACTION=="remove" SUBSYSTEM=="input" DEVPATH=="*/input[1-9]*/event[1-9]*" ENV{ID_BUS}=="usb" ENV{ID_INPUT_KEYBOARD}=="?*" RUN+="/usr/bin/sys_event device_keyboard_remove" ACTION=="add" SUBSYSTEM=="input" DEVPATH=="*/input[1-9]*/event[1-9]*" ENV{ID_BUS}=="usb" ENV{ID_INPUT_MOUSE}=="?*" RUN+="/usr/bin/sys_event device_mouse_add" ACTION=="remove" SUBSYSTEM=="input" DEVPATH=="*/input[1-9]*/event[1-9]*" ENV{ID_BUS}=="usb" ENV{ID_INPUT_MOUSE}=="?*" RUN+="/usr/bin/sys_event device_mouse_remove" -ACTION=="add" SUBSYSTEM=="input" DEVPATH=="*/input[1-9]*/event[1-9]*" ENV{ID_BUS}=="usb" ENV{ID_INPUT_KEYBOARD}!="?*" ENV{ID_INPUT_MOUSE}!="?*" RUN+="/usr/bin/sys_event device_unknown_usb_add" -ACTION=="remove" SUBSYSTEM=="input" DEVPATH=="*/input[1-9]*/event[1-9]*" ENV{ID_BUS}=="usb" ENV{ID_INPUT_KEYBOARD}!="?*" ENV{ID_INPUT_MOUSE}!="?*" RUN+="/usr/bin/sys_event device_unknown_usb_remove" -- 2.7.4