static int input_device_connected(struct input_device *idev, struct input_conn *iconn) { dbus_bool_t connected; int err; if (iconn->intr_io == NULL || iconn->ctrl_io == NULL) return -ENOTCONN; err = hidp_add_connection(idev, iconn); if (err < 0) return err; iconn->intr_watch = g_io_add_watch(iconn->intr_io, G_IO_HUP | G_IO_ERR | G_IO_NVAL, intr_watch_cb, iconn); iconn->ctrl_watch = g_io_add_watch(iconn->ctrl_io, G_IO_HUP | G_IO_ERR | G_IO_NVAL, ctrl_watch_cb, iconn); connected = TRUE; emit_property_changed(idev->conn, idev->path, INPUT_DEVICE_INTERFACE, "Connected", DBUS_TYPE_BOOLEAN, &connected); idev->dc_id = device_add_disconnect_watch(idev->device, disconnect_cb, idev, NULL); return 0; }
static int input_device_connected(struct input_device *idev) { int err; if (idev->intr_io == NULL || idev->ctrl_io == NULL) return -ENOTCONN; err = hidp_add_connection(idev); if (err < 0) return err; btd_service_connecting_complete(idev->service, 0); return 0; }
static int hidp_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) { void __user *argp = (void __user *) arg; struct hidp_connadd_req ca; struct hidp_conndel_req cd; struct hidp_connlist_req cl; struct hidp_conninfo ci; struct socket *csock; struct socket *isock; int err; BT_DBG("cmd %x arg %lx", cmd, arg); switch (cmd) { case HIDPCONNADD: if (!capable(CAP_NET_ADMIN)) return -EACCES; if (copy_from_user(&ca, argp, sizeof(ca))) return -EFAULT; csock = sockfd_lookup(ca.ctrl_sock, &err); if (!csock) return err; isock = sockfd_lookup(ca.intr_sock, &err); if (!isock) { fput(csock->file); return err; } if (csock->sk->sk_state != BT_CONNECTED || isock->sk->sk_state != BT_CONNECTED) { fput(csock->file); fput(isock->file); return -EBADFD; } err = hidp_add_connection(&ca, csock, isock); if (!err) { if (copy_to_user(argp, &ca, sizeof(ca))) err = -EFAULT; } else { fput(csock->file); fput(isock->file); } return err; case HIDPCONNDEL: if (!capable(CAP_NET_ADMIN)) return -EACCES; if (copy_from_user(&cd, argp, sizeof(cd))) return -EFAULT; return hidp_del_connection(&cd); case HIDPGETCONNLIST: if (copy_from_user(&cl, argp, sizeof(cl))) return -EFAULT; if (cl.cnum <= 0) return -EINVAL; err = hidp_get_connlist(&cl); if (!err && copy_to_user(argp, &cl, sizeof(cl))) return -EFAULT; return err; case HIDPGETCONNINFO: if (copy_from_user(&ci, argp, sizeof(ci))) return -EFAULT; err = hidp_get_conninfo(&ci); if (!err && copy_to_user(argp, &ci, sizeof(ci))) return -EFAULT; return err; } return -EINVAL; }
sockfd_put(csock); return err; } <<<<<<< HEAD if (csock->sk->sk_state != BT_CONNECTED || isock->sk->sk_state != BT_CONNECTED) { ======= if (csock->sk->sk_state != BT_CONNECTED || isock->sk->sk_state != BT_CONNECTED) { >>>>>>> 296c66da8a02d52243f45b80521febece5ed498a sockfd_put(csock); sockfd_put(isock); return -EBADFD; } err = hidp_add_connection(&ca, csock, isock); if (!err) { if (copy_to_user(argp, &ca, sizeof(ca))) err = -EFAULT; } else { sockfd_put(csock); sockfd_put(isock); } return err; case HIDPCONNDEL: if (!capable(CAP_NET_ADMIN)) return -EACCES; if (copy_from_user(&cd, argp, sizeof(cd)))