bool res;
int ret;
- if (!func->ffs_service) {
+ if (!func->is_functionfs) {
ret = usbg_lookup_function_type(func->name);
res = ret >= 0;
} else {
int type;
usbg_function *func;
- if (!usb_func->ffs_service) {
+ if (!usb_func->is_functionfs) {
type = usbg_lookup_function_type(usb_func->name);
if (strlen(usb_func->instance) >= MAX_INSTANCE_LEN)
return -ENAMETOOLONG;
if (usbg_get_function_type(func) == USBG_F_RNDIS)
(void)cfs_set_rndis_mac_addr(cfs_client->gadget, func); /* A random value is used if fails */
- if (usb_func->ffs_service) {
+ if (usb_func->is_functionfs) {
ret = cfs_prep_ffs_service(usb_func->name,
usb_func->instance,
instance,
- usb_func->ffs_service);
+ usb_func->service);
if (ret)
return ret;
}
if (func->handler)
func->handler(1);
- if (func->service)
+ /* functionfs service is automatically started by socket activation */
+ if (!func->is_functionfs && func->service)
(void)systemd_start_unit_wait_started(func->service, ".service", -1);
-
- /* func->ffs_service is automatically started by socket activation */
}
cfs_free_gadget(gadget);
for (i = 0; gadget->funcs[i]; ++i) {
func = gadget->funcs[i];
- if (func->service)
+ if (!func->is_functionfs && func->service)
(void)systemd_stop_unit_wait_stopped(func->service, ".service", -1);
if (func->handler)
ret = usbg_disable_gadget(cfs_client->gadget); /* ignore error checking */
/*
- * Since ffs_service works with socket activation, you must stop it after disabling gadget.
- * If usb data may come in after stopping ffs_service and before disabling gadget,
- * ffs_service wakes up again by socket activation.
+ * Since functionfs service works with socket activation, you must stop it after disabling gadget.
+ * If usb data may come in after stopping functionfs service and before disabling gadget,
+ * functionfs service wakes up again by socket activation.
*/
for (i = 0; gadget->funcs[i]; ++i) {
func = gadget->funcs[i];
- if (func->ffs_service)
- (void)systemd_stop_unit_wait_stopped(func->ffs_service, ".service", -1);
+ if (func->is_functionfs && func->service)
+ (void)systemd_stop_unit_wait_stopped(func->service, ".service", -1);
}
cfs_free_gadget(gadget);
continue;
usb_func = _available_funcs[ret];
- if (usb_func->ffs_service) {
- systemd_stop_unit_wait_stopped(usb_func->ffs_service, ".socket", -1);
- systemd_stop_unit_wait_stopped(usb_func->ffs_service, ".service", -1);
+
+ if (usb_func->is_functionfs && usb_func->service) {
+ (void)systemd_stop_unit_wait_stopped(usb_func->service, ".socket", -1);
+ (void)systemd_stop_unit_wait_stopped(usb_func->service, ".service", -1);
}
}