2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef __TIZEN_SYSTEM_USB_ACCESSORY_PRIVATE_H__
18 #define __TIZEN_SYSTEM_USB_ACCESSORY_PRIVATE_H__
26 #include <sys/types.h>
29 #include <sys/socket.h>
36 #include <sys/utsname.h>
39 #define ACC_ELEMENT_LEN 256
40 #define SOCK_PATH "/tmp/usb_server_sock"
41 #define ACC_SOCK_PATH "/tmp/usb_acc_sock"
42 #define USB_ACCESSORY_NODE "/dev/usb_accessory"
44 #define SOCK_STR_LEN 1542
46 #define USB_TAG "USB_ACCESSORY"
48 #define USB_LOG(format, args...) \
49 LOG(LOG_VERBOSE, USB_TAG, "[%s][Ln: %d] " format, \
50 (char*)(strrchr(__FILE__, '/')+1), __LINE__, ##args)
52 #define USB_LOG_ERROR(format, args...) \
53 LOG(LOG_ERROR, USB_TAG, "[%s][Ln: %d] " format, \
54 (char*)(strrchr(__FILE__, '/')+1), __LINE__, ##args)
56 #define __USB_FUNC_ENTER__ \
57 USB_LOG("Entering: %s()\n", __func__)
59 #define __USB_FUNC_EXIT__ \
60 USB_LOG("Exit: %s()\n", __func__)
70 #define um_retvm_if(expr, val, fmt, arg...) \
73 USB_LOG_ERROR(fmt, ##arg); \
78 #define um_retm_if(expr, fmt, arg...) \
81 USB_LOG_ERROR(fmt, ##arg); \
94 ERROR_POPUP_OK_BTN = 0,
98 LAUNCH_APP_FOR_ACC = 20,
101 REQ_ACC_PERM_NOTI_YES_BTN,
102 REQ_ACC_PERM_NOTI_NO_BTN,
104 } REQUEST_TO_USB_MANGER;
107 ACC_MANUFACTURER = 0,
115 struct usb_accessory_s {
118 char manufacturer[ACC_ELEMENT_LEN];
119 char model[ACC_ELEMENT_LEN];
120 char description[ACC_ELEMENT_LEN];
121 char version[ACC_ELEMENT_LEN];
122 char uri[ACC_ELEMENT_LEN];
123 char serial[ACC_ELEMENT_LEN];
126 struct usb_accessory_list {
127 struct usb_accessory_s *accessory;
128 struct usb_accessory_list *next;
133 void (*connection_cb_func)(struct usb_accessory_s *accessory, bool is_connected, void *data);
134 void (*request_perm_cb_func)(struct usb_accessory_s *accessory, bool is_granted);
135 struct usb_accessory_s *accessory;
138 int ipc_request_client_init(int *sock_remote);
139 int ipc_request_client_close(int *sock_remote);
140 int request_to_usb_server(int sock_remote, int request, char *answer, char *pkgName);
142 void accessory_status_changed_cb(keynode_t *in_key, void* data);
143 bool getAccList(struct usb_accessory_list **accList);
144 bool freeAccList(struct usb_accessory_list *accList);
145 int ipc_noti_client_init(void);
146 int ipc_noti_client_close(int *sock_remote);
147 gboolean ipc_noti_client_cb(GIOChannel *g_io_ch, GIOCondition condition, gpointer data);
149 #endif /* __TIZEN_SYSTEM_USB_ACCESSORY_PRIVATE_H__ */