OSDN Git Service

resolve merge conflicts of 1f433cb to mnc-dr-dev
[android-x86/system-bt.git] / btif / co / bta_hh_co.c
index bd6fd6f..9041397 100644 (file)
@@ -58,7 +58,7 @@ void uhid_set_non_blocking(int fd)
 /*Internal function to perform UHID write and error checking*/
 static int uhid_write(int fd, const struct uhid_event *ev)
 {
-    ssize_t ret = write(fd, ev, sizeof(*ev));
+    ssize_t ret = TEMP_FAILURE_RETRY(write(fd, ev, sizeof(*ev)));
 
     if (ret < 0){
         int rtn = -errno;
@@ -85,7 +85,7 @@ static int uhid_event(btif_hh_device_t *p_dev)
         APPL_TRACE_ERROR("%s: Device not found",__FUNCTION__)
         return -1;
     }
-    ret = read(p_dev->fd, &ev, sizeof(ev));
+    ret = TEMP_FAILURE_RETRY(read(p_dev->fd, &ev, sizeof(ev)));
     if (ret == 0) {
         APPL_TRACE_ERROR("%s: Read HUP on uhid-cdev %s", __FUNCTION__,
                                                  strerror(errno));
@@ -206,7 +206,7 @@ static void *btif_hh_poll_event_thread(void *arg)
     uhid_set_non_blocking(p_dev->fd);
 
     while(p_dev->hh_keep_polling){
-        ret = poll(pfds, 1, 50);
+        ret = TEMP_FAILURE_RETRY(poll(pfds, 1, 50));
         if (ret < 0) {
             APPL_TRACE_ERROR("%s: Cannot poll for fds: %s\n", __FUNCTION__, strerror(errno));
             break;
@@ -300,7 +300,7 @@ void bta_hh_co_open(UINT8 dev_handle, UINT8 sub_class, tBTA_HH_ATTR_MASK attr_ma
                                   __FUNCTION__, p_dev->attr_mask, p_dev->sub_class, p_dev->app_id);
 
             if(p_dev->fd<0) {
-                p_dev->fd = open(dev_path, O_RDWR | O_CLOEXEC);
+                p_dev->fd = TEMP_FAILURE_RETRY(open(dev_path, O_RDWR | O_CLOEXEC));
                 if (p_dev->fd < 0){
                     APPL_TRACE_ERROR("%s: Error: failed to open uhid, err:%s",
                                                                     __FUNCTION__,strerror(errno));
@@ -329,7 +329,7 @@ void bta_hh_co_open(UINT8 dev_handle, UINT8 sub_class, tBTA_HH_ATTR_MASK attr_ma
 
                 btif_hh_cb.device_num++;
                 // This is a new device,open the uhid driver now.
-                p_dev->fd = open(dev_path, O_RDWR | O_CLOEXEC);
+                p_dev->fd = TEMP_FAILURE_RETRY(open(dev_path, O_RDWR | O_CLOEXEC));
                 if (p_dev->fd < 0){
                     APPL_TRACE_ERROR("%s: Error: failed to open uhid, err:%s",
                                                                     __FUNCTION__,strerror(errno));