diff options
Diffstat (limited to 'drivers/media/video/usbvision/usbvision-video.c')
-rw-r--r-- | drivers/media/video/usbvision/usbvision-video.c | 40 |
1 files changed, 14 insertions, 26 deletions
diff --git a/drivers/media/video/usbvision/usbvision-video.c b/drivers/media/video/usbvision/usbvision-video.c index b6fabeeb8ab..6a61ebcdf13 100644 --- a/drivers/media/video/usbvision/usbvision-video.c +++ b/drivers/media/video/usbvision/usbvision-video.c | |||
@@ -520,25 +520,6 @@ static int usbvision_v4l2_do_ioctl(struct inode *inode, struct file *file, | |||
520 | #ifdef CONFIG_VIDEO_ADV_DEBUG | 520 | #ifdef CONFIG_VIDEO_ADV_DEBUG |
521 | /* ioctls to allow direct acces to the NT100x registers */ | 521 | /* ioctls to allow direct acces to the NT100x registers */ |
522 | case VIDIOC_DBG_G_REGISTER: | 522 | case VIDIOC_DBG_G_REGISTER: |
523 | { | ||
524 | struct v4l2_register *reg = arg; | ||
525 | int errCode; | ||
526 | |||
527 | if (reg->i2c_id != 0) | ||
528 | return -EINVAL; | ||
529 | /* NT100x has a 8-bit register space */ | ||
530 | errCode = usbvision_read_reg(usbvision, reg->reg&0xff); | ||
531 | if (errCode < 0) { | ||
532 | err("%s: VIDIOC_DBG_G_REGISTER failed: error %d", __FUNCTION__, errCode); | ||
533 | } | ||
534 | else { | ||
535 | reg->val=(unsigned char)errCode; | ||
536 | PDEBUG(DBG_IOCTL, "VIDIOC_DBG_G_REGISTER reg=0x%02X, value=0x%02X", | ||
537 | (unsigned int)reg->reg, reg->val); | ||
538 | errCode = 0; // No error | ||
539 | } | ||
540 | return errCode; | ||
541 | } | ||
542 | case VIDIOC_DBG_S_REGISTER: | 523 | case VIDIOC_DBG_S_REGISTER: |
543 | { | 524 | { |
544 | struct v4l2_register *reg = arg; | 525 | struct v4l2_register *reg = arg; |
@@ -548,15 +529,22 @@ static int usbvision_v4l2_do_ioctl(struct inode *inode, struct file *file, | |||
548 | return -EINVAL; | 529 | return -EINVAL; |
549 | if (!capable(CAP_SYS_ADMIN)) | 530 | if (!capable(CAP_SYS_ADMIN)) |
550 | return -EPERM; | 531 | return -EPERM; |
551 | errCode = usbvision_write_reg(usbvision, reg->reg&0xff, reg->val); | 532 | /* NT100x has a 8-bit register space */ |
533 | if (cmd == VIDIOC_DBG_G_REGISTER) | ||
534 | errCode = usbvision_read_reg(usbvision, reg->reg&0xff); | ||
535 | else | ||
536 | errCode = usbvision_write_reg(usbvision, reg->reg&0xff, reg->val); | ||
552 | if (errCode < 0) { | 537 | if (errCode < 0) { |
553 | err("%s: VIDIOC_DBG_S_REGISTER failed: error %d", __FUNCTION__, errCode); | 538 | err("%s: VIDIOC_DBG_%c_REGISTER failed: error %d", __FUNCTION__, |
554 | } | 539 | cmd == VIDIOC_DBG_G_REGISTER ? 'G' : 'S', errCode); |
555 | else { | 540 | return errCode; |
556 | PDEBUG(DBG_IOCTL, "VIDIOC_DBG_S_REGISTER reg=0x%02X, value=0x%02X", | ||
557 | (unsigned int)reg->reg, reg->val); | ||
558 | errCode = 0; | ||
559 | } | 541 | } |
542 | if (cmd == VIDIOC_DBG_S_REGISTER) | ||
543 | reg->val = (u8)errCode; | ||
544 | |||
545 | PDEBUG(DBG_IOCTL, "VIDIOC_DBG_%c_REGISTER reg=0x%02X, value=0x%02X", | ||
546 | cmd == VIDIOC_DBG_G_REGISTER ? 'G' : 'S', | ||
547 | (unsigned int)reg->reg, reg->val); | ||
560 | return 0; | 548 | return 0; |
561 | } | 549 | } |
562 | #endif | 550 | #endif |