add support to switch device driver at runtime
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14508 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
17f2dd5c13
commit
57c2a5fa5a
5 changed files with 21 additions and 6 deletions
|
@ -479,7 +479,7 @@ int usbdriver_menuitem(void)
|
|||
global_settings.usb_stack_device_driver))
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
gui_synclist_init(&lists, usb_menu_getname, drivers, false, 1);
|
||||
gui_synclist_set_title(&lists, str(LANG_USBSTACK_DEVICE_DRIVER), NOICON);
|
||||
gui_synclist_set_icon_callback(&lists, NULL);
|
||||
|
@ -495,14 +495,17 @@ int usbdriver_menuitem(void)
|
|||
continue;
|
||||
if (action == ACTION_STD_CANCEL)
|
||||
{
|
||||
// setting was canceled
|
||||
/* setting was canceled */
|
||||
break;
|
||||
}
|
||||
else if (action == ACTION_STD_OK)
|
||||
{
|
||||
// setting was accepted... save
|
||||
strcpy(global_settings.usb_stack_device_driver,
|
||||
/* setting was accepted... save */
|
||||
strcpy(global_settings.usb_stack_device_driver,
|
||||
drivers[gui_synclist_get_sel_pos(&lists)]);
|
||||
|
||||
/* switch device driver */
|
||||
usb_device_driver_bind(drivers[gui_synclist_get_sel_pos(&lists)]);
|
||||
break;
|
||||
}
|
||||
else if (action == ACTION_REDRAW)
|
||||
|
|
|
@ -25,7 +25,7 @@ static struct usb_dcd_controller_ops* ops;
|
|||
struct usb_device_driver usb_serial_driver = {
|
||||
.name = "serial",
|
||||
.bind = usb_serial_driver_bind,
|
||||
.unbind = NULL,
|
||||
.unbind = usb_serial_driver_unbind,
|
||||
.request = usb_serial_driver_request,
|
||||
.suspend = NULL,
|
||||
.resume = NULL,
|
||||
|
@ -212,6 +212,11 @@ autoconf_fail:
|
|||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
void usb_serial_driver_unbind(void) {
|
||||
|
||||
/* disable endpoints... */
|
||||
}
|
||||
|
||||
int usb_serial_driver_request(struct usb_ctrlrequest* request)
|
||||
{
|
||||
int ret = -EOPNOTSUPP;
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
void usb_serial_driver_init(void);
|
||||
|
||||
int usb_serial_driver_bind(void* controller_ops);
|
||||
void usb_serial_driver_unbind(void);
|
||||
int usb_serial_driver_request(struct usb_ctrlrequest* req);
|
||||
void usb_serial_driver_speed(enum usb_device_speed speed);
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ static struct usb_dcd_controller_ops* ops;
|
|||
struct usb_device_driver usb_storage_driver = {
|
||||
.name = "storage",
|
||||
.bind = usb_storage_driver_bind,
|
||||
.unbind = NULL,
|
||||
.unbind = usb_storage_driver_unbind,
|
||||
.request = usb_storage_driver_request,
|
||||
.suspend = NULL,
|
||||
.resume = NULL,
|
||||
|
@ -194,6 +194,11 @@ autoconf_fail:
|
|||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
void usb_storage_driver_unbind(void) {
|
||||
|
||||
/* disable endpoints... */
|
||||
}
|
||||
|
||||
int usb_storage_driver_request(struct usb_ctrlrequest* request)
|
||||
{
|
||||
int ret = -EOPNOTSUPP;
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
void usb_storage_driver_init(void);
|
||||
|
||||
int usb_storage_driver_bind(void* controller_ops);
|
||||
void usb_storage_driver_unbind(void);
|
||||
int usb_storage_driver_request(struct usb_ctrlrequest* req);
|
||||
void usb_storage_driver_speed(enum usb_device_speed speed);
|
||||
|
||||
|
|
Loading…
Reference in a new issue