1
- /*
1
+ /*
2
2
pen_driver.c
3
3
Original author: Anil Kumar Pugalia <email_at_sarika-pugs_dot_com>
4
4
11
11
#include <linux/kernel.h>
12
12
#include <linux/usb.h>
13
13
14
- static struct usb_device * device ;
15
-
14
+ // static struct usb_device *device;
15
+
16
16
static int pen_probe (struct usb_interface * interface , const struct usb_device_id * id )
17
17
{
18
18
struct usb_host_interface * iface_desc ;
19
19
struct usb_endpoint_descriptor * endpoint ;
20
20
int i ;
21
21
22
22
iface_desc = interface -> cur_altsetting ;
23
- printk (KERN_INFO "[PD]: device i/f %d, (%04X:%04X) plugged\n" ,
23
+ printk (KERN_INFO "[PD]: device i/f %d, (%04X:%04X) plugged\n" ,
24
24
iface_desc -> desc .bInterfaceNumber , id -> idVendor , id -> idProduct );
25
- printk (KERN_INFO "ID->bNumEndpoints: %02X\n" ,
25
+ printk (KERN_INFO "ID->bNumEndpoints: %02X\n" ,
26
26
iface_desc -> desc .bNumEndpoints );
27
27
printk (KERN_INFO "ID->bInterfaceClass: %02X\n" ,
28
28
iface_desc -> desc .bInterfaceClass );
29
29
30
30
for (i = 0 ; i < iface_desc -> desc .bNumEndpoints ; i ++ )
31
31
{
32
32
endpoint = & iface_desc -> endpoint [i ].desc ;
33
-
33
+
34
34
printk (KERN_INFO "ED[%d]->bEndpointAddress: 0x%02X\n" ,
35
35
i , endpoint -> bEndpointAddress );
36
36
printk (KERN_INFO "ED[%d]->bmAttributes: 0x%02X\n" ,
@@ -41,12 +41,12 @@ static int pen_probe(struct usb_interface *interface, const struct usb_device_id
41
41
// device = interface_to_usbdev(interface);
42
42
return 0 ;
43
43
}
44
-
44
+
45
45
static void pen_disconnect (struct usb_interface * interface )
46
46
{
47
47
printk (KERN_INFO "[PD]: device disconnected\n" );
48
48
}
49
-
49
+
50
50
static struct usb_device_id pen_table [] =
51
51
{
52
52
{ USB_DEVICE (0x14cd , 0x125a ) }, /* Super Top */
@@ -55,30 +55,30 @@ static struct usb_device_id pen_table[] =
55
55
{} /* Terminating entry */
56
56
};
57
57
MODULE_DEVICE_TABLE (usb , pen_table );
58
-
58
+
59
59
static struct usb_driver pen_driver =
60
60
{
61
61
.name = "pen-driver" ,
62
62
.id_table = pen_table ,
63
63
.probe = pen_probe ,
64
64
.disconnect = pen_disconnect ,
65
65
};
66
-
66
+
67
67
static int __init pen_init (void )
68
68
{
69
69
printk (KERN_INFO "[PD]: module loaded\n" );
70
70
return usb_register (& pen_driver );
71
71
}
72
-
72
+
73
73
static void __exit pen_exit (void )
74
74
{
75
75
printk (KERN_INFO "[PD]: module unloaded\n" );
76
76
usb_deregister (& pen_driver );
77
77
}
78
-
78
+
79
79
module_init (pen_init );
80
80
module_exit (pen_exit );
81
-
81
+
82
82
MODULE_LICENSE ("GPL" );
83
83
MODULE_AUTHOR ("Tas Devil" );
84
84
MODULE_DESCRIPTION ("USB Pen Registration Driver" );
0 commit comments