在线看毛片网站电影-亚洲国产欧美日韩精品一区二区三区,国产欧美乱夫不卡无乱码,国产精品欧美久久久天天影视,精品一区二区三区视频在线观看,亚洲国产精品人成乱码天天看,日韩久久久一区,91精品国产91免费

<menu id="6qfwx"><li id="6qfwx"></li></menu>
    1. <menu id="6qfwx"><dl id="6qfwx"></dl></menu>

      <label id="6qfwx"><ol id="6qfwx"></ol></label><menu id="6qfwx"></menu><object id="6qfwx"><strike id="6qfwx"><noscript id="6qfwx"></noscript></strike></object>
        1. <center id="6qfwx"><dl id="6qfwx"></dl></center>

            新聞中心

            EEPW首頁(yè) > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > 嵌入式Linux下USB驅(qū)動(dòng)程序的設(shè)計(jì)

            嵌入式Linux下USB驅(qū)動(dòng)程序的設(shè)計(jì)

            作者: 時(shí)間:2013-10-08 來(lái)源:網(wǎng)絡(luò) 收藏

              else

              { handle_scancode(0xe0,1);

              handle_scancode(0x4d,1);

              handle_scancode(0xe0,0);

              handle_scancode(0x4d,0);

              }

              }

              printk("new=%x %x %x %x %x %x %x %x", kbd->new[0],kbd->new[1],kbd->new[2],kbd->new[3],

              kbd->new[4],kbd->new[5],kbd->new[6],kbd->new[7]);

              }

              static void *usb_kbd_probe(struct usb_device *dev, unsigned int ifnum, const struct usb_device_id *id)

              {

              struct usb_interface *iface;

              struct usb_interface_descriptor *interface;

              struct usb_endpoint_descriptor *endpoint;

              struct usb_kbd *kbd;

              int pipe, maxp;

              iface = dev->actconfig->interface[ifnum];

              interface = iface->altsetting[iface->act_altsetting];

              if ((dev->descriptor.idVendor != _HOTKEY_VENDOR_ID) || (dev->descriptor.idProduct != _HOTKEY_PRODUCT_ID) || (ifnum != 1))

              {

              return NULL;

              }

              if (dev->actconfig->bNumInterfaces != 2)

              {

              return NULL;

              }

              if (interface->bNumEndpoints != 1) return NULL;

              endpoint = interface->endpoint + 0;

              pipe = usb_rcvintpipe(dev, endpoint->bEndpointAddress);

              maxp = usb_maxpacket(dev, pipe, usb_pipeout(pipe));

              usb_set_protocol(dev, interface->bInterfaceNumber, 0);

              usb_set_idle(dev, interface->bInterfaceNumber, 0, 0);

              printk(KERN_INFO "GUO: Vid = %.4x, Pid = %.4x, Device = %.2x, ifnum = %.2x, bufCount = %.8x", dev->descriptor.idVendor,dev->descriptor.idProduct,dev->descriptor.bcdDevice, ifnum, maxp);

              if (!(kbd = kmalloc(sizeof(struct usb_kbd), GFP_KERNEL))) return NULL;

              memset(kbd, 0, sizeof(struct usb_kbd));

              kbd->usbdev = dev;

              FILL_INT_URB(kbd->irq, dev, pipe, kbd->new, maxp > 8 ? 8 : maxp, usb_kbd_irq,kbd, endpoint->bInterval); kbd->irq.dev = kbd->usbdev;

              if (dev->descriptor.iManufacturer) usb_string(dev, dev->descriptor.iManufacturer, kbd->name, 63);

              if (usb_submit_urb(kbd->irq)) {

              kfree(kbd); return NULL; }

              printk(KERN_INFO "input%d: %s on usb%d:%d.%d", kbd->dev.number, kbd->name, dev->bus->busnum, dev->devnum, ifnum);

              return kbd; }

              static void usb_kbd_disconnect(struct usb_device *dev, void *ptr)

              {

              struct usb_kbd *kbd = ptr;

              usb_unlink_urb(kbd->irq);

              kfree(kbd);

              }

              static struct usb_device_id usb_kbd_id_table [] = {

              { _DEVICE(USB_HOTKEY_VENDOR_ID, USB_HOTKEY_PRODUCT_ID) },

              { } /* Terminating entry */

              };

              MODULE_DEVICE_TABLE (usb, usb_kbd_id_table);

              static struct usb_driver usb_kbd_driver = {

              name: "Hotkey",

              probe: usb_kbd_probe,

              disconnect: usb_kbd_disconnect,

              id_table: usb_kbd_id_table,

              NULL,

              };

              static int __init usb_kbd_init(void)

              {

              usb_register(usb_kbd_driver);

              info(DRIVER_VERSION ":" DRIVER_DESC);

              return 0;

              }

              static void __exit usb_kbd_exit(void)

              {

              usb_deregister(usb_kbd_driver);

              }

              module_init(usb_kbd_init);

              module_exit(usb_kbd_exit);

              三、結(jié)語(yǔ)

              USB規(guī)范是一門(mén)比較新的技術(shù),接口使用方便,但是的設(shè)計(jì)較復(fù)雜。上面介紹了USB設(shè)備的設(shè)計(jì),主要分析了主機(jī)端的設(shè)計(jì),并且給出了一個(gè)編寫(xiě)USB驅(qū)動(dòng)程序的實(shí)例。

            linux操作系統(tǒng)文章專(zhuān)題:linux操作系統(tǒng)詳解(linux不再難懂)

            linux操作系統(tǒng)文章專(zhuān)題:linux操作系統(tǒng)詳解(linux不再難懂)

            linux相關(guān)文章:linux教程



            上一頁(yè) 1 2 3 下一頁(yè)

            評(píng)論


            相關(guān)推薦

            技術(shù)專(zhuān)區(qū)

            關(guān)閉