/* It's also responsible for power management interactions. Some configurations might not work with our current power sources. For now we just assume the gadget is always self-powered.  */
static int do_set_config(struct fsg_dev *fsg, u8 new_config)
/* It's also responsible for power management interactions. Some configurations might not work with our current power sources. For now we just assume the gadget is always self-powered.  */
static int do_set_config(struct fsg_dev *fsg, u8 new_config)
{
	int	rc = 0;
	if (fsg->config != 0) {
		DBG(fsg, "reset config\n");
		fsg->config = 0;
		rc = do_set_interface(fsg, -1);
	}
	if (new_config != 0) {
		fsg->config = new_config;
		if ((rc = do_set_interface(fsg, 0)) != 0)
			fsg->config = 0;
		else {
			char *speed;
			switch (fsg->gadget->speed) {
			case USB_SPEED_LOW:	speed = "low";	break;
			case USB_SPEED_FULL:	speed = "full";	break;
			case USB_SPEED_HIGH:	speed = "high";	break;
			default: 		speed = "?";	break;
			}
			INFO(fsg, "%s speed config #%d\n", speed, fsg->config);
		}
	}
	return rc;
}