阅读:828回复:1
谢谢
以下 程序应该包含哪里的文件?
如何编译 自己写的,有什么错误,谢谢指点 谁能提供linux下与d12通信的最简单的程序 static int vender=0x1234,product=0x5678; static int device_open(struct inode * inode, struct file * file) { MOD_INC_USE_COUNT; return 0; } static int device_close(struct inode * inode, struct file * file) { MOD_DEC_USE_COUNT; return 0; } static void * device_probe(struct u s b_device *dev, unsigned int ifnum) { if (vendor != 0 || product != 0) info(\"U S B Vendorroduct - %x:%x\\n\", vendor, product); if (dev->descriptor.idVendor == vendor&&dev>descriptor.idProduct ==produc t ) printk(\"U S B INSERT\"); } static void device_disconnect(struct u s b_device *dev, void *ptr) { if (dev->descriptor.idVendor == vendor&&dev>descriptor.idProduct ==product ) printk(\"U S B DELETE\"); } static struct file_operations u s b_device_fops = { NULL, /* seek */ NULL,, NULL, NULL, /* readdir */ NULL, /* poll */ NULL, /* ioctl */ NULL, /* mmap */ device_open, NULL, /* flush */ device_close, NULL, NULL, /* fasync */ }; static struct u s b_driver device_driver = { \"u s bdevice\", device_probe, device_disconnect, { NULL, NULL }, &u s b_device_fops, 48 }; int u s b_device_init(void) { if (u s b_register(&device_driver) < 0) return -1; info(\"U S B support registered.\"); return 0; } void u s b_device_cleanup(void) { u s b_deregister(&device_driver); } #ifdef MODULE int init_module(void) { return u s b_device_init(); } void cleanup_module(void) { u s b_device_cleanup(); } |
|
沙发#
发布于:2004-05-12 19:55
发错地方了.....
|
|
|