From 9ace295fb49d1a5e584eb026772f59dbdb41df34 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sun, 30 Dec 2012 01:26:25 -0800 Subject: [PATCH] core: Silly workaround for a really stupid kernel bug :( --- src/mgmt.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/mgmt.c b/src/mgmt.c index 84da37d6c..bb230f733 100644 --- a/src/mgmt.c +++ b/src/mgmt.c @@ -1155,8 +1155,18 @@ int mgmt_set_dev_class(int index, uint8_t major, uint8_t minor) hdr->len = htobs(sizeof(*cp)); hdr->index = htobs(index); - cp->major = major; - cp->minor = minor; + /* + * Silly workaround for a really stupid kernel bug :( + * + * All current kernel versions assign the major and minor numbers + * straight to dev_class[0] and dev_class[1] without considering + * the proper bit shifting. + * + * To make this work, shift the value in userspace for now until + * we get a fixed kernel version. + */ + cp->major = major & 0x1f; + cp->minor = minor << 2; if (write(mgmt_sock, buf, sizeof(buf)) < 0) return -errno; -- 2.47.3