Re: [PATCH 14/20] usb/gadget: push iSerialNumber into gadgets

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

 



On 08/27/2012 03:51 PM, Michal Nazarewicz wrote:
And how do you achieve the "" initialization? This macro is
evaluated after the id has been assigned.

Ah, right, I've forgotten that usb_string_ids_tab iterates till it finds
a NULL pointer.

not only usb_string_ids_tab iterates() but also the lookup code.

What I could live with is to add the string_dev variable to the macro
and enforce all Serial/Manu/Product index to be the same. The idea died
once I saw g_ffs. So?

Uh?  What's so scary about g_ffs?  You just need to add GFFS_SERIAL_IDX
at the beginning rather than end of the enum which will make it zero.

No scary but as same as all other gadgets. If I pick idx 0-2 for
Serial/Product/MFR than I patch all gadgets the same way except for
g_ffs.
SERIAL = 0 I would add [i + 1]. Adding one more member…

Alternatively, you could make the macro take string_dev and index of
serial string with requirement that serial string is followed by
manufacturer and product.

I feel this would be less intrusive to existing gadgets as it would keep
the ids the way they are and only add some new strings at the end of the
tables.

With this approach, I think it would also be beneficial to create a
USB_GADGET_COMPOSITE_STRINGS(num) macro (or something) as so:

#define USB_GADGET_COMPOSITE_STIRNGS(num) \
   { [num  ].s = "" },  /* serial       */ \
   { [num+1].s = "" },  /* manufacturer */ \
   { [num+2].s = "" },  /* product */

This way, gadgets would just add one index to strings, say
USB_COMPOSITE_STRINGS_IDX, invoke
USB_GADGET_COMPOSITE_STIRNGS(USB_COMPOSITE_STRINGS_IDX) at the end of
their string_dev and pass string_dev and USB_COMPOSITE_STRINGS_IDX as
two more arguments to USB_GADGET_COMPOSITE_OVERWRITE_OPTIONS.

I see. So we either use the default serial which is provided by the
gadget _or_ overwrite desc.iSerial with num.id in case the module
parameter is used?

Sebastian
--
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


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux