Device side of canqueue, compilation successful
authorJan Kriz <krizj1@fel.cvut.cz>
Mon, 7 Jul 2008 21:46:02 +0000 (23:46 +0200)
committerppisa <pisa@cmp.felk.cvut.cz>
Mon, 7 Jul 2008 21:46:00 +0000 (23:46 +0200)
working not tested/confirmed

embedded/app/usbcan/Makefile.omk
embedded/app/usbcan/can/finish.h [new file with mode: 0644]
embedded/app/usbcan/can/main.h
embedded/app/usbcan/devcommon.c
embedded/app/usbcan/finish.c [new file with mode: 0644]
embedded/app/usbcan/main.c
embedded/app/usbcan/setup.c
embedded/app/usbcan/ul_usb1.c

index 24985a6..e5384e9 100644 (file)
@@ -19,7 +19,7 @@ INCLUDES += -I.
 #include_HEADERS  = ul_idstr.h
 
 bin_PROGRAMS = usbcan
-usbcan_SOURCES = main.c usb_srq.c can.c can_queue.c sja1000p.c can_quesysless.c
+usbcan_SOURCES = main.c usb_srq.c can.c can_queue.c sja1000p.c can_quesysless.c devcommon.c setup.c ul_usb1.c finish.c
 
 #usbtest_SOURCES +=  ul_idstr.c
 #lib_LOADLIBES =  bspbase ul_drv lpciap keyval lpciap_kvpb mach_hal uldy
diff --git a/embedded/app/usbcan/can/finish.h b/embedded/app/usbcan/can/finish.h
new file mode 100644 (file)
index 0000000..87df046
--- /dev/null
@@ -0,0 +1,13 @@
+/* finish.h
+ * Header file for the Linux CAN-bus driver.
+ * Written by Arnaud Westenberg email:arnaud@wanadoo.nl
+ * Rewritten for new CAN queues by Pavel Pisa - OCERA team member
+ * email:pisa@cmp.felk.cvut.cz
+ * This software is released under the GPL-License.
+ * Version lincan-0.3  17 Jun 2004
+ */
+
+void msgobj_done(struct msgobj_t *obj);
+void canchip_done(struct canchip_t *chip);
+void candevice_done(struct candevice_t *candev);
+void canhardware_done(struct canhardware_t *candev);
index 9511d84..4b06a3d 100644 (file)
@@ -392,7 +392,8 @@ extern unsigned long io[MAX_HW_CARDS];
 extern int processlocal;
 
 extern struct canhardware_t *hardware_p;
-extern struct canchip_t *chips_p[MAX_TOT_CHIPS];
+//extern struct canchip_t *chips_p[MAX_TOT_CHIPS];
+struct canchip_t *chips_p[MAX_TOT_CHIPS];
 extern struct msgobj_t *objects_p[MAX_TOT_MSGOBJS];
 
 extern struct mem_addr *mem_head;
index 2af0f86..eada97b 100644 (file)
@@ -6,11 +6,11 @@
  * Version lincan-0.3  17 Jun 2004
  */
 
-#include "../include/can.h"
-#include "../include/can_sysdep.h"
-#include "../include/can_queue.h"
-#include "../include/main.h"
-#include "../include/devcommon.h"
+#include "./can/can.h"
+#include "./can/can_sysdep.h"
+#include "./can/can_queue.h"
+#include "./can/main.h"
+#include "./can/devcommon.h"
 
 #ifdef CAN_WITH_RTL
 static inline
@@ -36,7 +36,7 @@ void canqueue_wake_chip_worker(struct canque_ends_t *qends, struct canchip_t *ch
 /**
  * canqueue_notify_chip - notification callback handler for CAN chips ends of queues
  * @qends: pointer to the callback side ends structure
- * @qedge: edge which invoked notification 
+ * @qedge: edge which invoked notification
  * @what: notification type
  *
  * This function has to deal with more possible cases. It can be called from
@@ -81,7 +81,7 @@ void canqueue_notify_chip(struct canque_ends_t *qends, struct canque_edge_t *qed
                        can_msgobj_set_fl(obj,FILTCH_REQUEST);
                        canqueue_wake_chip_worker(qends, chip, obj);
                    #endif /*CAN_WITH_RTL*/
-                       
+
                        break;
        }
 }
@@ -98,7 +98,7 @@ int canqueue_ends_init_chip(struct canque_ends_t *qends, struct canchip_t *chip,
        int ret;
        ret=canqueue_ends_init_gen(qends);
        if(ret<0) return ret;
-       
+
        qends->context=NULL;
     #ifndef CAN_WITH_RTL
        init_waitqueue_head(&qends->endinfo.chipinfo.daemonq);
@@ -121,7 +121,7 @@ int canqueue_ends_init_chip(struct canque_ends_t *qends, struct canchip_t *chip,
 int canqueue_ends_done_chip(struct canque_ends_t *qends)
 {
        int delayed;
-       
+
        /* Finish or kill all outgoing edges listed in inends */
        delayed=canqueue_ends_kill_inlist(qends, 1);
        /* Kill all incoming edges listed in outends */
diff --git a/embedded/app/usbcan/finish.c b/embedded/app/usbcan/finish.c
new file mode 100644 (file)
index 0000000..fad2c05
--- /dev/null
@@ -0,0 +1,136 @@
+/* finish.c - finalization of the driver operation
+ * Linux CAN-bus device driver.
+ * Written by Arnaud Westenberg email:arnaud@wanadoo.nl
+ * Rewritten for new CAN queues by Pavel Pisa - OCERA team member
+ * email:pisa@cmp.felk.cvut.cz
+ * This software is released under the GPL-License.
+ * Version lincan-0.3  17 Jun 2004
+ */
+
+#include "./can/can.h"
+#include "./can/can_sysless.h"
+#include "./can/main.h"
+#include "./can/devcommon.h"
+#include "./can/finish.h"
+#include "./can/setup.h"
+
+
+/**
+ * msgobj_done - destroys one CAN message object
+ * @obj: pointer to CAN message object structure
+ */
+void msgobj_done(struct msgobj_t *obj)
+{
+       int delayed=0;
+       if(obj->qends) {
+               delayed=canqueue_ends_done_chip(obj->qends);
+               if(delayed < 0)
+                       CANMSG("msgobj_done: problem with chip queue ends\n");
+       }
+
+       if((obj->hostchip) && (obj->object>0)) {
+               if(obj->hostchip->msgobj[obj->object-1] == obj)
+                       obj->hostchip->msgobj[obj->object-1]=NULL;
+               else
+                       CANMSG("msgobj_done: not registered in the canchip_t\n");
+               obj->hostchip=NULL;
+       }
+
+       if((obj->minor>=0)) {
+               if(objects_p[obj->minor] == obj)
+                       objects_p[obj->minor] = NULL;
+               else
+                       CANMSG("msgobj_done: not registered as minor\n");
+       }
+
+//     del_timer_sync(&obj->tx_timeout);
+
+       if(obj->qends) {
+               /*delayed free could be required there in the future,
+                 actual use patter cannot generate such situation*/
+               if(!delayed) {
+                       free(obj->qends);
+               }
+       }
+       obj->qends=NULL;
+}
+
+
+/**
+ * canchip_done - destroys one CAN chip representation
+ * @chip: pointer to CAN chip structure
+ */
+void canchip_done(struct canchip_t *chip)
+{
+
+       int i;
+       struct msgobj_t *obj;
+
+       if(chip->flags & CHIP_ATTACHED)
+               chip->chipspecops->release_chip(chip);
+
+       if((chip->hostdevice) && (chip->chip_idx>=0)) {
+               if(chip->hostdevice->chip[chip->chip_idx] == chip)
+                       chip->hostdevice->chip[chip->chip_idx] = NULL;
+               else
+                       CANMSG("canchip_done: not registered in hostdevice\n");
+       }
+
+// Not using interrupts
+//     can_chip_free_irq(chip);
+
+//     can_synchronize_irq(chip->chip_irq);
+
+       for(i=0; i<chip->max_objects; i++){
+               if((obj=chip->msgobj[i])==NULL)
+                       continue;
+               msgobj_done(obj);
+               free(obj);
+       }
+
+       free(chip->chipspecops);
+       chip->chipspecops=NULL;
+
+}
+
+/**
+ * candevice_done - destroys representation of one CAN device/board
+ * @candev: pointer to CAN device/board structure
+ */
+void candevice_done(struct candevice_t *candev)
+{
+       int i;
+       struct canchip_t *chip;
+
+       for(i=0; i<candev->nr_all_chips; i++){
+               if((chip=candev->chip[i])==NULL)
+                       continue;
+               canchip_done(chip);
+               free(chip);
+
+       }
+       if(candev->flags & CANDEV_IO_RESERVED) {
+               candev->hwspecops->release_io(candev);
+               candev->flags &= ~CANDEV_IO_RESERVED;
+       }
+       free(candev->hwspecops);
+       candev->hwspecops=NULL;
+}
+
+/**
+ * candevice_done - destroys representation of all CAN devices/boards
+ * @canhw: pointer to the root of all CAN hardware representation
+ */
+void canhardware_done(struct canhardware_t *canhw)
+{
+       int i;
+       struct candevice_t *candev;
+
+       for(i=0; i<canhw->nr_boards; i++){
+               if((candev=canhw->candevice[i])==NULL)
+                       continue;
+               candevice_done(candev);
+               free(candev);
+       }
+
+}
index d28cc13..205ae35 100644 (file)
 #include <lpciap.h>
 #include <lpciap_kvpb.h>
 
-#include "can/can.h"
-#include "can/sja1000p.h"
+#include "./can/can.h"
+#include "./can/sja1000p.h"
+#include "./can/main.h"
+
+#include "./can/can_sysdep.h"
+#include "./can/modparms.h"
+#include "./can/devcommon.h"
+
+#include "./can/ul_usb1.h"
+//#include "./can/setup.h"
 
 #define MASK_EP1RX  0x01
 #define MASK_EP1TX  0x02
@@ -53,6 +61,13 @@ volatile uint8_t bootloader_run;
 
 int processlocal;
 
+int baudrate[MAX_TOT_CHIPS];
+struct canhardware_t canhardware;
+struct canhardware_t *hardware_p=&canhardware;
+struct canchip_t *chips_p[MAX_TOT_CHIPS];
+struct msgobj_t *objects_p[MAX_TOT_MSGOBJS];
+
+
 /**
        SOMETHING BAD HAPPENED
 */
@@ -96,6 +111,10 @@ void timer_10ms(void)
 /***********************************/
 int main(void)
 {
+       struct candevice_t *candev;
+       struct canchip_t *chip;
+       int chipnr,bd;
+
 //     volatile int i=0;
        bootloader_run=0;
        /***********************************/
@@ -106,12 +125,79 @@ int main(void)
        SET_OUT_PIN(LED_PORT,LED_ERR);
        CLR_OUT_PIN(LED_PORT,LED_GP);
 
-  //********************
-  // USB init
-  memset( &usb_device, 0, sizeof( usb_device));
-  usb_device.id = 1;
-  usb_device.init = usb_lpc_init;
-  usb_debug_set_level(DEBUG_LEVEL_NONE);
+       /// *************************
+       /// CAN device initialization
+
+       baudrate[0]=1000;
+
+       canqueue_kern_initialize();
+
+       hardware_p->nr_boards=1;
+
+       candev=(struct candevice_t *)malloc(sizeof(struct candevice_t));
+               if (candev==NULL) sys_err();
+               memset(candev, 0, sizeof(struct candevice_t));
+
+       hardware_p->candevice[0]=candev;
+       candev->candev_idx=0;
+       candev->io_addr=0;
+       candev->dev_base_addr=0;
+
+       candev->hwspecops=(struct hwspecops_t *)malloc(sizeof(struct hwspecops_t));
+               if (candev->hwspecops==NULL) sys_err();
+               memset(candev->hwspecops, 0, sizeof(struct hwspecops_t));
+
+       ul_usb1_register(candev->hwspecops);
+
+       bd=baudrate[0];
+       if (candev->hwspecops->init_hw_data(candev)) sys_err();
+       /* Alocate and initialize the chip structures */
+       for (chipnr=0; chipnr < candev->nr_all_chips; chipnr++) {
+/*             if(chipnr<irqnum)
+                       irqsig=irq[*irq_param_idx_p+chipnr];*/
+               if (init_chip_struct(candev, chipnr, 0, bd*1000)) sys_err();
+       }
+       if (candev->hwspecops->request_io(candev))
+               sys_err();
+       candev->flags|=CANDEV_IO_RESERVED;
+       if (candev->hwspecops->reset(candev))
+               sys_err();
+       for(chipnr=0; chipnr<candev->nr_all_chips; chipnr++) {
+               if((chip=candev->chip[chipnr])==NULL)
+                       continue;
+
+               if(chip->chipspecops->attach_to_chip(chip)<0) {
+//                     CANMSG("Initial attach to the chip HW failed\n");
+                       sys_err();
+               }
+
+               chip->flags |= CHIP_ATTACHED;
+
+// Interrupts from chip are served in main cycle
+/*             if(can_chip_setup_irq(chip)<0) {
+//                     CANMSG("Error to setup chip IRQ\n");
+                       sys_err();
+               }*/
+       }
+
+       if (candev->flags & CANDEV_PROGRAMMABLE_IRQ)
+               if (candev->hwspecops->program_irq(candev)){
+//                     CANMSG("Error to program board interrupt\n");
+                       sys_err();
+               }
+
+
+
+       /// ***************************************
+       /// CAN device initialization - client side
+
+       ///*********
+       /// USB init
+
+       memset( &usb_device, 0, sizeof( usb_device));
+       usb_device.id = 1;
+       usb_device.init = usb_lpc_init;
+       usb_debug_set_level(DEBUG_LEVEL_NONE);
        usb_device.cntep = 3;
        usb_device.ep = eps;
 
@@ -126,8 +212,8 @@ int main(void)
 
 //  usb_device.vendor_fnc=usb_loader;
 
-  usb_init(&usb_device);
-  usb_connect(&usb_device);
+       usb_init(&usb_device);
+       usb_connect(&usb_device);
 
        can_init();
        usb_can_send=1;
index 59ab8b5..e046c9b 100644 (file)
@@ -136,25 +136,25 @@ int register_chip_struct(struct canchip_t *chip, int minorbase)
  *
  * Return Value: returns negative number in the case of fail
  */
-int init_hw_struct(void)
-{
-       int i=0;
-       int irq_param_idx=0;
-       int chan_param_idx=0;
-
-       hardware_p->nr_boards=0;
-       while ( (hw[i] != NULL) & (i < MAX_HW_CARDS) ) {
-               hardware_p->nr_boards++;
-
-               if (init_device_struct(i, &chan_param_idx, &irq_param_idx)) {
-                       CANMSG("Error initializing candevice_t structures.\n");
-                       return -ENODEV;
-               }
-               i++;
-       }
-
-       return 0;
-}
+// int init_hw_struct(void)
+// {
+//     int i=0;
+//     int irq_param_idx=0;
+//     int chan_param_idx=0;
+//
+//     hardware_p->nr_boards=0;
+//     while ( (hw[i] != NULL) & (i < MAX_HW_CARDS) ) {
+//             hardware_p->nr_boards++;
+//
+//             if (init_device_struct(i, &chan_param_idx, &irq_param_idx)) {
+//                     CANMSG("Error initializing candevice_t structures.\n");
+//                     return -ENODEV;
+//             }
+//             i++;
+//     }
+//
+//     return 0;
+// }
 
 /**
  * init_device_struct - initializes single CAN device/board
@@ -179,90 +179,90 @@ int init_hw_struct(void)
  *
  * Return Value: returns negative number in the case of fail
  */
-int init_device_struct(int card, int *chan_param_idx_p, int *irq_param_idx_p)
-{
-       struct candevice_t *candev;
-       int ret;
-       int irqnum;
-       int chipnr;
-       long bd;
-       int irqsig=-1;
-
-       candev=(struct candevice_t *)can_checked_malloc(sizeof(struct candevice_t));
-       if (candev==NULL)
-               return -ENOMEM;
-
-        memset(candev, 0, sizeof(struct candevice_t));
-
-       hardware_p->candevice[card]=candev;
-       candev->candev_idx=card;
-
-       candev=candev;
-
-       candev->hwname=hw[card];
-       candev->io_addr=io[card];
-       candev->dev_base_addr=io[card];
-
-       candev->hwspecops=(struct hwspecops_t *)can_checked_malloc(sizeof(struct hwspecops_t));
-       if (candev->hwspecops==NULL)
-               goto error_nomem;
-
-       memset(candev->hwspecops, 0, sizeof(struct hwspecops_t));
-
-       if (init_hwspecops(candev, &irqnum))
-               goto error_nodev;
-
-       if (candev->hwspecops->init_hw_data(candev))
-               goto error_nodev;
-
-       /* Alocate and initialize the chip structures */
-       for (chipnr=0; chipnr < candev->nr_all_chips; chipnr++) {
-
-               if(chipnr<irqnum)
-                       irqsig=irq[*irq_param_idx_p+chipnr];
-
-               bd=baudrate[*chan_param_idx_p+chipnr];
-               if(!bd) bd=baudrate[0];
-
-               if ((ret=init_chip_struct(candev, chipnr, irqsig, bd*1000)))
-                       goto error_chip;
-       }
-
-
-
-       for (chipnr=0; chipnr < candev->nr_all_chips; chipnr++) {
-               int m=minor[*chan_param_idx_p+chipnr];
-               struct canchip_t *chip=candev->chip[chipnr];
-               int objnr;
-
-               register_chip_struct(chip, m);
-
-               for (objnr=0; objnr<chip->max_objects; objnr++) {
-                       register_obj_struct(chip->msgobj[objnr], m);
-                       if(m>=0) m++;
-               }
-       }
-
-       *irq_param_idx_p += irqnum;
-       *chan_param_idx_p += candev->nr_all_chips;
-
-       return 0;
-
-    error_nodev:
-       ret=-ENODEV;
-    error_chip:
-       candevice_done(candev);
-       goto error_both;
-
-    error_nomem:
-       ret=-ENOMEM;
-
-    error_both:
-       hardware_p->candevice[card]=NULL;
-       can_checked_free(candev);
-       return ret;
-
-}
+// int init_device_struct(int card, int *chan_param_idx_p, int *irq_param_idx_p)
+// {
+//     struct candevice_t *candev;
+//     int ret;
+//     int irqnum;
+//     int chipnr;
+//     long bd;
+//     int irqsig=-1;
+//
+//     candev=(struct candevice_t *)malloc(sizeof(struct candevice_t));
+//     if (candev==NULL)
+//             return -ENOMEM;
+//
+//         memset(candev, 0, sizeof(struct candevice_t));
+//
+//     hardware_p->candevice[card]=candev;
+//     candev->candev_idx=card;
+//
+//     candev=candev;
+//
+//     candev->hwname=hw[card];
+//     candev->io_addr=io[card];
+//     candev->dev_base_addr=io[card];
+//
+//     candev->hwspecops=(struct hwspecops_t *)malloc(sizeof(struct hwspecops_t));
+//     if (candev->hwspecops==NULL)
+//             goto error_nomem;
+//
+//     memset(candev->hwspecops, 0, sizeof(struct hwspecops_t));
+//
+//     if (init_hwspecops(candev, &irqnum))
+//             goto error_nodev;
+//
+//     if (candev->hwspecops->init_hw_data(candev))
+//             goto error_nodev;
+//
+//     /* Alocate and initialize the chip structures */
+//     for (chipnr=0; chipnr < candev->nr_all_chips; chipnr++) {
+//
+//             if(chipnr<irqnum)
+//                     irqsig=irq[*irq_param_idx_p+chipnr];
+//
+//             bd=baudrate[*chan_param_idx_p+chipnr];
+//             if(!bd) bd=baudrate[0];
+//
+//             if ((ret=init_chip_struct(candev, chipnr, irqsig, bd*1000)))
+//                     goto error_chip;
+//     }
+//
+//
+//
+//     for (chipnr=0; chipnr < candev->nr_all_chips; chipnr++) {
+//             int m=minor[*chan_param_idx_p+chipnr];
+//             struct canchip_t *chip=candev->chip[chipnr];
+//             int objnr;
+//
+//             register_chip_struct(chip, m);
+//
+//             for (objnr=0; objnr<chip->max_objects; objnr++) {
+//                     register_obj_struct(chip->msgobj[objnr], m);
+//                     if(m>=0) m++;
+//             }
+//     }
+//
+//     *irq_param_idx_p += irqnum;
+//     *chan_param_idx_p += candev->nr_all_chips;
+//
+//     return 0;
+//
+//     error_nodev:
+//     ret=-ENODEV;
+//     error_chip:
+//     candevice_done(candev);
+//     goto error_both;
+//
+//     error_nomem:
+//     ret=-ENOMEM;
+//
+//     error_both:
+//     hardware_p->candevice[card]=NULL;
+//     free(candev);
+//     return ret;
+//
+// }
 
 /**
  * init_chip_struct - initializes one CAN chip structure
@@ -284,7 +284,7 @@ int init_chip_struct(struct candevice_t *candev, int chipnr, int irq, long baudr
        int objnr;
        int ret;
 
-       candev->chip[chipnr]=(struct canchip_t *)can_checked_malloc(sizeof(struct canchip_t));
+       candev->chip[chipnr]=(struct canchip_t *)malloc(sizeof(struct canchip_t));
        if ((chip=candev->chip[chipnr])==NULL)
                return -ENOMEM;
 
@@ -293,7 +293,7 @@ int init_chip_struct(struct candevice_t *candev, int chipnr, int irq, long baudr
        chip->write_register=candev->hwspecops->write_register;
        chip->read_register=candev->hwspecops->read_register;
 
-       chip->chipspecops=can_checked_malloc(sizeof(struct chipspecops_t));
+       chip->chipspecops=malloc(sizeof(struct chipspecops_t));
        if (chip->chipspecops==NULL)
                return -ENOMEM;
        memset(chip->chipspecops,0,sizeof(struct chipspecops_t));
@@ -333,7 +333,7 @@ int init_obj_struct(struct candevice_t *candev, struct canchip_t *hostchip, int
        struct msgobj_t *obj;
        int ret;
 
-       obj=(struct msgobj_t *)can_checked_malloc(sizeof(struct msgobj_t));
+       obj=(struct msgobj_t *)malloc(sizeof(struct msgobj_t));
        hostchip->msgobj[objnr]=obj;
        if (obj == NULL)
                return -ENOMEM;
@@ -343,9 +343,9 @@ int init_obj_struct(struct candevice_t *candev, struct canchip_t *hostchip, int
 
        atomic_set(&obj->obj_used,0);
        INIT_LIST_HEAD(&obj->obj_users);
-       init_timer(&obj->tx_timeout);
+//     init_timer(&obj->tx_timeout);
 
-       qends = (struct canque_ends_t *)can_checked_malloc(sizeof(struct canque_ends_t));
+       qends = (struct canque_ends_t *)malloc(sizeof(struct canque_ends_t));
        if(qends == NULL) return -ENOMEM;
        memset(qends, 0, sizeof(struct canque_ends_t));
        obj->hostchip=hostchip;
@@ -376,20 +376,20 @@ int init_obj_struct(struct candevice_t *candev, struct canchip_t *hostchip, int
  *
  * Return Value: returns negative number in the case of fail
  */
-int init_hwspecops(struct candevice_t *candev, int *irqnum_p)
-{
-       const struct boardtype_t *brp;
-
-       brp = boardtype_find(candev->hwname);
-
-       if(!brp) {
-               CANMSG("Sorry, hardware \"%s\" is currently not supported.\n",candev->hwname);
-               return -EINVAL;
-       }
-
-       if(irqnum_p)
-               *irqnum_p=brp->irqnum;
-       brp->board_register(candev->hwspecops);
-
-       return 0;
-}
+// int init_hwspecops(struct candevice_t *candev, int *irqnum_p)
+// {
+//     const struct boardtype_t *brp;
+//
+//     brp = boardtype_find(candev->hwname);
+//
+//     if(!brp) {
+//             CANMSG("Sorry, hardware \"%s\" is currently not supported.\n",candev->hwname);
+//             return -EINVAL;
+//     }
+//
+//     if(irqnum_p)
+//             *irqnum_p=brp->irqnum;
+//     brp->board_register(candev->hwspecops);
+//
+//     return 0;
+// }
index b777b14..0b3e388 100644 (file)
@@ -24,7 +24,7 @@
 #include "./can/main.h"
 #include "./can/devcommon.h"
 #include "./can/setup.h"
-#include "./can/finish.h"
+// #include "./can/finish.h"
 #include "./can/i82527.h"
 //#include "../include/sja1000.h"
 #include "./can/sja1000p.h"
@@ -39,7 +39,7 @@
 #define CAN_OP_WRITE 0x00
 
 
-/* our private defines. if this grows any larger, use your own .h file */
+       /* our private defines. if this grows any larger, use your own .h file */
 #define MAX_TRANSFER           (PAGE_SIZE - 512)
 /* MAX_TRANSFER is chosen so that the VM is not stressed by
    allocations > PAGE_SIZE and the number of packets in a page
 // };
 // MODULE_DEVICE_TABLE(usb, ul_usb1_table);
 
-extern struct file_operations can_fops;
+// extern struct file_operations can_fops;
 
-struct ul_usb1_combo {
-       struct usb_ul_usb1 * dev;
-       struct urb * urb;
-};
+// struct ul_usb1_combo {
+//     struct usb_ul_usb1 * dev;
+//     struct urb * urb;
+// };
 
 /*
  * IO_RANGE is the io-memory range that gets reserved, please adjust according
@@ -73,28 +73,28 @@ struct ul_usb1_combo {
 #define IO_RANGE 0x100
 
 /* Structure to hold all of our device specific stuff */
-struct usb_ul_usb1 {
-       struct usb_device       *udev;                  /* the usb device for this device */
-       struct usb_interface    *interface;             /* the interface for this device */
-       struct semaphore        limit_sem;              /* limiting the number of writes in progress */
-       struct usb_anchor       submitted;              /* in case we need to retract our submissions */
-       unsigned char           *bulk_in_buffer;        /* the buffer to receive data */
-       size_t                  bulk_in_size;           /* the size of the receive buffer */
-       unsigned char           *int_in_buffer; /* the buffer to receive data */
-       size_t                  int_in_size;            /* the size of the receive buffer */
-       __u8                    bulk_in_endpointAddr;   /* the address of the bulk in endpoint */
-       __u8                    bulk_out_endpointAddr;  /* the address of the bulk out endpoint */
-       __u8                    int_in_endpointAddr;    /* the address of the interrupt in endpoint */
-       int                             int_in_interval;
-       int                     errors;                 /* the last request tanked */
-       int                     open_count;             /* count the number of openers */
-       spinlock_t              err_lock;               /* lock for errors */
-       struct mutex            io_mutex;               /* synchronize I/O with disconnect */
-       struct urb              *irq;
-       struct candevice_t              *candev;
-};
-
-static struct usb_driver ul_usb1_driver;
+// struct usb_ul_usb1 {
+//     struct usb_device       *udev;                  /* the usb device for this device */
+//     struct usb_interface    *interface;             /* the interface for this device */
+//     struct semaphore        limit_sem;              /* limiting the number of writes in progress */
+//     struct usb_anchor       submitted;              /* in case we need to retract our submissions */
+//     unsigned char           *bulk_in_buffer;        /* the buffer to receive data */
+//     size_t                  bulk_in_size;           /* the size of the receive buffer */
+//     unsigned char           *int_in_buffer; /* the buffer to receive data */
+//     size_t                  int_in_size;            /* the size of the receive buffer */
+//     __u8                    bulk_in_endpointAddr;   /* the address of the bulk in endpoint */
+//     __u8                    bulk_out_endpointAddr;  /* the address of the bulk out endpoint */
+//     __u8                    int_in_endpointAddr;    /* the address of the interrupt in endpoint */
+//     int                             int_in_interval;
+//     int                     errors;                 /* the last request tanked */
+//     int                     open_count;             /* count the number of openers */
+//     spinlock_t              err_lock;               /* lock for errors */
+//     struct mutex            io_mutex;               /* synchronize I/O with disconnect */
+//     struct urb              *irq;
+//     struct candevice_t              *candev;
+// };
+//
+// static struct usb_driver ul_usb1_driver;
 
 /** ul_usb1_request_io
  * ul_usb1_request_io: - reserve io or memory range for can board
@@ -112,7 +112,7 @@ static struct usb_driver ul_usb1_driver;
  */
 int ul_usb1_request_io(struct candevice_t *candev)
 {
-       ((struct usb_ul_usb1*)candev->sysdevptr.anydev)->candev=candev;
+//     ((struct usb_ul_usb1*)candev->sysdevptr.anydev)->candev=candev;
        return 0;
 }
 
@@ -130,7 +130,7 @@ int ul_usb1_request_io(struct candevice_t *candev)
  */
 int ul_usb1_release_io(struct candevice_t *candev)
 {
-       struct usb_ul_usb1 *dev;
+/*     struct usb_ul_usb1 *dev;
        if (candev->sysdevptr.anydev){
                dev=(struct usb_ul_usb1*) candev->sysdevptr.anydev;
                usb_put_dev(dev->udev);
@@ -143,7 +143,7 @@ int ul_usb1_release_io(struct candevice_t *candev)
                        //cleanup_usbdev(dev->candev);
                }
                kfree(dev);
-       }
+       }*/
        return 0;
 }
 
@@ -306,20 +306,20 @@ void ul_usb1_write_register(struct candevice_t *candev,unsigned data, unsigned l
 
        dev = (struct usb_ul_usb1 *)candev->sysdevptr.anydev;
 
-       mutex_lock(&dev->io_mutex);
-       if (!dev) {             /* disconnect() was called */
-               CANMSG("Sending %lu:%X : ERR No device\n",address,(uint8_t)data);
-               retval = -ENODEV;
-               goto exit;
-       }
-       if (!dev->interface) {          /* disconnect() was called */
-               CANMSG("Sending %lu:%X : ERR No interface\n",address,(uint8_t)data);
-               retval = -ENODEV;
-               goto exit;
-       }
+//     mutex_lock(&dev->io_mutex);
+//     if (!dev) {             /* disconnect() was called */
+//             CANMSG("Sending %lu:%X : ERR No device\n",address,(uint8_t)data);
+//             retval = -ENODEV;
+//             goto exit;
+//     }
+//     if (!dev->interface) {          /* disconnect() was called */
+//             CANMSG("Sending %lu:%X : ERR No interface\n",address,(uint8_t)data);
+//             retval = -ENODEV;
+//             goto exit;
+//     }
 
        /* do a blocking bulk write to send data to the device */
-       retval = usb_bulk_msg(dev->udev,
+/*     retval = usb_bulk_msg(dev->udev,
                              usb_sndbulkpipe(dev->udev, dev->bulk_out_endpointAddr),
                              buffer,
                              2,
@@ -327,7 +327,7 @@ void ul_usb1_write_register(struct candevice_t *candev,unsigned data, unsigned l
        CANMSG("Sending %lu:%X : retval %d, transferred %d bytes\n",address,(uint8_t)data,retval,bytes_transferred);
 
 exit:
-       mutex_unlock(&dev->io_mutex);
+       mutex_unlock(&dev->io_mutex);*/
 }
 
 /** ul_usb1_read_register
@@ -351,18 +351,18 @@ unsigned ul_usb1_read_register(struct candevice_t *candev,unsigned long address)
 
        dev = (struct usb_ul_usb1 *)candev->sysdevptr.anydev;
 
-       mutex_lock(&dev->io_mutex);
-       if (!dev) {             /* disconnect() was called */
-               retval = -ENODEV;
-               goto exit;
-       }
-       if (!dev->interface) {          /* disconnect() was called */
-               retval = -ENODEV;
-               goto exit;
-       }
+//     mutex_lock(&dev->io_mutex);
+//     if (!dev) {             /* disconnect() was called */
+//             retval = -ENODEV;
+//             goto exit;
+//     }
+//     if (!dev->interface) {          /* disconnect() was called */
+//             retval = -ENODEV;
+//             goto exit;
+//     }
 
        /* do a blocking bulk write to send data to the device */
-       retval = usb_bulk_msg(dev->udev,
+/*     retval = usb_bulk_msg(dev->udev,
                              usb_sndbulkpipe(dev->udev, dev->bulk_out_endpointAddr),
                              buffer,
                              2,
@@ -373,16 +373,16 @@ unsigned ul_usb1_read_register(struct candevice_t *candev,unsigned long address)
                retval = -EFAULT;
                goto exit;
        }
-
+*/
        /* do a blocking bulk read to get data from the device */
-       retval = usb_bulk_msg(dev->udev,
-                             usb_rcvbulkpipe(dev->udev, dev->bulk_in_endpointAddr),
-                             dev->bulk_in_buffer,
-                             dev->bulk_in_size,
-                             &bytes_transferred, 10000);
+//     retval = usb_bulk_msg(dev->udev,
+//                           usb_rcvbulkpipe(dev->udev, dev->bulk_in_endpointAddr),
+//                           dev->bulk_in_buffer,
+//                           dev->bulk_in_size,
+//                           &bytes_transferred, 10000);
 
        /* if the read was successful, copy the data to userspace */
-       CANMSG("Received %d bytes : %u:%X\n",bytes_transferred,(dev->bulk_in_buffer[0] & 0x7F),dev->bulk_in_buffer[1]);
+/*     CANMSG("Received %d bytes : %u:%X\n",bytes_transferred,(dev->bulk_in_buffer[0] & 0x7F),dev->bulk_in_buffer[1]);
        if (!retval) {
                if (bytes_transferred!=2)
                        retval = -EFAULT;
@@ -392,7 +392,7 @@ unsigned ul_usb1_read_register(struct candevice_t *candev,unsigned long address)
 
 exit:
        mutex_unlock(&dev->io_mutex);
-       return retval;
+       return retval;*/
 }
 
 /* !!! Don't change this function !!! */
@@ -416,209 +416,209 @@ int ul_usb1_register(struct hwspecops_t *hwspecops)
 /* --------------------------------------------------------------------------------------------------- */
 
 
-static void ul_usb1_irq(struct urb *urb)
-{
-       struct usb_ul_usb1 *dev = urb->context;
-       struct ul_usb1_combo devc;
-       int retval;
-
-       CANMSG("Interrupt poll\n");
-
-       switch (urb->status) {
-       case 0:
-               /* success */
-               break;
-       case -ECONNRESET:
-       case -ENOENT:
-       case -ESHUTDOWN:
-               /* this urb is terminated, clean up */
-               CANMSG("%s - urb shutting down with status: %d\n", __FUNCTION__, urb->status);
-               return;
-       default:
-               CANMSG("%s - nonzero urb status received: %d\n", __FUNCTION__, urb->status);
-               goto exit;
-       }
-
-       devc.dev = dev;
-       devc.urb = urb;
-
-       dev->candev->chip[0]->chipspecops->irq_handler(0,dev->candev->chip[0]);
-       CANMSG("Interrupt caught\n");
-
- exit:
-       retval = usb_submit_urb (urb, GFP_ATOMIC);
-       if (retval)
-               CANMSG("%s - usb_submit_urb failed with result %d\n",
-                    __FUNCTION__, retval);
-}
-
-static void ul_usb1_delete(struct usb_ul_usb1 *dev)
-{
-       usb_put_dev(dev->udev);
-       usb_kill_urb(dev->irq);
-       usb_free_urb(dev->irq);
-       kfree(dev->bulk_in_buffer);
-       kfree(dev->int_in_buffer);
-       if (dev->candev){
-               dev->candev->sysdevptr.anydev=NULL;
-               cleanup_usbdev(dev->candev);
-       }
-       kfree(dev);
-}
-
-static int ul_usb1_probe(struct usb_interface *interface, const struct usb_device_id *id)
-{
-       struct usb_ul_usb1 *dev;
-       struct usb_host_interface *iface_desc;
-       struct usb_endpoint_descriptor *endpoint;
-       struct candevice_t *candev;
-       size_t buffer_size;
-       int i;
-       int retval = -ENOMEM;
-
-       /* allocate memory for our device state and initialize it */
-       dev = kzalloc(sizeof(*dev), GFP_KERNEL);
-       if (!dev) {
-               err("Out of memory");
-               goto error;
-       }
-       sema_init(&dev->limit_sem, WRITES_IN_FLIGHT);
-       mutex_init(&dev->io_mutex);
-       spin_lock_init(&dev->err_lock);
-       init_usb_anchor(&dev->submitted);
-
-//     dev->udev = usb_get_dev(interface_to_usbdev(interface));
-       dev->udev = interface_to_usbdev(interface);
-       dev->interface = interface;
-
-       /* set up the endpoint information */
-       /* use only the first bulk-in and bulk-out endpoints */
-       iface_desc = interface->cur_altsetting;
-       for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) {
-               endpoint = &iface_desc->endpoint[i].desc;
-
-               if (!dev->bulk_in_endpointAddr &&
-                   usb_endpoint_is_bulk_in(endpoint)) {
-                       /* we found a bulk in endpoint */
-                       buffer_size = le16_to_cpu(endpoint->wMaxPacketSize);
-                       dev->bulk_in_size = buffer_size;
-                       dev->bulk_in_endpointAddr = endpoint->bEndpointAddress;
-                       dev->bulk_in_buffer = kmalloc(buffer_size, GFP_KERNEL);
-                       if (!dev->bulk_in_buffer) {
-                               err("Could not allocate bulk_in_buffer");
-                               goto error;
-                       }
-               }
-
-               if (!dev->bulk_out_endpointAddr &&
-                   usb_endpoint_is_bulk_out(endpoint)) {
-                       /* we found a bulk out endpoint */
-                               dev->bulk_out_endpointAddr = endpoint->bEndpointAddress;
-               }
-
-               if (!dev->int_in_endpointAddr &&
-                   usb_endpoint_is_int_in(endpoint)) {
-                       /* we found an interrupt in endpoint */
-                       buffer_size = le16_to_cpu(endpoint->wMaxPacketSize);
-                       dev->int_in_size = buffer_size;
-                       dev->int_in_endpointAddr = endpoint->bEndpointAddress;
-                       dev->int_in_buffer = kmalloc(buffer_size, GFP_KERNEL);
-                       dev->int_in_interval = endpoint->bInterval;
-                       if (!dev->int_in_buffer) {
-                               err("Could not allocate int_in_buffer");
-                               goto error;
-                       }
-               }
-       }
-       if (!(dev->bulk_in_endpointAddr && dev->bulk_out_endpointAddr && dev->int_in_endpointAddr)) {
-               err("Could not find all bulk-in, bulk-out and interrupt endpoints");
-               goto error;
-       }
-
-       /* save our data pointer in this interface device */
-       usb_set_intfdata(interface, dev);
-
-       if (main_init_done==1)
-               register_usbdev("ul_usb1",(void *) dev);
-       else {
-               mutex_lock(&usbdev_reg_mutex);
-               if (main_init_done==1)
-                       register_usbdev("ul_usb1",(void *) dev);
-               else {
-                       for (i=0;i<MAX_HW_CARDS;i++){
-                               if (usbregq[i]==NULL){
-                                       usbregq[i]=(struct usbdev_reg_query *)can_checked_malloc(sizeof(struct usbdev_reg_query));
-                                       if (!usbregq[i]){
-                                               CANMSG("Error allocating usbdev_reg_query");
-                                               mutex_unlock(&usbdev_reg_mutex);
-                                               goto error;
-                                       }
-                                       sprintf (usbregq[i]->hwname,"ul_usb1");
-                                       usbregq[i]->anydev=(void *) dev;
-                                       break;
-                               }
-                       }
-                       if (i==MAX_HW_CARDS){
-                               CANMSG("No free space to register new card");
-                               mutex_unlock(&usbdev_reg_mutex);
-                               goto error;
-                       }
-               }
-               mutex_unlock(&usbdev_reg_mutex);
-       }
-
-       dev->irq = usb_alloc_urb(0, GFP_KERNEL);
-       if (!dev->irq){
-               CANMSG("Error allocating usb urb\n");
-               goto error;
-       }
-       dev->irq->dev = dev->udev;
-       usb_fill_int_urb(dev->irq, dev->udev,
-                        usb_rcvintpipe(dev->udev, dev->int_in_endpointAddr),
-                        dev->int_in_buffer, dev->int_in_size,
-                        ul_usb1_irq, dev, dev->int_in_interval);
-/*     usb_fill_bulk_urb(dev->irq, dev->udev,
-                        usb_rcvbulkpipe(dev->udev, dev->bulk_in_endpointAddr),
-                        dev->int_in_buffer, dev->int_in_size,
-                        ul_usb1_irq, dev);*/
-
-/*     dev->irq->transfer_dma = wacom->data_dma;
-       dev->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;*/
-       retval=usb_submit_urb(dev->irq, GFP_KERNEL);
-       if (retval){
-               CANMSG("INT URB %d\n",retval);
-               return -EIO;
-       }else
-               CANMSG("INT URB SUCCCESS\n");
-
-       /* let the user know what node this device is now attached to */
-       info("USB Skeleton device now attached");
-       return 0;
-
-error:
-               ul_usb1_delete(dev);
-       return retval;
-}
-
-static void ul_usb1_disconnect(struct usb_interface *interface)
-{
-       struct usb_ul_usb1 *dev;
-       int minor = interface->minor;
-
-       dev = usb_get_intfdata(interface);
-       usb_set_intfdata(interface, NULL);
-
-       /* prevent more I/O from starting */
-       mutex_lock(&dev->io_mutex);
-       dev->interface = NULL;
-       mutex_unlock(&dev->io_mutex);
+// static void ul_usb1_irq(struct urb *urb)
+// {
+//     struct usb_ul_usb1 *dev = urb->context;
+//     struct ul_usb1_combo devc;
+//     int retval;
+//
+//     CANMSG("Interrupt poll\n");
+//
+//     switch (urb->status) {
+//     case 0:
+//             /* success */
+//             break;
+//     case -ECONNRESET:
+//     case -ENOENT:
+//     case -ESHUTDOWN:
+//             /* this urb is terminated, clean up */
+//             CANMSG("%s - urb shutting down with status: %d\n", __FUNCTION__, urb->status);
+//             return;
+//     default:
+//             CANMSG("%s - nonzero urb status received: %d\n", __FUNCTION__, urb->status);
+//             goto exit;
+//     }
+//
+//     devc.dev = dev;
+//     devc.urb = urb;
+//
+//     dev->candev->chip[0]->chipspecops->irq_handler(0,dev->candev->chip[0]);
+//     CANMSG("Interrupt caught\n");
+//
+//  exit:
+//     retval = usb_submit_urb (urb, GFP_ATOMIC);
+//     if (retval)
+//             CANMSG("%s - usb_submit_urb failed with result %d\n",
+//                  __FUNCTION__, retval);
+// }
 
-       //usb_kill_anchored_urbs(&dev->submitted);
+// static void ul_usb1_delete(struct usb_ul_usb1 *dev)
+// {
+//     usb_put_dev(dev->udev);
+//     usb_kill_urb(dev->irq);
+//     usb_free_urb(dev->irq);
+//     kfree(dev->bulk_in_buffer);
+//     kfree(dev->int_in_buffer);
+//     if (dev->candev){
+//             dev->candev->sysdevptr.anydev=NULL;
+//             cleanup_usbdev(dev->candev);
+//     }
+//     kfree(dev);
+// }
 
-       ul_usb1_delete(dev);
+// static int ul_usb1_probe(struct usb_interface *interface, const struct usb_device_id *id)
+// {
+//     struct usb_ul_usb1 *dev;
+//     struct usb_host_interface *iface_desc;
+//     struct usb_endpoint_descriptor *endpoint;
+//     struct candevice_t *candev;
+//     size_t buffer_size;
+//     int i;
+//     int retval = -ENOMEM;
+//
+//     /* allocate memory for our device state and initialize it */
+//     dev = kzalloc(sizeof(*dev), GFP_KERNEL);
+//     if (!dev) {
+//             err("Out of memory");
+//             goto error;
+//     }
+//     sema_init(&dev->limit_sem, WRITES_IN_FLIGHT);
+//     mutex_init(&dev->io_mutex);
+//     spin_lock_init(&dev->err_lock);
+//     init_usb_anchor(&dev->submitted);
+//
+// //  dev->udev = usb_get_dev(interface_to_usbdev(interface));
+//     dev->udev = interface_to_usbdev(interface);
+//     dev->interface = interface;
+//
+//     /* set up the endpoint information */
+//     /* use only the first bulk-in and bulk-out endpoints */
+//     iface_desc = interface->cur_altsetting;
+//     for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) {
+//             endpoint = &iface_desc->endpoint[i].desc;
+//
+//             if (!dev->bulk_in_endpointAddr &&
+//                 usb_endpoint_is_bulk_in(endpoint)) {
+//                     /* we found a bulk in endpoint */
+//                     buffer_size = le16_to_cpu(endpoint->wMaxPacketSize);
+//                     dev->bulk_in_size = buffer_size;
+//                     dev->bulk_in_endpointAddr = endpoint->bEndpointAddress;
+//                     dev->bulk_in_buffer = kmalloc(buffer_size, GFP_KERNEL);
+//                     if (!dev->bulk_in_buffer) {
+//                             err("Could not allocate bulk_in_buffer");
+//                             goto error;
+//                     }
+//             }
+//
+//             if (!dev->bulk_out_endpointAddr &&
+//                 usb_endpoint_is_bulk_out(endpoint)) {
+//                     /* we found a bulk out endpoint */
+//                             dev->bulk_out_endpointAddr = endpoint->bEndpointAddress;
+//             }
+//
+//             if (!dev->int_in_endpointAddr &&
+//                 usb_endpoint_is_int_in(endpoint)) {
+//                     /* we found an interrupt in endpoint */
+//                     buffer_size = le16_to_cpu(endpoint->wMaxPacketSize);
+//                     dev->int_in_size = buffer_size;
+//                     dev->int_in_endpointAddr = endpoint->bEndpointAddress;
+//                     dev->int_in_buffer = kmalloc(buffer_size, GFP_KERNEL);
+//                     dev->int_in_interval = endpoint->bInterval;
+//                     if (!dev->int_in_buffer) {
+//                             err("Could not allocate int_in_buffer");
+//                             goto error;
+//                     }
+//             }
+//     }
+//     if (!(dev->bulk_in_endpointAddr && dev->bulk_out_endpointAddr && dev->int_in_endpointAddr)) {
+//             err("Could not find all bulk-in, bulk-out and interrupt endpoints");
+//             goto error;
+//     }
+//
+//     /* save our data pointer in this interface device */
+//     usb_set_intfdata(interface, dev);
+//
+//     if (main_init_done==1)
+//             register_usbdev("ul_usb1",(void *) dev);
+//     else {
+//             mutex_lock(&usbdev_reg_mutex);
+//             if (main_init_done==1)
+//                     register_usbdev("ul_usb1",(void *) dev);
+//             else {
+//                     for (i=0;i<MAX_HW_CARDS;i++){
+//                             if (usbregq[i]==NULL){
+//                                     usbregq[i]=(struct usbdev_reg_query *)can_checked_malloc(sizeof(struct usbdev_reg_query));
+//                                     if (!usbregq[i]){
+//                                             CANMSG("Error allocating usbdev_reg_query");
+//                                             mutex_unlock(&usbdev_reg_mutex);
+//                                             goto error;
+//                                     }
+//                                     sprintf (usbregq[i]->hwname,"ul_usb1");
+//                                     usbregq[i]->anydev=(void *) dev;
+//                                     break;
+//                             }
+//                     }
+//                     if (i==MAX_HW_CARDS){
+//                             CANMSG("No free space to register new card");
+//                             mutex_unlock(&usbdev_reg_mutex);
+//                             goto error;
+//                     }
+//             }
+//             mutex_unlock(&usbdev_reg_mutex);
+//     }
+//
+//     dev->irq = usb_alloc_urb(0, GFP_KERNEL);
+//     if (!dev->irq){
+//             CANMSG("Error allocating usb urb\n");
+//             goto error;
+//     }
+//     dev->irq->dev = dev->udev;
+//     usb_fill_int_urb(dev->irq, dev->udev,
+//                      usb_rcvintpipe(dev->udev, dev->int_in_endpointAddr),
+//                      dev->int_in_buffer, dev->int_in_size,
+//                      ul_usb1_irq, dev, dev->int_in_interval);
+// /*  usb_fill_bulk_urb(dev->irq, dev->udev,
+//                      usb_rcvbulkpipe(dev->udev, dev->bulk_in_endpointAddr),
+//                      dev->int_in_buffer, dev->int_in_size,
+//                      ul_usb1_irq, dev);*/
+//
+// /*  dev->irq->transfer_dma = wacom->data_dma;
+//     dev->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;*/
+//     retval=usb_submit_urb(dev->irq, GFP_KERNEL);
+//     if (retval){
+//             CANMSG("INT URB %d\n",retval);
+//             return -EIO;
+//     }else
+//             CANMSG("INT URB SUCCCESS\n");
+//
+//     /* let the user know what node this device is now attached to */
+//     info("USB Skeleton device now attached");
+//     return 0;
+//
+// error:
+//             ul_usb1_delete(dev);
+//     return retval;
+// }
 
-       info("USB Skeleton now disconnected");
-}
+// static void ul_usb1_disconnect(struct usb_interface *interface)
+// {
+//     struct usb_ul_usb1 *dev;
+//     int minor = interface->minor;
+//
+//     dev = usb_get_intfdata(interface);
+//     usb_set_intfdata(interface, NULL);
+//
+//     /* prevent more I/O from starting */
+//     mutex_lock(&dev->io_mutex);
+//     dev->interface = NULL;
+//     mutex_unlock(&dev->io_mutex);
+//
+//     //usb_kill_anchored_urbs(&dev->submitted);
+//
+//     ul_usb1_delete(dev);
+//
+//     info("USB Skeleton now disconnected");
+// }
 
 // static struct usb_driver ul_usb1_driver = {
 //     .name =         "ul_usb1-can",