13 #include <linux/slab.h>
14 #include <linux/kernel.h>
15 #include <linux/device.h>
51 .bInterfaceSubClass = 0,
52 .bInterfaceProtocol = 0,
117 .
bLength =
sizeof gser_ss_bulk_comp_desc,
132 static struct usb_string gser_string_defs[] = {
133 [0].s =
"Generic Serial",
139 .strings = gser_string_defs,
151 struct f_gser *gser = func_to_gser(f);
156 if (gser->
port.in->driver_data) {
157 DBG(cdev,
"reset generic ttyGS%d\n", gser->
port_num);
160 if (!gser->
port.in->desc || !gser->
port.out->desc) {
161 DBG(cdev,
"activate generic ttyGS%d\n", gser->
port_num);
175 struct f_gser *gser = func_to_gser(f);
178 DBG(cdev,
"generic ttyGS%d deactivated\n", gser->
port_num);
190 struct f_gser *gser = func_to_gser(f);
199 gser_interface_desc.bInterfaceNumber =
status;
223 if (gadget_is_dualspeed(c->
cdev->gadget)) {
224 gser_hs_in_desc.bEndpointAddress =
225 gser_fs_in_desc.bEndpointAddress;
226 gser_hs_out_desc.bEndpointAddress =
227 gser_fs_out_desc.bEndpointAddress;
232 if (gadget_is_superspeed(c->
cdev->gadget)) {
233 gser_ss_in_desc.bEndpointAddress =
234 gser_fs_in_desc.bEndpointAddress;
235 gser_ss_out_desc.bEndpointAddress =
236 gser_fs_out_desc.bEndpointAddress;
244 DBG(cdev,
"generic ttyGS%d: %s speed IN/%s OUT/%s\n",
246 gadget_is_superspeed(c->
cdev->gadget) ?
"super" :
247 gadget_is_dualspeed(c->
cdev->gadget) ?
"dual" :
"full",
248 gser->
port.in->name, gser->
port.out->name);
258 ERROR(cdev,
"%s: can't bind, err %d\n", f->
name, status);
266 if (gadget_is_dualspeed(c->
cdev->gadget))
268 if (gadget_is_superspeed(c->
cdev->gadget))
271 kfree(func_to_gser(f));
296 if (gser_string_defs[0].
id == 0) {
310 gser->
port.func.name =
"gser";
311 gser->
port.func.strings = gser_strings;
312 gser->
port.func.bind = gser_bind;
313 gser->
port.func.unbind = gser_unbind;
314 gser->
port.func.set_alt = gser_set_alt;
315 gser->
port.func.disable = gser_disable;