Skip to content

Conversation

johnebgood
Copy link

The OBSBOT Tiny cameras are misreporting their minimum relative pan, tilt and zoom speed settings. This makes controlling the cameras with an analog stick or changing the speed of transit for presets not possible. I'm looking for guidance on creating a proper control mapping override or any feedback on what I have implemented; it works. Opening this draft pull request for feedback and to provide visibility to the vendor to fix their firmware.

@ribalda, I looked through some of the control mapping code you have authored, do you have any thoughts on a fix until the vendor (maybe) resolves this?

Before the patch:
zoom_continuous 0x009a090f (int)    : min=0 max=100 step=1 default=100 value=240
pan_speed 0x009a0920 (int)          : min=-1 max=160 step=1 default=20 value=0
tilt_speed 0x009a0921 (int)         : min=-1 max=120 step=1 default=20 value=0

After the patch:
zoom_continuous 0x009a090f (int)    : min=-100 max=100 step=1 default=100 value=240
pan_speed 0x009a0920 (int)          : min=-160 max=160 step=1 default=20 value=0
tilt_speed 0x009a0921 (int)         : min=-120 max=120 step=1 default=20 value=0

@ribalda
Copy link
Contributor

ribalda commented Mar 21, 2024

Hi John

Most of the discussion for linux-media is done in this mailing list: https://lore.kernel.org/linux-media/ Could you share this message there?

There is a mechanism that allows overriding a control for a specific device. You probably want to use it. Take a look at this: https://git.linuxtv.org/media_tree.git/tree/drivers/media/usb/uvc/uvc_driver.c?h=master#n2603

Could you share the "lsusb -v " info of your device, and also what
are the raw values from the device for UVC_GET_MAX, UVC_GET_MIN for
UVC_CT_PANTILT_RELATIVE_CONTROL and UVC_CT_ZOOM_RELATIVE_CONTROL ?

Something like this (not tested :) ):

diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c
index e59a463c27618..76c7adc3aa579 100644
--- a/drivers/media/usb/uvc/uvc_ctrl.c
+++ b/drivers/media/usb/uvc/uvc_ctrl.c
@@ -415,7 +415,11 @@ static s32 uvc_ctrl_get_zoom(struct
uvc_control_mapping *mapping,
                return (zoom == 0) ? 0 : (zoom > 0 ? data[2] : -data[2]);

        case UVC_GET_MIN:
+               printk(KERN_ERR "zoom: GET_MIN 0%x 0x%x 0%x\n",
data[0], data[1], data[2]);
+               return data[2];
        case UVC_GET_MAX:
+               printk(KERN_ERR "zoom: GET_MAX 0%x 0x%x 0%x\n",
data[0], data[1], data[2]);
+               fallthrough;
        case UVC_GET_RES:
        case UVC_GET_DEF:
        default:
@@ -441,8 +445,11 @@ static s32 uvc_ctrl_get_rel_speed(struct
uvc_control_mapping *mapping,
                return (rel == 0) ? 0 : (rel > 0 ? data[first+1]
                                                 : -data[first+1]);
        case UVC_GET_MIN:
+               printk(KERN_ERR "speed: GET_MIN 0%x 0x%x 0%x\n",
data[first], data[first+1], data[first+2]);
                return -data[first+1];
        case UVC_GET_MAX:
+               printk(KERN_ERR "speed: GET_MAX 0%x 0x%x 0%x\n",
data[first], data[first+1], data[first+2]);
+               fallthrough;
        case UVC_GET_RES:
        case UVC_GET_DEF:
        default:

Thanks!

intel-lab-lkp pushed a commit to intel-lab-lkp/linux that referenced this pull request Apr 10, 2025
…arations)

Fix checkpatch code style warnings:

  WARNING: Missing a blank line after declarations
  torvalds#761: FILE: net/core/pktgen.c:761:
  +               char c;
  +               if (get_user(c, &user_buffer[i]))

  WARNING: Missing a blank line after declarations
  torvalds#780: FILE: net/core/pktgen.c:780:
  +               char c;
  +               if (get_user(c, &user_buffer[i]))

  WARNING: Missing a blank line after declarations
  torvalds#806: FILE: net/core/pktgen.c:806:
  +               char c;
  +               if (get_user(c, &user_buffer[i]))

  WARNING: Missing a blank line after declarations
  torvalds#823: FILE: net/core/pktgen.c:823:
  +               char c;
  +               if (get_user(c, &user_buffer[i]))

  WARNING: Missing a blank line after declarations
  #1968: FILE: net/core/pktgen.c:1968:
  +               char f[32];
  +               memset(f, 0, 32);

  WARNING: Missing a blank line after declarations
  #2410: FILE: net/core/pktgen.c:2410:
  +       struct pktgen_net *pn = net_generic(dev_net(pkt_dev->odev), pg_net_id);
  +       if (!x) {

  WARNING: Missing a blank line after declarations
  #2442: FILE: net/core/pktgen.c:2442:
  +               __u16 t;
  +               if (pkt_dev->flags & F_QUEUE_MAP_RND) {

  WARNING: Missing a blank line after declarations
  #2523: FILE: net/core/pktgen.c:2523:
  +               unsigned int i;
  +               for (i = 0; i < pkt_dev->nr_labels; i++)

  WARNING: Missing a blank line after declarations
  #2567: FILE: net/core/pktgen.c:2567:
  +                       __u32 t;
  +                       if (pkt_dev->flags & F_IPSRC_RND)

  WARNING: Missing a blank line after declarations
  #2587: FILE: net/core/pktgen.c:2587:
  +                               __be32 s;
  +                               if (pkt_dev->flags & F_IPDST_RND) {

  WARNING: Missing a blank line after declarations
  #2634: FILE: net/core/pktgen.c:2634:
  +               __u32 t;
  +               if (pkt_dev->flags & F_TXSIZE_RND) {

  WARNING: Missing a blank line after declarations
  #2736: FILE: net/core/pktgen.c:2736:
  +               int i;
  +               for (i = 0; i < pkt_dev->cflows; i++) {

  WARNING: Missing a blank line after declarations
  #2738: FILE: net/core/pktgen.c:2738:
  +                       struct xfrm_state *x = pkt_dev->flows[i].x;
  +                       if (x) {

  WARNING: Missing a blank line after declarations
  #2752: FILE: net/core/pktgen.c:2752:
  +               int nhead = 0;
  +               if (x) {

  WARNING: Missing a blank line after declarations
  #2795: FILE: net/core/pktgen.c:2795:
  +       unsigned int i;
  +       for (i = 0; i < pkt_dev->nr_labels; i++)

  WARNING: Missing a blank line after declarations
  #3480: FILE: net/core/pktgen.c:3480:
  +       ktime_t idle_start = ktime_get();
  +       schedule();

Signed-off-by: Peter Seiderer <ps.report@gmx.net>
kuba-moo pushed a commit to linux-netdev/testing that referenced this pull request Apr 15, 2025
…arations)

Fix checkpatch code style warnings:

  WARNING: Missing a blank line after declarations
  torvalds#761: FILE: net/core/pktgen.c:761:
  +               char c;
  +               if (get_user(c, &user_buffer[i]))

  WARNING: Missing a blank line after declarations
  torvalds#780: FILE: net/core/pktgen.c:780:
  +               char c;
  +               if (get_user(c, &user_buffer[i]))

  WARNING: Missing a blank line after declarations
  torvalds#806: FILE: net/core/pktgen.c:806:
  +               char c;
  +               if (get_user(c, &user_buffer[i]))

  WARNING: Missing a blank line after declarations
  torvalds#823: FILE: net/core/pktgen.c:823:
  +               char c;
  +               if (get_user(c, &user_buffer[i]))

  WARNING: Missing a blank line after declarations
  #1968: FILE: net/core/pktgen.c:1968:
  +               char f[32];
  +               memset(f, 0, 32);

  WARNING: Missing a blank line after declarations
  #2410: FILE: net/core/pktgen.c:2410:
  +       struct pktgen_net *pn = net_generic(dev_net(pkt_dev->odev), pg_net_id);
  +       if (!x) {

  WARNING: Missing a blank line after declarations
  #2442: FILE: net/core/pktgen.c:2442:
  +               __u16 t;
  +               if (pkt_dev->flags & F_QUEUE_MAP_RND) {

  WARNING: Missing a blank line after declarations
  #2523: FILE: net/core/pktgen.c:2523:
  +               unsigned int i;
  +               for (i = 0; i < pkt_dev->nr_labels; i++)

  WARNING: Missing a blank line after declarations
  #2567: FILE: net/core/pktgen.c:2567:
  +                       __u32 t;
  +                       if (pkt_dev->flags & F_IPSRC_RND)

  WARNING: Missing a blank line after declarations
  #2587: FILE: net/core/pktgen.c:2587:
  +                               __be32 s;
  +                               if (pkt_dev->flags & F_IPDST_RND) {

  WARNING: Missing a blank line after declarations
  #2634: FILE: net/core/pktgen.c:2634:
  +               __u32 t;
  +               if (pkt_dev->flags & F_TXSIZE_RND) {

  WARNING: Missing a blank line after declarations
  #2736: FILE: net/core/pktgen.c:2736:
  +               int i;
  +               for (i = 0; i < pkt_dev->cflows; i++) {

  WARNING: Missing a blank line after declarations
  #2738: FILE: net/core/pktgen.c:2738:
  +                       struct xfrm_state *x = pkt_dev->flows[i].x;
  +                       if (x) {

  WARNING: Missing a blank line after declarations
  #2752: FILE: net/core/pktgen.c:2752:
  +               int nhead = 0;
  +               if (x) {

  WARNING: Missing a blank line after declarations
  #2795: FILE: net/core/pktgen.c:2795:
  +       unsigned int i;
  +       for (i = 0; i < pkt_dev->nr_labels; i++)

  WARNING: Missing a blank line after declarations
  #3480: FILE: net/core/pktgen.c:3480:
  +       ktime_t idle_start = ktime_get();
  +       schedule();

Signed-off-by: Peter Seiderer <ps.report@gmx.net>
Reviewed-by: Toke Høiland-Jørgensen <toke@redhat.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants