usb: gadget: u_serial: allow more console gadget ports
Allow configuring more than one console using USB serial or ACM gadget. By default, only first (ttyGS0) is a console, but this may be changed using function's new "console" attribute. Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
This commit is contained in:

committed by
Felipe Balbi

parent
b417343c6a
commit
d7cb8fb7aa
@@ -771,6 +771,24 @@ static struct configfs_item_operations acm_item_ops = {
|
||||
.release = acm_attr_release,
|
||||
};
|
||||
|
||||
#ifdef CONFIG_U_SERIAL_CONSOLE
|
||||
|
||||
static ssize_t f_acm_console_store(struct config_item *item,
|
||||
const char *page, size_t count)
|
||||
{
|
||||
return gserial_set_console(to_f_serial_opts(item)->port_num,
|
||||
page, count);
|
||||
}
|
||||
|
||||
static ssize_t f_acm_console_show(struct config_item *item, char *page)
|
||||
{
|
||||
return gserial_get_console(to_f_serial_opts(item)->port_num, page);
|
||||
}
|
||||
|
||||
CONFIGFS_ATTR(f_acm_, console);
|
||||
|
||||
#endif /* CONFIG_U_SERIAL_CONSOLE */
|
||||
|
||||
static ssize_t f_acm_port_num_show(struct config_item *item, char *page)
|
||||
{
|
||||
return sprintf(page, "%u\n", to_f_serial_opts(item)->port_num);
|
||||
@@ -779,6 +797,9 @@ static ssize_t f_acm_port_num_show(struct config_item *item, char *page)
|
||||
CONFIGFS_ATTR_RO(f_acm_, port_num);
|
||||
|
||||
static struct configfs_attribute *acm_attrs[] = {
|
||||
#ifdef CONFIG_U_SERIAL_CONSOLE
|
||||
&f_acm_attr_console,
|
||||
#endif
|
||||
&f_acm_attr_port_num,
|
||||
NULL,
|
||||
};
|
||||
|
Reference in New Issue
Block a user