ENDIF()
ADD_DEFINITIONS("-DDEBUG -DENABLE_DLOG_OUT")
-SET(UDEV_RULES_PATH share/system-server/udev-rules)
-SET(UDEV_RULES udev-rules/91-system-server.rules)
-CONFIGURE_FILE(${UDEV_RULES}.in ${UDEV_RULES} @ONLY)
CONFIGURE_FILE(device-daemon.in device-daemon @ONLY)
# libdeviced
INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin)
INSTALL(FILES ${MOVINAND_FORMAT} DESTINATION bin)
-INSTALL(FILES ${UDEV_RULES} DESTINATION ${UDEV_RULES_PATH})
INSTALL(PROGRAMS ${CMAKE_BINARY_DIR}/device-daemon DESTINATION bin)
INSTALL(FILES system-server.conf DESTINATION /etc/dbus-1/system.d)
INSTALL(FILES ${CMAKE_SOURCE_DIR}/packaging/system-server.rule DESTINATION /opt/etc/smack/accesses.d)
heynotitool set device_keyboard_chgdet
-mkdir -p /etc/udev/rules.d
-if ! [ -L /etc/udev/rules.d/91-system-server.rules ]; then
- ln -s %{_datadir}/system-server/udev-rules/91-system-server.rules /etc/udev/rules.d/91-system-server.rules
-fi
-
systemctl daemon-reload
if [ $1 == 1 ]; then
systemctl restart system-server.service
%{_libdir}/systemd/system/regpmon.service
%{_libdir}/systemd/system/graphical.target.wants/zbooting-done.service
%{_libdir}/systemd/system/zbooting-done.service
-%{_datadir}/system-server/udev-rules/91-system-server.rules
%{_datadir}/system-server/sys_pci_noti/res/locale/*/LC_MESSAGES/*.mo
%config %{_sysconfdir}/dbus-1/system.d/system-server.conf
#include "sys_pci_noti/sys_pci_noti.h"
#include "udev.h"
#include "common.h"
+#include "proc/proc-handler.h"
#define PREDEF_USBCON "usbcon"
#define PREDEF_EARJACKCON "earjack_predef_internal"
/* input device */
#define INPUT_SUBSYSTEM "input"
-#define INPUT_PATH "*/input[0-9]*/event[0-9]*"
+#define INPUT_PATH "*/input[0-9]*/event[0-9]*"
#define ADD "add"
#define REMOVE "remove"
/* switch device */
#define SWITCH_SUBSYSTEM "switch"
+
+/* block device */
+#define BLOCK_SUBSYSTEM "block"
+#define MMC_PATH "*/mmcblk[0-9]"
+
+/* host device */
+#define HOST_SUBSYSTEM "host_notify"
+
#endif /* __UDEV_H__ */
{
FILE *pf;
long file_size;
- unsigned char *pdata;
+ unsigned char *pdata = NULL;
if (!file_name)
return NULL;
return NULL;
}
- if (fseek(pf, 0, SEEK_END)) {
- _E("fseek failed : %s", strerror(errno));
- fclose(pf);
- return NULL;
- }
+ if (fseek(pf, 0, SEEK_END))
+ goto error;
file_size = ftell(pf);
- if (fseek(pf, 0, SEEK_SET)) {
- _E("fseek failed : %s", strerror(errno));
- fclose(pf);
- return NULL;
- }
+ if (fseek(pf, 0, SEEK_SET))
+ goto error;
+
+ if (file_size < 0)
+ goto error;
pdata = (unsigned char*)malloc(file_size);
- if (!pdata) {
- fclose(pf);
- return NULL;
- }
+ if (!pdata)
+ goto error;
- if (fread(pdata, 1, file_size, pf) != file_size) {
- _E("fread failed : %s", strerror(errno));
- free(pdata);
- fclose(pf);
- return NULL;
- }
+ if (fread(pdata, 1, file_size, pf) != file_size)
+ goto err_free;
fclose(pf);
*size = file_size;
return pdata;
+
+err_free:
+ free(pdata);
+
+error:
+ fclose(pf);
+
+ _E("failed to convert file to buffer (%s)", strerror(errno));
+ return NULL;
}
static int save_data(const unsigned char *data, int size, const char *file_path)
+++ /dev/null
-#MMC
-ACTION=="add", KERNEL=="mmcblk[0-9]", SUBSYSTEM=="block", RUN+="@PREFIX@/bin/sys_event mmcblk_add"
-ACTION=="remove", KERNEL=="mmcblk[0-9]", SUBSYSTEM=="block", RUN+="@PREFIX@/bin/sys_event mmcblk_remove"
-
-#Process Monitor
-#ACTION=="change" SUBSYSTEM=="pmon", RUN+="@PREFIX@/bin/restart"
-
-#Jack
-ACTION=="change" DEVPATH=="/devices/platform/jack", ENV{CHGDET}=="cdrom" RUN+="@PREFIX@/bin/start_composite.sh"
-
-#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][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][0-9]", SUBSYSTEM=="block", RUN+="@PREFIX@/bin/vconftool set -t string memory/private/sysman/removed_storage_uevent $name -f"
-
-#charge
-ACTION=="change" DEVPATH=="/devices/platform/samsung-battery/power_supply/battery" RUN+="/usr/bin/sys_event device_charge_chgdet"
-ACTION=="change" DEVPATH=="/devices/platform/charger-manager.0" RUN+="@PREFIX@/bin/sys_event device_charge_chgdet"
-ACTION=="change" DEVPATH=="/devices/virtual/power_supply/battery" RUN+="/usr/bin/sys_event device_charge_chgdet"
-ACTION=="change" DEVPATH=="/devices/platform/sec-battery/power_supply/battery" RUN+="/usr/bin/sys_event device_charge_chgdet"
-
-#USB Keyboard
-ACTION=="add" SUBSYSTEM=="input" DEVPATH=="*/input[1-9]*/event[1-9]*" ENV{ID_BUS}=="usb" ENV{ID_INPUT_KEYBOARD}=="?*" RUN+="/usr/bin/sys_event device_keyboard_add"
-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"
-
-#PCI keyboard
-ACTION=="add" SUBSYSTEM=="input" DEVPATH=="*/virtio[1-9]*/input/input[1-9]*/event[1-9]*" ENV{ID_PATH}=="*virtio-pci*" ENV{ID_INPUT_KEYBOARD}=="?*" RUN+="/usr/bin/sys_event device_pci_keyboard_add"
-ACTION=="remove" SUBSYSTEM=="input" DEVPATH=="*/virtio[1-9]*/input/input[1-9]*/event[1-9]*" ENV{ID_PATH}=="*virtio-pci*" ENV{ID_INPUT_KEYBOARD}=="?*" RUN+="/usr/bin/sys_event device_pci_keyboard_remove"
-
-#Smart debug bridge
-ACTION=="add", KERNEL=="samsung_sdb", SYMLINK+="tizen_sdb"
-
-# Since power_manager is running as app user, make sure this user can read the input device nodes
-SUBSYSTEM=="input" DEVPATH=="*/input[0-9]*/event[0-9]*" GROUP="video"