blob: a1b79c53499c2f4e852b1599347df3a400337745 [file] [log] [blame]
Felipe Balbi30867752008-08-18 17:39:30 -07001/*
2 * f_obex.c -- USB CDC OBEX function driver
3 *
4 * Copyright (C) 2008 Nokia Corporation
5 * Contact: Felipe Balbi <felipe.balbi@nokia.com>
6 *
7 * Based on f_acm.c by Al Borchers and David Brownell.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
Felipe Balbi30867752008-08-18 17:39:30 -070013 */
14
15/* #define VERBOSE_DEBUG */
16
Tejun Heo5a0e3ad2010-03-24 17:04:11 +090017#include <linux/slab.h>
Felipe Balbi30867752008-08-18 17:39:30 -070018#include <linux/kernel.h>
Felipe Balbi30867752008-08-18 17:39:30 -070019#include <linux/device.h>
Paul Gortmaker6eb0de82011-07-03 16:09:31 -040020#include <linux/module.h>
Felipe Balbi30867752008-08-18 17:39:30 -070021
22#include "u_serial.h"
23#include "gadget_chips.h"
24
25
26/*
27 * This CDC OBEX function support just packages a TTY-ish byte stream.
28 * A user mode server will put it into "raw" mode and handle all the
29 * relevant protocol details ... this is just a kernel passthrough.
David Brownell21214272008-08-18 17:45:25 -070030 * When possible, we prevent gadget enumeration until that server is
31 * ready to handle the commands.
Felipe Balbi30867752008-08-18 17:39:30 -070032 */
33
Felipe Balbi30867752008-08-18 17:39:30 -070034struct f_obex {
35 struct gserial port;
36 u8 ctrl_id;
37 u8 data_id;
Felipe Balbi3985f3a2014-09-29 15:18:20 -050038 u8 cur_alt;
Felipe Balbi30867752008-08-18 17:39:30 -070039 u8 port_num;
David Brownell21214272008-08-18 17:45:25 -070040 u8 can_activate;
Felipe Balbi30867752008-08-18 17:39:30 -070041};
42
43static inline struct f_obex *func_to_obex(struct usb_function *f)
44{
45 return container_of(f, struct f_obex, port.func);
46}
47
David Brownell21214272008-08-18 17:45:25 -070048static inline struct f_obex *port_to_obex(struct gserial *p)
49{
50 return container_of(p, struct f_obex, port);
51}
52
Felipe Balbi30867752008-08-18 17:39:30 -070053/*-------------------------------------------------------------------------*/
54
55#define OBEX_CTRL_IDX 0
56#define OBEX_DATA_IDX 1
57
58static struct usb_string obex_string_defs[] = {
59 [OBEX_CTRL_IDX].s = "CDC Object Exchange (OBEX)",
60 [OBEX_DATA_IDX].s = "CDC OBEX Data",
61 { }, /* end of list */
62};
63
64static struct usb_gadget_strings obex_string_table = {
65 .language = 0x0409, /* en-US */
66 .strings = obex_string_defs,
67};
68
69static struct usb_gadget_strings *obex_strings[] = {
70 &obex_string_table,
71 NULL,
72};
73
74/*-------------------------------------------------------------------------*/
75
Andrzej Pietrasiewicz1d8fc252013-03-21 15:33:42 +010076static struct usb_interface_descriptor obex_control_intf = {
Felipe Balbi30867752008-08-18 17:39:30 -070077 .bLength = sizeof(obex_control_intf),
78 .bDescriptorType = USB_DT_INTERFACE,
79 .bInterfaceNumber = 0,
80
81 .bAlternateSetting = 0,
82 .bNumEndpoints = 0,
83 .bInterfaceClass = USB_CLASS_COMM,
84 .bInterfaceSubClass = USB_CDC_SUBCLASS_OBEX,
85};
86
Andrzej Pietrasiewicz1d8fc252013-03-21 15:33:42 +010087static struct usb_interface_descriptor obex_data_nop_intf = {
Felipe Balbi30867752008-08-18 17:39:30 -070088 .bLength = sizeof(obex_data_nop_intf),
89 .bDescriptorType = USB_DT_INTERFACE,
90 .bInterfaceNumber = 1,
91
92 .bAlternateSetting = 0,
93 .bNumEndpoints = 0,
94 .bInterfaceClass = USB_CLASS_CDC_DATA,
95};
96
Andrzej Pietrasiewicz1d8fc252013-03-21 15:33:42 +010097static struct usb_interface_descriptor obex_data_intf = {
Felipe Balbi30867752008-08-18 17:39:30 -070098 .bLength = sizeof(obex_data_intf),
99 .bDescriptorType = USB_DT_INTERFACE,
100 .bInterfaceNumber = 2,
101
102 .bAlternateSetting = 1,
103 .bNumEndpoints = 2,
104 .bInterfaceClass = USB_CLASS_CDC_DATA,
105};
106
Andrzej Pietrasiewicz1d8fc252013-03-21 15:33:42 +0100107static struct usb_cdc_header_desc obex_cdc_header_desc = {
Felipe Balbi30867752008-08-18 17:39:30 -0700108 .bLength = sizeof(obex_cdc_header_desc),
109 .bDescriptorType = USB_DT_CS_INTERFACE,
110 .bDescriptorSubType = USB_CDC_HEADER_TYPE,
Harvey Harrison551509d2009-02-11 14:11:36 -0800111 .bcdCDC = cpu_to_le16(0x0120),
Felipe Balbi30867752008-08-18 17:39:30 -0700112};
113
Andrzej Pietrasiewicz1d8fc252013-03-21 15:33:42 +0100114static struct usb_cdc_union_desc obex_cdc_union_desc = {
Felipe Balbi30867752008-08-18 17:39:30 -0700115 .bLength = sizeof(obex_cdc_union_desc),
116 .bDescriptorType = USB_DT_CS_INTERFACE,
117 .bDescriptorSubType = USB_CDC_UNION_TYPE,
118 .bMasterInterface0 = 1,
119 .bSlaveInterface0 = 2,
120};
121
Andrzej Pietrasiewicz1d8fc252013-03-21 15:33:42 +0100122static struct usb_cdc_obex_desc obex_desc = {
Felipe Balbi30867752008-08-18 17:39:30 -0700123 .bLength = sizeof(obex_desc),
124 .bDescriptorType = USB_DT_CS_INTERFACE,
125 .bDescriptorSubType = USB_CDC_OBEX_TYPE,
Harvey Harrison551509d2009-02-11 14:11:36 -0800126 .bcdVersion = cpu_to_le16(0x0100),
Felipe Balbi30867752008-08-18 17:39:30 -0700127};
128
129/* High-Speed Support */
130
Andrzej Pietrasiewicz1d8fc252013-03-21 15:33:42 +0100131static struct usb_endpoint_descriptor obex_hs_ep_out_desc = {
Felipe Balbi30867752008-08-18 17:39:30 -0700132 .bLength = USB_DT_ENDPOINT_SIZE,
133 .bDescriptorType = USB_DT_ENDPOINT,
134
135 .bEndpointAddress = USB_DIR_OUT,
136 .bmAttributes = USB_ENDPOINT_XFER_BULK,
Harvey Harrison551509d2009-02-11 14:11:36 -0800137 .wMaxPacketSize = cpu_to_le16(512),
Felipe Balbi30867752008-08-18 17:39:30 -0700138};
139
Andrzej Pietrasiewicz1d8fc252013-03-21 15:33:42 +0100140static struct usb_endpoint_descriptor obex_hs_ep_in_desc = {
Felipe Balbi30867752008-08-18 17:39:30 -0700141 .bLength = USB_DT_ENDPOINT_SIZE,
142 .bDescriptorType = USB_DT_ENDPOINT,
143
144 .bEndpointAddress = USB_DIR_IN,
145 .bmAttributes = USB_ENDPOINT_XFER_BULK,
Harvey Harrison551509d2009-02-11 14:11:36 -0800146 .wMaxPacketSize = cpu_to_le16(512),
Felipe Balbi30867752008-08-18 17:39:30 -0700147};
148
Andrzej Pietrasiewicz1d8fc252013-03-21 15:33:42 +0100149static struct usb_descriptor_header *hs_function[] = {
Felipe Balbi30867752008-08-18 17:39:30 -0700150 (struct usb_descriptor_header *) &obex_control_intf,
151 (struct usb_descriptor_header *) &obex_cdc_header_desc,
152 (struct usb_descriptor_header *) &obex_desc,
153 (struct usb_descriptor_header *) &obex_cdc_union_desc,
154
155 (struct usb_descriptor_header *) &obex_data_nop_intf,
156 (struct usb_descriptor_header *) &obex_data_intf,
157 (struct usb_descriptor_header *) &obex_hs_ep_in_desc,
158 (struct usb_descriptor_header *) &obex_hs_ep_out_desc,
159 NULL,
160};
161
162/* Full-Speed Support */
163
Andrzej Pietrasiewicz1d8fc252013-03-21 15:33:42 +0100164static struct usb_endpoint_descriptor obex_fs_ep_in_desc = {
Felipe Balbi30867752008-08-18 17:39:30 -0700165 .bLength = USB_DT_ENDPOINT_SIZE,
166 .bDescriptorType = USB_DT_ENDPOINT,
167
168 .bEndpointAddress = USB_DIR_IN,
169 .bmAttributes = USB_ENDPOINT_XFER_BULK,
170};
171
Andrzej Pietrasiewicz1d8fc252013-03-21 15:33:42 +0100172static struct usb_endpoint_descriptor obex_fs_ep_out_desc = {
Felipe Balbi30867752008-08-18 17:39:30 -0700173 .bLength = USB_DT_ENDPOINT_SIZE,
174 .bDescriptorType = USB_DT_ENDPOINT,
175
176 .bEndpointAddress = USB_DIR_OUT,
177 .bmAttributes = USB_ENDPOINT_XFER_BULK,
178};
179
Andrzej Pietrasiewicz1d8fc252013-03-21 15:33:42 +0100180static struct usb_descriptor_header *fs_function[] = {
Felipe Balbi30867752008-08-18 17:39:30 -0700181 (struct usb_descriptor_header *) &obex_control_intf,
182 (struct usb_descriptor_header *) &obex_cdc_header_desc,
183 (struct usb_descriptor_header *) &obex_desc,
184 (struct usb_descriptor_header *) &obex_cdc_union_desc,
185
186 (struct usb_descriptor_header *) &obex_data_nop_intf,
187 (struct usb_descriptor_header *) &obex_data_intf,
188 (struct usb_descriptor_header *) &obex_fs_ep_in_desc,
189 (struct usb_descriptor_header *) &obex_fs_ep_out_desc,
190 NULL,
191};
192
193/*-------------------------------------------------------------------------*/
194
195static int obex_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
196{
197 struct f_obex *obex = func_to_obex(f);
198 struct usb_composite_dev *cdev = f->config->cdev;
199
200 if (intf == obex->ctrl_id) {
201 if (alt != 0)
202 goto fail;
203 /* NOP */
Richard Leitnerb8b0ea52014-08-21 08:31:39 +0200204 dev_dbg(&cdev->gadget->dev,
205 "reset obex ttyGS%d control\n", obex->port_num);
Felipe Balbi30867752008-08-18 17:39:30 -0700206
207 } else if (intf == obex->data_id) {
208 if (alt > 1)
209 goto fail;
210
211 if (obex->port.in->driver_data) {
Richard Leitnerb8b0ea52014-08-21 08:31:39 +0200212 dev_dbg(&cdev->gadget->dev,
213 "reset obex ttyGS%d\n", obex->port_num);
Felipe Balbi30867752008-08-18 17:39:30 -0700214 gserial_disconnect(&obex->port);
215 }
216
Tatyana Brokhmanea2a1df2011-06-28 16:33:50 +0300217 if (!obex->port.in->desc || !obex->port.out->desc) {
Richard Leitnerb8b0ea52014-08-21 08:31:39 +0200218 dev_dbg(&cdev->gadget->dev,
219 "init obex ttyGS%d\n", obex->port_num);
Tatyana Brokhmanea2a1df2011-06-28 16:33:50 +0300220 if (config_ep_by_speed(cdev->gadget, f,
221 obex->port.in) ||
222 config_ep_by_speed(cdev->gadget, f,
223 obex->port.out)) {
224 obex->port.out->desc = NULL;
225 obex->port.in->desc = NULL;
226 goto fail;
227 }
Felipe Balbi30867752008-08-18 17:39:30 -0700228 }
229
230 if (alt == 1) {
Richard Leitnerb8b0ea52014-08-21 08:31:39 +0200231 dev_dbg(&cdev->gadget->dev,
232 "activate obex ttyGS%d\n", obex->port_num);
Felipe Balbi30867752008-08-18 17:39:30 -0700233 gserial_connect(&obex->port, obex->port_num);
234 }
235
236 } else
237 goto fail;
238
Felipe Balbi3985f3a2014-09-29 15:18:20 -0500239 obex->cur_alt = alt;
240
Felipe Balbi30867752008-08-18 17:39:30 -0700241 return 0;
242
243fail:
244 return -EINVAL;
245}
246
247static int obex_get_alt(struct usb_function *f, unsigned intf)
248{
249 struct f_obex *obex = func_to_obex(f);
250
Felipe Balbi3985f3a2014-09-29 15:18:20 -0500251 return obex->cur_alt;
Felipe Balbi30867752008-08-18 17:39:30 -0700252}
253
254static void obex_disable(struct usb_function *f)
255{
256 struct f_obex *obex = func_to_obex(f);
257 struct usb_composite_dev *cdev = f->config->cdev;
258
Richard Leitnerb8b0ea52014-08-21 08:31:39 +0200259 dev_dbg(&cdev->gadget->dev, "obex ttyGS%d disable\n", obex->port_num);
Felipe Balbi30867752008-08-18 17:39:30 -0700260 gserial_disconnect(&obex->port);
261}
262
263/*-------------------------------------------------------------------------*/
264
David Brownell21214272008-08-18 17:45:25 -0700265static void obex_connect(struct gserial *g)
266{
267 struct f_obex *obex = port_to_obex(g);
268 struct usb_composite_dev *cdev = g->func.config->cdev;
269 int status;
270
271 if (!obex->can_activate)
272 return;
273
274 status = usb_function_activate(&g->func);
275 if (status)
Richard Leitnerb8b0ea52014-08-21 08:31:39 +0200276 dev_dbg(&cdev->gadget->dev,
277 "obex ttyGS%d function activate --> %d\n",
David Brownell21214272008-08-18 17:45:25 -0700278 obex->port_num, status);
279}
280
281static void obex_disconnect(struct gserial *g)
282{
283 struct f_obex *obex = port_to_obex(g);
284 struct usb_composite_dev *cdev = g->func.config->cdev;
285 int status;
286
287 if (!obex->can_activate)
288 return;
289
290 status = usb_function_deactivate(&g->func);
291 if (status)
Richard Leitnerb8b0ea52014-08-21 08:31:39 +0200292 dev_dbg(&cdev->gadget->dev,
293 "obex ttyGS%d function deactivate --> %d\n",
David Brownell21214272008-08-18 17:45:25 -0700294 obex->port_num, status);
295}
296
297/*-------------------------------------------------------------------------*/
298
Andrzej Pietrasiewicz1d8fc252013-03-21 15:33:42 +0100299/* Some controllers can't support CDC OBEX ... */
300static inline bool can_support_obex(struct usb_configuration *c)
301{
302 /* Since the first interface is a NOP, we can ignore the
303 * issue of multi-interface support on most controllers.
304 *
305 * Altsettings are mandatory, however...
306 */
307 if (!gadget_supports_altsettings(c->cdev->gadget))
308 return false;
309
310 /* everything else is *probably* fine ... */
311 return true;
312}
313
314static int obex_bind(struct usb_configuration *c, struct usb_function *f)
Felipe Balbi30867752008-08-18 17:39:30 -0700315{
316 struct usb_composite_dev *cdev = c->cdev;
317 struct f_obex *obex = func_to_obex(f);
Andrzej Pietrasiewicz1af877c2013-05-23 10:51:07 +0200318 struct usb_string *us;
Felipe Balbi30867752008-08-18 17:39:30 -0700319 int status;
320 struct usb_ep *ep;
321
Andrzej Pietrasiewicz1d8fc252013-03-21 15:33:42 +0100322 if (!can_support_obex(c))
323 return -EINVAL;
324
Andrzej Pietrasiewicz1af877c2013-05-23 10:51:07 +0200325 us = usb_gstrings_attach(cdev, obex_strings,
326 ARRAY_SIZE(obex_string_defs));
327 if (IS_ERR(us))
328 return PTR_ERR(us);
329 obex_control_intf.iInterface = us[OBEX_CTRL_IDX].id;
330 obex_data_nop_intf.iInterface = us[OBEX_DATA_IDX].id;
331 obex_data_intf.iInterface = us[OBEX_DATA_IDX].id;
Andrzej Pietrasiewicz1d8fc252013-03-21 15:33:42 +0100332
Felipe Balbi30867752008-08-18 17:39:30 -0700333 /* allocate instance-specific interface IDs, and patch descriptors */
334
335 status = usb_interface_id(c, f);
336 if (status < 0)
337 goto fail;
338 obex->ctrl_id = status;
339
340 obex_control_intf.bInterfaceNumber = status;
341 obex_cdc_union_desc.bMasterInterface0 = status;
342
343 status = usb_interface_id(c, f);
344 if (status < 0)
345 goto fail;
346 obex->data_id = status;
347
348 obex_data_nop_intf.bInterfaceNumber = status;
349 obex_data_intf.bInterfaceNumber = status;
350 obex_cdc_union_desc.bSlaveInterface0 = status;
351
352 /* allocate instance-specific endpoints */
353
Wei Yongjun6ee3e8e2013-04-06 12:39:49 +0800354 status = -ENODEV;
Felipe Balbi30867752008-08-18 17:39:30 -0700355 ep = usb_ep_autoconfig(cdev->gadget, &obex_fs_ep_in_desc);
356 if (!ep)
357 goto fail;
358 obex->port.in = ep;
359 ep->driver_data = cdev; /* claim */
360
361 ep = usb_ep_autoconfig(cdev->gadget, &obex_fs_ep_out_desc);
362 if (!ep)
363 goto fail;
364 obex->port.out = ep;
365 ep->driver_data = cdev; /* claim */
366
Felipe Balbi30867752008-08-18 17:39:30 -0700367 /* support all relevant hardware speeds... we expect that when
368 * hardware is dual speed, all bulk-capable endpoints work at
369 * both speeds
370 */
Felipe Balbi30867752008-08-18 17:39:30 -0700371
Sebastian Andrzej Siewior10287ba2012-10-22 22:15:06 +0200372 obex_hs_ep_in_desc.bEndpointAddress =
373 obex_fs_ep_in_desc.bEndpointAddress;
374 obex_hs_ep_out_desc.bEndpointAddress =
375 obex_fs_ep_out_desc.bEndpointAddress;
Felipe Balbi30867752008-08-18 17:39:30 -0700376
Sebastian Andrzej Siewior10287ba2012-10-22 22:15:06 +0200377 status = usb_assign_descriptors(f, fs_function, hs_function, NULL);
378 if (status)
379 goto fail;
Felipe Balbi30867752008-08-18 17:39:30 -0700380
David Brownell21214272008-08-18 17:45:25 -0700381 /* Avoid letting this gadget enumerate until the userspace
382 * OBEX server is active.
383 */
384 status = usb_function_deactivate(f);
385 if (status < 0)
386 WARNING(cdev, "obex ttyGS%d: can't prevent enumeration, %d\n",
387 obex->port_num, status);
388 else
389 obex->can_activate = true;
390
391
Richard Leitnerb8b0ea52014-08-21 08:31:39 +0200392 dev_dbg(&cdev->gadget->dev, "obex ttyGS%d: %s speed IN/%s OUT/%s\n",
393 obex->port_num,
394 gadget_is_dualspeed(c->cdev->gadget) ? "dual" : "full",
395 obex->port.in->name, obex->port.out->name);
Felipe Balbi30867752008-08-18 17:39:30 -0700396
397 return 0;
398
399fail:
400 /* we might as well release our claims on endpoints */
401 if (obex->port.out)
402 obex->port.out->driver_data = NULL;
403 if (obex->port.in)
404 obex->port.in->driver_data = NULL;
405
406 ERROR(cdev, "%s/%p: can't bind, err %d\n", f->name, f, status);
407
408 return status;
409}
410
Andrzej Pietrasiewiczecfd3f72013-03-27 12:13:25 +0100411static inline struct f_serial_opts *to_f_serial_opts(struct config_item *item)
412{
413 return container_of(to_config_group(item), struct f_serial_opts,
414 func_inst.group);
415}
416
417CONFIGFS_ATTR_STRUCT(f_serial_opts);
418static ssize_t f_obex_attr_show(struct config_item *item,
419 struct configfs_attribute *attr,
420 char *page)
421{
422 struct f_serial_opts *opts = to_f_serial_opts(item);
423 struct f_serial_opts_attribute *f_serial_opts_attr =
424 container_of(attr, struct f_serial_opts_attribute, attr);
425 ssize_t ret = 0;
426
427 if (f_serial_opts_attr->show)
428 ret = f_serial_opts_attr->show(opts, page);
429
430 return ret;
431}
432
433static void obex_attr_release(struct config_item *item)
434{
435 struct f_serial_opts *opts = to_f_serial_opts(item);
436
437 usb_put_function_instance(&opts->func_inst);
438}
439
440static struct configfs_item_operations obex_item_ops = {
441 .release = obex_attr_release,
442 .show_attribute = f_obex_attr_show,
443};
444
445static ssize_t f_obex_port_num_show(struct f_serial_opts *opts, char *page)
446{
447 return sprintf(page, "%u\n", opts->port_num);
448}
449
450static struct f_serial_opts_attribute f_obex_port_num =
451 __CONFIGFS_ATTR_RO(port_num, f_obex_port_num_show);
452
453static struct configfs_attribute *acm_attrs[] = {
454 &f_obex_port_num.attr,
455 NULL,
456};
457
458static struct config_item_type obex_func_type = {
459 .ct_item_ops = &obex_item_ops,
460 .ct_attrs = acm_attrs,
461 .ct_owner = THIS_MODULE,
462};
463
Andrzej Pietrasiewicz1d8fc252013-03-21 15:33:42 +0100464static void obex_free_inst(struct usb_function_instance *f)
465{
466 struct f_serial_opts *opts;
467
468 opts = container_of(f, struct f_serial_opts, func_inst);
469 gserial_free_line(opts->port_num);
470 kfree(opts);
471}
472
473static struct usb_function_instance *obex_alloc_inst(void)
474{
475 struct f_serial_opts *opts;
476 int ret;
477
478 opts = kzalloc(sizeof(*opts), GFP_KERNEL);
479 if (!opts)
480 return ERR_PTR(-ENOMEM);
481
482 opts->func_inst.free_func_inst = obex_free_inst;
483 ret = gserial_alloc_line(&opts->port_num);
484 if (ret) {
485 kfree(opts);
486 return ERR_PTR(ret);
487 }
Andrzej Pietrasiewiczecfd3f72013-03-27 12:13:25 +0100488 config_group_init_type_name(&opts->func_inst.group, "",
489 &obex_func_type);
Andrzej Pietrasiewicz1d8fc252013-03-21 15:33:42 +0100490
491 return &opts->func_inst;
492}
493
494static void obex_free(struct usb_function *f)
495{
496 struct f_obex *obex;
497
498 obex = func_to_obex(f);
499 kfree(obex);
500}
501
502static void obex_unbind(struct usb_configuration *c, struct usb_function *f)
503{
Andrzej Pietrasiewicz1d8fc252013-03-21 15:33:42 +0100504 usb_free_all_descriptors(f);
505}
506
Jingoo Han9272fe52013-12-16 18:43:50 +0900507static struct usb_function *obex_alloc(struct usb_function_instance *fi)
Andrzej Pietrasiewicz1d8fc252013-03-21 15:33:42 +0100508{
509 struct f_obex *obex;
510 struct f_serial_opts *opts;
511
512 /* allocate and initialize one new instance */
513 obex = kzalloc(sizeof(*obex), GFP_KERNEL);
514 if (!obex)
515 return ERR_PTR(-ENOMEM);
516
517 opts = container_of(fi, struct f_serial_opts, func_inst);
518
519 obex->port_num = opts->port_num;
520
521 obex->port.connect = obex_connect;
522 obex->port.disconnect = obex_disconnect;
523
524 obex->port.func.name = "obex";
Andrzej Pietrasiewicz1d8fc252013-03-21 15:33:42 +0100525 /* descriptors are per-instance copies */
526 obex->port.func.bind = obex_bind;
527 obex->port.func.unbind = obex_unbind;
528 obex->port.func.set_alt = obex_set_alt;
529 obex->port.func.get_alt = obex_get_alt;
530 obex->port.func.disable = obex_disable;
531 obex->port.func.free_func = obex_free;
532
533 return &obex->port.func;
534}
535
536DECLARE_USB_FUNCTION_INIT(obex, obex_alloc_inst, obex_alloc);
Felipe Balbi30867752008-08-18 17:39:30 -0700537MODULE_AUTHOR("Felipe Balbi");
538MODULE_LICENSE("GPL");