Re: [PATCH 5/5] usb-device-manager: Configure UsbDk hiding rules on auto-redirection

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, May 31, 2015 at 12:30:56PM +0300, Dmitry Fleytman wrote:
> >> +
> >> +static
> >> +void spice_usb_device_manager_set_rules(SpiceUsbDeviceManagerPrivate *priv)
> >> +{
> >> +    struct usbredirfilter_rule *rules;
> >> +    int r, count;
> >> +
> >> +    r = usbredirfilter_string_to_rules(priv->redirect_on_connect, ",", "|", &rules, &count);
> >> +    if (r) {
> >> +        SPICE_DEBUG("auto-conenct rules parsing failed with error %d", r);

Only noticed now, but "auto-connect" typo here.

> >> +        return;
> >> +    }
> >> +
> >> +    for (int i = 0; i < count; i++) {
> >> +        USB_DK_HIDE_RULE rule;
> >> +        rule.Hide = (uint64_t)rules[i].allow;
> >> +        rule.Class = (uint64_t)rules[i].device_class;
> >> +        rule.VID = (uint64_t)rules[i].vendor_id;
> >> +        rule.PID = (uint64_t)rules[i].product_id;
> >> +        rule.BCD = (uint64_t)rules[i].device_version_bcd;
> >> +        if(!priv->usbdk_api.AddRule(priv->usbdk_hider_handle, &rule)) {
> >> +            SPICE_DEBUG("UsbDk set hide rule API failed");
> >> +        }
> >> +    }
> >> +
> >> +    free(rules);
> >> +}
> >> +
> > 
> > This helper could go to usbdk_api_wrapper maybe:
> > usbdk_api_wrapper_set_rules(wrapper, handle, priv->redirect_on_connect) ?
> 
> I’d prefer to keep UsbDk wrapper code as independent as possible.

Why ?

> This parsing logic looks too specific.

In the context of spice-gtk/usbredir (ie the git repository where the
new files are added), this is not 'too specific', this is the right
place to have that code.

Christophe

Attachment: pgpXh766mvEt6.pgp
Description: PGP signature

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]