4 * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
6 * Licensed under the Apache License, Version 2.0 (the License);
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
19 #ifndef __USB_CLIENT_H__
20 #define __USB_CLIENT_H__
23 #include <device-node.h>
26 #include "core/devices.h"
27 #include "display/poll.h"
28 #include "core/udev.h"
29 #include "core/common.h"
30 #include "core/list.h"
31 #include "apps/apps.h"
32 #include "usb-common.h"
35 #define UDEV_PROP_KEY_SWITCH_NAME "SWITCH_NAME"
36 #define UDEV_PROP_VALUE_USB_CABLE "usb_cable"
38 #define UDEV_PROP_KEY_SWITCH_STATE "SWITCH_STATE"
39 #define UDEV_PROP_VALUE_DISCON "0"
40 #define UDEV_PROP_VALUE_CON "1"
43 #define USBMODE_SUBSYSTEM "usb_mode"
44 #define UDEV_PROP_KEY_USB_STATE "USB_STATE"
45 #define UDEV_PROP_VALUE_CONFIGURED "CONFIGURED"
48 #define UDEV_PROP_KEY_CHGDET "CHGDET"
49 #define UDEV_PROP_VALUE_USB "usb"
51 #define USB_CON_SET "set"
52 #define USB_CON_UNSET "unset"
54 #define USB_RESTRICT "restrict"
55 #define USB_ERROR "error"
59 enum usbclient_setting_option {
60 SET_CONFIGURATION = 0x0001,
61 SET_OPERATION = 0x0010,
62 SET_NOTIFICATION = 0x0100,
75 struct xmlConfiguration {
82 int make_empty_configuration_list(void);
83 int make_configuration_list(int usb_mode);
84 void release_configuration_list(void);
85 int make_supported_confs_list(void);
86 void release_supported_confs_list(void);
87 int make_operation_list(int usb_mode, char *action);
88 void release_operations_list(void);
90 int get_operations_list(dd_list **list);
91 int get_configurations_list(dd_list **list);
94 void client_mode_changed(keynode_t* key, void *data);
95 void prev_client_mode_changed(keynode_t* key, void *data);
96 void debug_mode_changed(keynode_t* key, void *data);
97 void tethering_status_changed(keynode_t* key, void *data);
100 int get_default_mode(void);
101 int check_current_usb_state(void);
102 int get_current_usb_mode(void);
103 int get_selected_usb_mode(void);
104 int get_debug_mode(void);
105 int change_selected_usb_mode(int mode);
106 int update_current_usb_mode(int mode);
107 int update_usb_state(int state);
110 void unset_client_mode(int mode, bool change);
113 int control_start(void);
114 int control_stop(void);
115 int control_status(void);
116 void wait_until_booting_done(void);
117 void usbclient_init_booting_done(void);
118 void act_usb_connected(void);
121 void launch_syspopup(char *str);
123 /* Change usb mode */
124 void change_client_setting(int options);
125 bool get_wait_configured(void);
127 #endif /* __USB_CLIENT_H__ */