1 /* CAN driver for Geschwister Schneider USB/CAN devices
2 * and bytewerk.org candleLight USB CAN interfaces.
4 * Copyright (C) 2013-2016 Geschwister Schneider Technologie-,
5 * Entwicklungs- und Vertriebs UG (Haftungsbeschränkt).
6 * Copyright (C) 2016 Hubert Denkmair
8 * Many thanks to all socketcan devs!
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published
12 * by the Free Software Foundation; version 2 of the License.
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
20 #include <linux/init.h>
21 #include <linux/signal.h>
22 #include <linux/module.h>
23 #include <linux/netdevice.h>
24 #include <linux/usb.h>
26 #include <linux/can.h>
27 #include <linux/can/dev.h>
28 #include <linux/can/error.h>
30 /* Device specific constants */
31 #define USB_GSUSB_1_VENDOR_ID 0x1d50
32 #define USB_GSUSB_1_PRODUCT_ID 0x606f
34 #define USB_CANDLELIGHT_VENDOR_ID 0x1209
35 #define USB_CANDLELIGHT_PRODUCT_ID 0x2323
37 #define GSUSB_ENDPOINT_IN 1
38 #define GSUSB_ENDPOINT_OUT 2
40 /* Device specific constants */
42 GS_USB_BREQ_HOST_FORMAT = 0,
43 GS_USB_BREQ_BITTIMING,
47 GS_USB_BREQ_DEVICE_CONFIG
51 /* reset a channel. turns it off */
52 GS_CAN_MODE_RESET = 0,
53 /* starts a channel */
58 GS_CAN_STATE_ERROR_ACTIVE = 0,
59 GS_CAN_STATE_ERROR_WARNING,
60 GS_CAN_STATE_ERROR_PASSIVE,
66 /* data types passed between host and device */
67 struct gs_host_config {
70 /* All data exchanged between host and device is exchanged in host byte order,
71 * thanks to the struct gs_host_config byte_order member, which is sent first
72 * to indicate the desired byte order.
75 struct gs_device_config {
84 #define GS_CAN_MODE_NORMAL 0
85 #define GS_CAN_MODE_LISTEN_ONLY (1<<0)
86 #define GS_CAN_MODE_LOOP_BACK (1<<1)
87 #define GS_CAN_MODE_TRIPLE_SAMPLE (1<<2)
88 #define GS_CAN_MODE_ONE_SHOT (1<<3)
90 struct gs_device_mode {
95 struct gs_device_state {
101 struct gs_device_bittiming {
109 #define GS_CAN_FEATURE_LISTEN_ONLY (1<<0)
110 #define GS_CAN_FEATURE_LOOP_BACK (1<<1)
111 #define GS_CAN_FEATURE_TRIPLE_SAMPLE (1<<2)
112 #define GS_CAN_FEATURE_ONE_SHOT (1<<3)
114 struct gs_device_bt_const {
127 #define GS_CAN_FLAG_OVERFLOW 1
129 struct gs_host_frame {
140 /* The GS USB devices make use of the same flags and masks as in
141 * linux/can.h and linux/can/error.h, and no additional mapping is necessary.
144 /* Only send a max of GS_MAX_TX_URBS frames per channel at a time. */
145 #define GS_MAX_TX_URBS 10
146 /* Only launch a max of GS_MAX_RX_URBS usb requests at a time. */
147 #define GS_MAX_RX_URBS 30
148 /* Maximum number of interfaces the driver supports per device.
149 * Current hardware only supports 2 interfaces. The future may vary.
151 #define GS_MAX_INTF 2
153 struct gs_tx_context {
155 unsigned int echo_id;
159 struct can_priv can; /* must be the first member */
161 struct gs_usb *parent;
163 struct net_device *netdev;
164 struct usb_device *udev;
165 struct usb_interface *iface;
167 struct can_bittiming_const bt_const;
168 unsigned int channel; /* channel number */
170 /* This lock prevents a race condition between xmit and receive. */
171 spinlock_t tx_ctx_lock;
172 struct gs_tx_context tx_context[GS_MAX_TX_URBS];
174 struct usb_anchor tx_submitted;
175 atomic_t active_tx_urbs;
178 /* usb interface struct */
180 struct gs_can *canch[GS_MAX_INTF];
181 struct usb_anchor rx_submitted;
182 atomic_t active_channels;
183 struct usb_device *udev;
186 /* 'allocate' a tx context.
187 * returns a valid tx context or NULL if there is no space.
189 static struct gs_tx_context *gs_alloc_tx_context(struct gs_can *dev)
194 spin_lock_irqsave(&dev->tx_ctx_lock, flags);
196 for (; i < GS_MAX_TX_URBS; i++) {
197 if (dev->tx_context[i].echo_id == GS_MAX_TX_URBS) {
198 dev->tx_context[i].echo_id = i;
199 spin_unlock_irqrestore(&dev->tx_ctx_lock, flags);
200 return &dev->tx_context[i];
204 spin_unlock_irqrestore(&dev->tx_ctx_lock, flags);
208 /* releases a tx context
210 static void gs_free_tx_context(struct gs_tx_context *txc)
212 txc->echo_id = GS_MAX_TX_URBS;
215 /* Get a tx context by id.
217 static struct gs_tx_context *gs_get_tx_context(struct gs_can *dev, unsigned int id)
221 if (id < GS_MAX_TX_URBS) {
222 spin_lock_irqsave(&dev->tx_ctx_lock, flags);
223 if (dev->tx_context[id].echo_id == id) {
224 spin_unlock_irqrestore(&dev->tx_ctx_lock, flags);
225 return &dev->tx_context[id];
227 spin_unlock_irqrestore(&dev->tx_ctx_lock, flags);
232 static int gs_cmd_reset(struct gs_usb *gsusb, struct gs_can *gsdev)
234 struct gs_device_mode *dm;
235 struct usb_interface *intf = gsdev->iface;
238 dm = kzalloc(sizeof(*dm), GFP_KERNEL);
242 dm->mode = GS_CAN_MODE_RESET;
244 rc = usb_control_msg(interface_to_usbdev(intf),
245 usb_sndctrlpipe(interface_to_usbdev(intf), 0),
247 USB_DIR_OUT|USB_TYPE_VENDOR|USB_RECIP_INTERFACE,
257 static void gs_update_state(struct gs_can *dev, struct can_frame *cf)
259 struct can_device_stats *can_stats = &dev->can.can_stats;
261 if (cf->can_id & CAN_ERR_RESTARTED) {
262 dev->can.state = CAN_STATE_ERROR_ACTIVE;
263 can_stats->restarts++;
264 } else if (cf->can_id & CAN_ERR_BUSOFF) {
265 dev->can.state = CAN_STATE_BUS_OFF;
266 can_stats->bus_off++;
267 } else if (cf->can_id & CAN_ERR_CRTL) {
268 if ((cf->data[1] & CAN_ERR_CRTL_TX_WARNING) ||
269 (cf->data[1] & CAN_ERR_CRTL_RX_WARNING)) {
270 dev->can.state = CAN_STATE_ERROR_WARNING;
271 can_stats->error_warning++;
272 } else if ((cf->data[1] & CAN_ERR_CRTL_TX_PASSIVE) ||
273 (cf->data[1] & CAN_ERR_CRTL_RX_PASSIVE)) {
274 dev->can.state = CAN_STATE_ERROR_PASSIVE;
275 can_stats->error_passive++;
277 dev->can.state = CAN_STATE_ERROR_ACTIVE;
282 static void gs_usb_receive_bulk_callback(struct urb *urb)
284 struct gs_usb *usbcan = urb->context;
286 struct net_device *netdev;
288 struct net_device_stats *stats;
289 struct gs_host_frame *hf = urb->transfer_buffer;
290 struct gs_tx_context *txc;
291 struct can_frame *cf;
296 switch (urb->status) {
297 case 0: /* success */
303 /* do not resubmit aborted urbs. eg: when device goes down */
307 /* device reports out of range channel id */
308 if (hf->channel >= GS_MAX_INTF)
311 dev = usbcan->canch[hf->channel];
313 netdev = dev->netdev;
314 stats = &netdev->stats;
316 if (!netif_device_present(netdev))
319 if (hf->echo_id == -1) { /* normal rx */
320 skb = alloc_can_skb(dev->netdev, &cf);
324 cf->can_id = hf->can_id;
326 cf->can_dlc = get_can_dlc(hf->can_dlc);
327 memcpy(cf->data, hf->data, 8);
329 /* ERROR frames tell us information about the controller */
330 if (hf->can_id & CAN_ERR_FLAG)
331 gs_update_state(dev, cf);
333 netdev->stats.rx_packets++;
334 netdev->stats.rx_bytes += hf->can_dlc;
337 } else { /* echo_id == hf->echo_id */
338 if (hf->echo_id >= GS_MAX_TX_URBS) {
340 "Unexpected out of range echo id %d\n",
345 netdev->stats.tx_packets++;
346 netdev->stats.tx_bytes += hf->can_dlc;
348 txc = gs_get_tx_context(dev, hf->echo_id);
350 /* bad devices send bad echo_ids. */
353 "Unexpected unused echo id %d\n",
358 can_get_echo_skb(netdev, hf->echo_id);
360 gs_free_tx_context(txc);
362 netif_wake_queue(netdev);
365 if (hf->flags & GS_CAN_FLAG_OVERFLOW) {
366 skb = alloc_can_err_skb(netdev, &cf);
370 cf->can_id |= CAN_ERR_CRTL;
371 cf->can_dlc = CAN_ERR_DLC;
372 cf->data[1] = CAN_ERR_CRTL_RX_OVERFLOW;
373 stats->rx_over_errors++;
379 usb_fill_bulk_urb(urb,
381 usb_rcvbulkpipe(usbcan->udev, GSUSB_ENDPOINT_IN),
383 sizeof(struct gs_host_frame),
384 gs_usb_receive_bulk_callback,
388 rc = usb_submit_urb(urb, GFP_ATOMIC);
390 /* USB failure take down all interfaces */
392 for (rc = 0; rc < GS_MAX_INTF; rc++) {
393 if (usbcan->canch[rc])
394 netif_device_detach(usbcan->canch[rc]->netdev);
399 static int gs_usb_set_bittiming(struct net_device *netdev)
401 struct gs_can *dev = netdev_priv(netdev);
402 struct can_bittiming *bt = &dev->can.bittiming;
403 struct usb_interface *intf = dev->iface;
405 struct gs_device_bittiming *dbt;
407 dbt = kmalloc(sizeof(*dbt), GFP_KERNEL);
411 dbt->prop_seg = bt->prop_seg;
412 dbt->phase_seg1 = bt->phase_seg1;
413 dbt->phase_seg2 = bt->phase_seg2;
417 /* request bit timings */
418 rc = usb_control_msg(interface_to_usbdev(intf),
419 usb_sndctrlpipe(interface_to_usbdev(intf), 0),
420 GS_USB_BREQ_BITTIMING,
421 USB_DIR_OUT|USB_TYPE_VENDOR|USB_RECIP_INTERFACE,
431 dev_err(netdev->dev.parent, "Couldn't set bittimings (err=%d)",
437 static void gs_usb_xmit_callback(struct urb *urb)
439 struct gs_tx_context *txc = urb->context;
440 struct gs_can *dev = txc->dev;
441 struct net_device *netdev = dev->netdev;
444 netdev_info(netdev, "usb xmit fail %d\n", txc->echo_id);
446 usb_free_coherent(urb->dev,
447 urb->transfer_buffer_length,
448 urb->transfer_buffer,
451 atomic_dec(&dev->active_tx_urbs);
453 if (!netif_device_present(netdev))
456 if (netif_queue_stopped(netdev))
457 netif_wake_queue(netdev);
460 static netdev_tx_t gs_can_start_xmit(struct sk_buff *skb, struct net_device *netdev)
462 struct gs_can *dev = netdev_priv(netdev);
463 struct net_device_stats *stats = &dev->netdev->stats;
465 struct gs_host_frame *hf;
466 struct can_frame *cf;
469 struct gs_tx_context *txc;
471 if (can_dropped_invalid_skb(netdev, skb))
474 /* find an empty context to keep track of transmission */
475 txc = gs_alloc_tx_context(dev);
477 return NETDEV_TX_BUSY;
479 /* create a URB, and a buffer for it */
480 urb = usb_alloc_urb(0, GFP_ATOMIC);
482 netdev_err(netdev, "No memory left for URB\n");
486 hf = usb_alloc_coherent(dev->udev, sizeof(*hf), GFP_ATOMIC,
489 netdev_err(netdev, "No memory left for USB buffer\n");
495 if (idx >= GS_MAX_TX_URBS) {
496 netdev_err(netdev, "Invalid tx context %d\n", idx);
501 hf->channel = dev->channel;
503 cf = (struct can_frame *)skb->data;
505 hf->can_id = cf->can_id;
506 hf->can_dlc = cf->can_dlc;
507 memcpy(hf->data, cf->data, cf->can_dlc);
509 usb_fill_bulk_urb(urb, dev->udev,
510 usb_sndbulkpipe(dev->udev, GSUSB_ENDPOINT_OUT),
513 gs_usb_xmit_callback,
516 urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
517 usb_anchor_urb(urb, &dev->tx_submitted);
519 can_put_echo_skb(skb, netdev, idx);
521 atomic_inc(&dev->active_tx_urbs);
523 rc = usb_submit_urb(urb, GFP_ATOMIC);
524 if (unlikely(rc)) { /* usb send failed */
525 atomic_dec(&dev->active_tx_urbs);
527 can_free_echo_skb(netdev, idx);
528 gs_free_tx_context(txc);
530 usb_unanchor_urb(urb);
531 usb_free_coherent(dev->udev,
538 netif_device_detach(netdev);
540 netdev_err(netdev, "usb_submit failed (err=%d)\n", rc);
544 /* Slow down tx path */
545 if (atomic_read(&dev->active_tx_urbs) >= GS_MAX_TX_URBS)
546 netif_stop_queue(netdev);
549 /* let usb core take care of this urb */
555 usb_free_coherent(dev->udev,
563 gs_free_tx_context(txc);
569 static int gs_can_open(struct net_device *netdev)
571 struct gs_can *dev = netdev_priv(netdev);
572 struct gs_usb *parent = dev->parent;
574 struct gs_device_mode *dm;
577 rc = open_candev(netdev);
581 if (atomic_add_return(1, &parent->active_channels) == 1) {
582 for (i = 0; i < GS_MAX_RX_URBS; i++) {
587 urb = usb_alloc_urb(0, GFP_KERNEL);
590 "No memory left for URB\n");
594 /* alloc rx buffer */
595 buf = usb_alloc_coherent(dev->udev,
596 sizeof(struct gs_host_frame),
601 "No memory left for USB buffer\n");
606 /* fill, anchor, and submit rx urb */
607 usb_fill_bulk_urb(urb,
609 usb_rcvbulkpipe(dev->udev,
612 sizeof(struct gs_host_frame),
613 gs_usb_receive_bulk_callback,
615 urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
617 usb_anchor_urb(urb, &parent->rx_submitted);
619 rc = usb_submit_urb(urb, GFP_KERNEL);
622 netif_device_detach(dev->netdev);
625 "usb_submit failed (err=%d)\n",
628 usb_unanchor_urb(urb);
633 * USB core will take care of freeing it
639 dm = kmalloc(sizeof(*dm), GFP_KERNEL);
644 ctrlmode = dev->can.ctrlmode;
647 if (ctrlmode & CAN_CTRLMODE_LOOPBACK)
648 dm->flags |= GS_CAN_MODE_LOOP_BACK;
649 else if (ctrlmode & CAN_CTRLMODE_LISTENONLY)
650 dm->flags |= GS_CAN_MODE_LISTEN_ONLY;
652 /* Controller is not allowed to retry TX
653 * this mode is unavailable on atmels uc3c hardware
655 if (ctrlmode & CAN_CTRLMODE_ONE_SHOT)
656 dm->flags |= GS_CAN_MODE_ONE_SHOT;
658 if (ctrlmode & CAN_CTRLMODE_3_SAMPLES)
659 dm->flags |= GS_CAN_MODE_TRIPLE_SAMPLE;
661 /* finally start device */
662 dm->mode = GS_CAN_MODE_START;
663 rc = usb_control_msg(interface_to_usbdev(dev->iface),
664 usb_sndctrlpipe(interface_to_usbdev(dev->iface), 0),
666 USB_DIR_OUT|USB_TYPE_VENDOR|USB_RECIP_INTERFACE,
674 netdev_err(netdev, "Couldn't start device (err=%d)\n", rc);
681 dev->can.state = CAN_STATE_ERROR_ACTIVE;
683 if (!(dev->can.ctrlmode & CAN_CTRLMODE_LISTENONLY))
684 netif_start_queue(netdev);
689 static int gs_can_close(struct net_device *netdev)
692 struct gs_can *dev = netdev_priv(netdev);
693 struct gs_usb *parent = dev->parent;
695 netif_stop_queue(netdev);
698 if (atomic_dec_and_test(&parent->active_channels))
699 usb_kill_anchored_urbs(&parent->rx_submitted);
701 /* Stop sending URBs */
702 usb_kill_anchored_urbs(&dev->tx_submitted);
703 atomic_set(&dev->active_tx_urbs, 0);
705 /* reset the device */
706 rc = gs_cmd_reset(parent, dev);
708 netdev_warn(netdev, "Couldn't shutdown device (err=%d)", rc);
710 /* reset tx contexts */
711 for (rc = 0; rc < GS_MAX_TX_URBS; rc++) {
712 dev->tx_context[rc].dev = dev;
713 dev->tx_context[rc].echo_id = GS_MAX_TX_URBS;
716 /* close the netdev */
717 close_candev(netdev);
722 static const struct net_device_ops gs_usb_netdev_ops = {
723 .ndo_open = gs_can_open,
724 .ndo_stop = gs_can_close,
725 .ndo_start_xmit = gs_can_start_xmit,
726 .ndo_change_mtu = can_change_mtu,
729 static struct gs_can *gs_make_candev(unsigned int channel, struct usb_interface *intf)
732 struct net_device *netdev;
734 struct gs_device_bt_const *bt_const;
736 bt_const = kmalloc(sizeof(*bt_const), GFP_KERNEL);
738 return ERR_PTR(-ENOMEM);
740 /* fetch bit timing constants */
741 rc = usb_control_msg(interface_to_usbdev(intf),
742 usb_rcvctrlpipe(interface_to_usbdev(intf), 0),
743 GS_USB_BREQ_BT_CONST,
744 USB_DIR_IN|USB_TYPE_VENDOR|USB_RECIP_INTERFACE,
753 "Couldn't get bit timing const for channel (err=%d)\n",
760 netdev = alloc_candev(sizeof(struct gs_can), GS_MAX_TX_URBS);
762 dev_err(&intf->dev, "Couldn't allocate candev\n");
764 return ERR_PTR(-ENOMEM);
767 dev = netdev_priv(netdev);
769 netdev->netdev_ops = &gs_usb_netdev_ops;
771 netdev->flags |= IFF_ECHO; /* we support full roundtrip echo */
774 strcpy(dev->bt_const.name, "gs_usb");
775 dev->bt_const.tseg1_min = bt_const->tseg1_min;
776 dev->bt_const.tseg1_max = bt_const->tseg1_max;
777 dev->bt_const.tseg2_min = bt_const->tseg2_min;
778 dev->bt_const.tseg2_max = bt_const->tseg2_max;
779 dev->bt_const.sjw_max = bt_const->sjw_max;
780 dev->bt_const.brp_min = bt_const->brp_min;
781 dev->bt_const.brp_max = bt_const->brp_max;
782 dev->bt_const.brp_inc = bt_const->brp_inc;
784 dev->udev = interface_to_usbdev(intf);
786 dev->netdev = netdev;
787 dev->channel = channel;
789 init_usb_anchor(&dev->tx_submitted);
790 atomic_set(&dev->active_tx_urbs, 0);
791 spin_lock_init(&dev->tx_ctx_lock);
792 for (rc = 0; rc < GS_MAX_TX_URBS; rc++) {
793 dev->tx_context[rc].dev = dev;
794 dev->tx_context[rc].echo_id = GS_MAX_TX_URBS;
798 dev->can.state = CAN_STATE_STOPPED;
799 dev->can.clock.freq = bt_const->fclk_can;
800 dev->can.bittiming_const = &dev->bt_const;
801 dev->can.do_set_bittiming = gs_usb_set_bittiming;
803 dev->can.ctrlmode_supported = 0;
805 if (bt_const->feature & GS_CAN_FEATURE_LISTEN_ONLY)
806 dev->can.ctrlmode_supported |= CAN_CTRLMODE_LISTENONLY;
808 if (bt_const->feature & GS_CAN_FEATURE_LOOP_BACK)
809 dev->can.ctrlmode_supported |= CAN_CTRLMODE_LOOPBACK;
811 if (bt_const->feature & GS_CAN_FEATURE_TRIPLE_SAMPLE)
812 dev->can.ctrlmode_supported |= CAN_CTRLMODE_3_SAMPLES;
814 if (bt_const->feature & GS_CAN_FEATURE_ONE_SHOT)
815 dev->can.ctrlmode_supported |= CAN_CTRLMODE_ONE_SHOT;
819 SET_NETDEV_DEV(netdev, &intf->dev);
821 rc = register_candev(dev->netdev);
823 free_candev(dev->netdev);
824 dev_err(&intf->dev, "Couldn't register candev (err=%d)\n", rc);
831 static void gs_destroy_candev(struct gs_can *dev)
833 unregister_candev(dev->netdev);
834 usb_kill_anchored_urbs(&dev->tx_submitted);
835 free_candev(dev->netdev);
838 static int gs_usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
842 unsigned int icount, i;
843 struct gs_host_config *hconf;
844 struct gs_device_config *dconf;
846 hconf = kmalloc(sizeof(*hconf), GFP_KERNEL);
850 hconf->byte_order = 0x0000beef;
852 /* send host config */
853 rc = usb_control_msg(interface_to_usbdev(intf),
854 usb_sndctrlpipe(interface_to_usbdev(intf), 0),
855 GS_USB_BREQ_HOST_FORMAT,
856 USB_DIR_OUT|USB_TYPE_VENDOR|USB_RECIP_INTERFACE,
858 intf->altsetting[0].desc.bInterfaceNumber,
866 dev_err(&intf->dev, "Couldn't send data format (err=%d)\n",
871 dconf = kmalloc(sizeof(*dconf), GFP_KERNEL);
875 /* read device config */
876 rc = usb_control_msg(interface_to_usbdev(intf),
877 usb_rcvctrlpipe(interface_to_usbdev(intf), 0),
878 GS_USB_BREQ_DEVICE_CONFIG,
879 USB_DIR_IN|USB_TYPE_VENDOR|USB_RECIP_INTERFACE,
881 intf->altsetting[0].desc.bInterfaceNumber,
886 dev_err(&intf->dev, "Couldn't get device config: (err=%d)\n",
894 icount = dconf->icount+1;
898 dev_info(&intf->dev, "Configuring for %d interfaces\n", icount);
900 if (icount > GS_MAX_INTF) {
902 "Driver cannot handle more that %d CAN interfaces\n",
907 dev = kzalloc(sizeof(*dev), GFP_KERNEL);
910 init_usb_anchor(&dev->rx_submitted);
912 atomic_set(&dev->active_channels, 0);
914 usb_set_intfdata(intf, dev);
915 dev->udev = interface_to_usbdev(intf);
917 for (i = 0; i < icount; i++) {
918 dev->canch[i] = gs_make_candev(i, intf);
919 if (IS_ERR_OR_NULL(dev->canch[i])) {
920 /* save error code to return later */
921 rc = PTR_ERR(dev->canch[i]);
923 /* on failure destroy previously created candevs */
925 for (i = 0; i < icount; i++)
926 gs_destroy_candev(dev->canch[i]);
928 usb_kill_anchored_urbs(&dev->rx_submitted);
932 dev->canch[i]->parent = dev;
938 static void gs_usb_disconnect(struct usb_interface *intf)
941 struct gs_usb *dev = usb_get_intfdata(intf);
942 usb_set_intfdata(intf, NULL);
945 dev_err(&intf->dev, "Disconnect (nodata)\n");
949 for (i = 0; i < GS_MAX_INTF; i++)
951 gs_destroy_candev(dev->canch[i]);
953 usb_kill_anchored_urbs(&dev->rx_submitted);
957 static const struct usb_device_id gs_usb_table[] = {
958 { USB_DEVICE_INTERFACE_NUMBER(USB_GSUSB_1_VENDOR_ID,
959 USB_GSUSB_1_PRODUCT_ID, 0) },
960 { USB_DEVICE_INTERFACE_NUMBER(USB_CANDLELIGHT_VENDOR_ID,
961 USB_CANDLELIGHT_PRODUCT_ID, 0) },
962 {} /* Terminating entry */
965 MODULE_DEVICE_TABLE(usb, gs_usb_table);
967 static struct usb_driver gs_usb_driver = {
969 .probe = gs_usb_probe,
970 .disconnect = gs_usb_disconnect,
971 .id_table = gs_usb_table,
974 module_usb_driver(gs_usb_driver);
976 MODULE_AUTHOR("Maximilian Schneider <mws@schneidersoft.net>");
978 "Socket CAN device driver for Geschwister Schneider Technologie-, "
979 "Entwicklungs- und Vertriebs UG. USB2.0 to CAN interfaces\n"
980 "and bytewerk.org candleLight USB CAN interfaces.");
981 MODULE_LICENSE("GPL v2");