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__
25 #include <sys/types.h>
28 #include <sys/socket.h>
38 #define ACC_ELEMENT_LEN 256
39 #define SOCK_PATH "/tmp/usb_server_sock"
40 #define ACC_SOCK_PATH "/tmp/usb_acc_sock"
41 #define USB_ACCESSORY_NODE "/dev/usb_accessory"
43 #define SOCK_STR_LEN 1542
45 #define USB_TAG "USB_ACCESSORY"
47 #define USB_LOG(format, args...) \
48 LOG(LOG_VERBOSE, USB_TAG, "[%s][Ln: %d] " format, \
49 (char*)(strrchr(__FILE__, '/')+1), __LINE__, ##args)
51 #define USB_LOG_ERROR(format, args...) \
52 LOG(LOG_ERROR, USB_TAG, "[%s][Ln: %d] " format, \
53 (char*)(strrchr(__FILE__, '/')+1), __LINE__, ##args)
55 #define __USB_FUNC_ENTER__ \
56 USB_LOG("Entering: %s()\n", __func__)
58 #define __USB_FUNC_EXIT__ \
59 USB_LOG("Exit: %s()\n", __func__)
69 #define um_retvm_if(expr, val, fmt, arg...) \
72 USB_LOG_ERROR(fmt, ##arg); \
77 #define um_retm_if(expr, fmt, arg...) \
80 USB_LOG_ERROR(fmt, ##arg); \
95 REQ_PERM_NOTI_YES_BTN,
99 KIESWIFI_POPUP_YES_BTN,
100 KIESWIFI_POPUP_NO_BTN
101 } REQUEST_TO_USB_MANGER;
104 ACC_MANUFACTURER = 0,
112 struct usb_accessory_s {
115 char manufacturer[ACC_ELEMENT_LEN];
116 char model[ACC_ELEMENT_LEN];
117 char description[ACC_ELEMENT_LEN];
118 char version[ACC_ELEMENT_LEN];
119 char uri[ACC_ELEMENT_LEN];
120 char serial[ACC_ELEMENT_LEN];
123 struct usb_accessory_list {
124 struct usb_accessory_s *accessory;
125 struct usb_accessory_list *next;
130 void (*connection_cb_func)(struct usb_accessory_s *accessory, bool is_connected, void *data);
131 void (*request_perm_cb_func)(struct usb_accessory_s *accessory, bool is_granted);
132 struct usb_accessory_s *accessory;
135 int ipc_request_client_init(int *sock_remote);
136 int ipc_request_client_close(int *sock_remote);
137 int request_to_usb_server(int sock_remote, int request, char *answer, char *pkgName);
139 void accessory_status_changed_cb(keynode_t *in_key, void* data);
140 bool getAccList(struct usb_accessory_list **accList);
141 bool freeAccList(struct usb_accessory_list *accList);
142 int ipc_noti_client_init(void);
143 int ipc_noti_client_close(int *sock_remote);
144 gboolean ipc_noti_client_cb(GIOChannel *g_io_ch, GIOCondition condition, gpointer data);
145 #endif /* __TIZEN_SYSTEM_USB_ACCESSORY_PRIVATE_H__ */