// SPDX-License-Identifier: GPL-2.0-or-later /* * USB network interface driver for Samsung Kalmia based LTE USB modem like the * Samsung GT-B3730 and GT-B3710. * * Copyright (C) 2011 Marius Bjoernstad Kotsbak <[email protected]> * * Sponsored by Quicklink Video Distribution Services Ltd. * * Based on the cdc_eem module. */ #include <linux/module.h> #include <linux/netdevice.h> #include <linux/etherdevice.h> #include <linux/ctype.h> #include <linux/ethtool.h> #include <linux/workqueue.h> #include <linux/mii.h> #include <linux/usb.h> #include <linux/crc32.h> #include <linux/usb/cdc.h> #include <linux/usb/usbnet.h> #include <linux/gfp.h> /* * The Samsung Kalmia based LTE USB modems have a CDC ACM port for modem control * handled by the "option" module and an ethernet data port handled by this * module. * * The stick must first be switched into modem mode by usb_modeswitch * or similar tool. Then the modem gets sent two initialization packets by * this module, which gives the MAC address of the device. User space can then * connect the modem using AT commands through the ACM port and then use * DHCP on the network interface exposed by this module. Network packets are * sent to and from the modem in a proprietary format discovered after watching * the behavior of the windows driver for the modem. * * More information about the use of the modem is available in usb_modeswitch * forum and the project page: * * http://www.draisberghof.de/usb_modeswitch/bb/viewtopic.php?t=465 * https://github.com/mkotsbak/Samsung-GT-B3730-linux-driver */ /* #define DEBUG */ /* #define VERBOSE */ #define KALMIA_HEADER_LENGTH … #define KALMIA_ALIGN_SIZE … #define KALMIA_USB_TIMEOUT … /*-------------------------------------------------------------------------*/ static int kalmia_send_init_packet(struct usbnet *dev, u8 *init_msg, u8 init_msg_len, u8 *buffer, u8 expected_len) { … } static int kalmia_init_and_get_ethernet_addr(struct usbnet *dev, u8 *ethernet_addr) { … } static int kalmia_bind(struct usbnet *dev, struct usb_interface *intf) { … } static struct sk_buff * kalmia_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags) { … } static int kalmia_rx_fixup(struct usbnet *dev, struct sk_buff *skb) { … } static const struct driver_info kalmia_info = …; /*-------------------------------------------------------------------------*/ static const struct usb_device_id products[] = …; MODULE_DEVICE_TABLE( usb, products); static struct usb_driver kalmia_driver = …; module_usb_driver(…) …; MODULE_AUTHOR(…) …; MODULE_DESCRIPTION(…) …; MODULE_LICENSE(…) …;