[Spice-devel] [usbredir PATCH v2] usbredirfilter_check: force check a device if all its interfaces are skipped
Fabiano FidĂȘncio
fabiano at fidencio.org
Fri Oct 16 01:56:28 PDT 2015
On Sun, Jul 19, 2015 at 12:38 PM, Hans de Goede <hdegoede at redhat.com> wrote:
> Hi,
>
> On 14-07-15 17:30, Uri Lublin wrote:
>>
>> See usbredirfilter.h for when interfaces are skipped.
>>
>> Force filter check on such a device by calling recursively with
>> a flag that forbids skipping (usbredirfilter_fl_dont_skip_non_boot_hid)
>>
>> Related rhbz#1179210
>
>
> Looks good to me:
>
> Reviewed-by: Hans de Goede <hdegoede at redhat.com>
>
> Regards,
>
> Hans
>
>
>
>
>> ---
>>
>> v1->v2: In v1 such a case was handled by blocking the device.
>>
>> ---
>> usbredirparser/usbredirfilter.c | 21 ++++++++++++++++++---
>> 1 file changed, 18 insertions(+), 3 deletions(-)
>>
>> diff --git a/usbredirparser/usbredirfilter.c
>> b/usbredirparser/usbredirfilter.c
>> index ef9c63a..02184ef 100644
>> --- a/usbredirparser/usbredirfilter.c
>> +++ b/usbredirparser/usbredirfilter.c
>> @@ -172,7 +172,7 @@ int usbredirfilter_check(
>> uint16_t vendor_id, uint16_t product_id, uint16_t
>> device_version_bcd,
>> int flags)
>> {
>> - int i, rc;
>> + int i, rc, num_skipped=0;
>>
>> if (usbredirfilter_verify(rules, rules_count))
>> return -EINVAL;
>> @@ -190,9 +190,10 @@ int usbredirfilter_check(
>> for (i = 0; i < interface_count; i++) {
>> if (!(flags & usbredirfilter_fl_dont_skip_non_boot_hid) &&
>> interface_count > 1 && interface_class[i] == 0x03 &&
>> - interface_subclass[i] == 0x00 && interface_protocol[i] ==
>> 0x00)
>> + interface_subclass[i] == 0x00 && interface_protocol[i] ==
>> 0x00) {
>> + num_skipped++;
>> continue;
>> -
>> + }
>> rc = usbredirfilter_check1(rules, rules_count,
>> interface_class[i],
>> vendor_id, product_id,
>> device_version_bcd,
>> flags &
>> usbredirfilter_fl_default_allow);
>> @@ -200,6 +201,20 @@ int usbredirfilter_check(
>> return rc;
>> }
>>
>> + /* If all interfaces were skipped, then force check on that device,
>> + * by recursively calling this function with a flag that forbids
>> + * skipping (usbredirfilter_fl_dont_skip_non_boot_hid)
>> + */
>> + if (num_skipped == interface_count) {
>> + rc = usbredirfilter_check(rules, rules_count,
>> + device_class, device_subclass,
>> device_protocol,
>> + interface_class, interface_subclass,
>> + interface_protocol, interface_count,
>> + vendor_id, product_id,
>> device_version_bcd,
>> + flags |
>> usbredirfilter_fl_dont_skip_non_boot_hid);
>> + return rc;
>> + }
>> +
>> return 0;
>> }
>>
>>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
Pushed as:
a8d872a..07f7a98
Best Regards,
--
Fabiano FidĂȘncio
More information about the Spice-devel
mailing list