mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-18 03:23:53 -04:00
usb: gadget: add RNDIS configfs options for class/subclass/protocol
This adds 3 new options to the RNDIS gadget function configs. It allows overriding the default USB interface class/subclass/protocol. The motivation for this is that if you set the values to "ef" (Misc), "04" (RNDIS), "01" (Ethernet) respectively, then the device will be recognized by the rndiscmp.inf file in Windows Vista and newer and will cause Windows to load the correct RNDIS driver without the need for a custom (signed) .inf file. Signed-off-by: David Lechner <david@lechnology.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
This commit is contained in:
committed by
Felipe Balbi
parent
6cea1449f6
commit
73517cf49b
@@ -153,4 +153,39 @@ out: \
|
||||
\
|
||||
CONFIGFS_ATTR_RO(_f_##_opts_, ifname)
|
||||
|
||||
#define USB_ETHER_CONFIGFS_ITEM_ATTR_U8_RW(_f_, _n_) \
|
||||
static ssize_t _f_##_opts_##_n_##_show(struct config_item *item,\
|
||||
char *page) \
|
||||
{ \
|
||||
struct f_##_f_##_opts *opts = to_f_##_f_##_opts(item); \
|
||||
int ret; \
|
||||
\
|
||||
mutex_lock(&opts->lock); \
|
||||
ret = sprintf(page, "%02x\n", opts->_n_); \
|
||||
mutex_unlock(&opts->lock); \
|
||||
\
|
||||
return ret; \
|
||||
} \
|
||||
\
|
||||
static ssize_t _f_##_opts_##_n_##_store(struct config_item *item,\
|
||||
const char *page, \
|
||||
size_t len) \
|
||||
{ \
|
||||
struct f_##_f_##_opts *opts = to_f_##_f_##_opts(item); \
|
||||
int ret; \
|
||||
u8 val; \
|
||||
\
|
||||
mutex_lock(&opts->lock); \
|
||||
ret = sscanf(page, "%02hhx", &val); \
|
||||
if (ret > 0) { \
|
||||
opts->_n_ = val; \
|
||||
ret = len; \
|
||||
} \
|
||||
mutex_unlock(&opts->lock); \
|
||||
\
|
||||
return ret; \
|
||||
} \
|
||||
\
|
||||
CONFIGFS_ATTR(_f_##_opts_, _n_)
|
||||
|
||||
#endif /* __U_ETHER_CONFIGFS_H */
|
||||
|
||||
Reference in New Issue
Block a user