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:
Christian Gmeiner 2007-08-29 11:55:23 +00:00
parent 17f2dd5c13
commit 57c2a5fa5a
5 changed files with 21 additions and 6 deletions

View file

@ -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
/* 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)

View file

@ -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;

View file

@ -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);

View file

@ -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;

View file

@ -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);