]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
Merge branch 'for-5.6/hidraw' into for-linus
authorJiri Kosina <jkosina@suse.cz>
Mon, 27 Jan 2020 14:49:30 +0000 (15:49 +0100)
committerJiri Kosina <jkosina@suse.cz>
Mon, 27 Jan 2020 14:49:30 +0000 (15:49 +0100)
- support for uniq ioctl()

1  2 
drivers/hid/hidraw.c

diff --combined drivers/hid/hidraw.c
index 7a75aff78388289f0ac4164b2acb25b96ed78dd5,5dfe802089326be314bdb4868b3d1a06cc05ccf7..2eee5e31c2b7eaf3bb9618aaac7862e82e276cd4
@@@ -249,14 -249,13 +249,14 @@@ out
  static __poll_t hidraw_poll(struct file *file, poll_table *wait)
  {
        struct hidraw_list *list = file->private_data;
 +      __poll_t mask = EPOLLOUT | EPOLLWRNORM; /* hidraw is always writable */
  
        poll_wait(file, &list->hidraw->wait, wait);
        if (list->head != list->tail)
 -              return EPOLLIN | EPOLLRDNORM | EPOLLOUT;
 +              mask |= EPOLLIN | EPOLLRDNORM;
        if (!list->hidraw->exist)
 -              return EPOLLERR | EPOLLHUP;
 -      return 0;
 +              mask |= EPOLLERR | EPOLLHUP;
 +      return mask;
  }
  
  static int hidraw_open(struct inode *inode, struct file *file)
@@@ -451,6 -450,15 +451,15 @@@ static long hidraw_ioctl(struct file *f
                                                -EFAULT : len;
                                        break;
                                }
+                               if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGRAWUNIQ(0))) {
+                                       int len = strlen(hid->uniq) + 1;
+                                       if (len > _IOC_SIZE(cmd))
+                                               len = _IOC_SIZE(cmd);
+                                       ret = copy_to_user(user_arg, hid->uniq, len) ?
+                                               -EFAULT : len;
+                                       break;
+                               }
                        }
  
                ret = -ENOTTY;