On Mon, May 05 2014, Andrzej Pietrasiewicz wrote: > Do I get it right that you suggest creating a struct and then > memcpy'ing it to the destination buffer? > > Something on the lines of: > > struct usb_os_string { > __u8 bLength; > __u8 bDescriptorType; > __u8 qwSignature[OS_STRING_QW_SIGN_LEN]; > __u8 bMS_VendorCode; > __u8 bPad; > } __attribute__ ((packed)); > > And then have cdev have a struct usb_os_string member instead of > qw_sign and b_vendor_code? I leave it up to you whether cdev should change, but I think get_string should read something like: if (cdev->use_os_string && language == 0 && id == OS_STRING_IDX) { struct usb_os_string *b = buf; b->bLength = sizeof *b; b->bDescriptorType = USB_DT_STRING; STATIC_ASSERT(sizeof b->qwSignature == sizeof cdev->qw_sign); memcpy(&b->qwSignature, cdev->qw_sign, sizeof b->qwSignature); b->bMS_VendorCode = cdev->b_vendor_code; b->bPad = 0; return sizeof *b; } Should cdev have usb_os_string member, get_string would be simpler but cdev would be a bit bigger. -- Best regards, _ _ .o. | Liege of Serenely Enlightened Majesty of o' \,=./ `o ..o | Computer Science, Michał “mina86” Nazarewicz (o o) ooo +--<mpn@xxxxxxxxxx>--<xmpp:mina86@xxxxxxxxxx>--ooO--(_)--Ooo-- -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html