Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

LinuxÄÚºËÉ豸ģÐÍ(4)

ÒëÕߣº¹ùÉÙ±¯
2009/12/02
Ô­ÎÄ£ºlinux/Documentation/driver-model/class.txt
É豸Àà
½éÉÜ
~~~~
Ò»¸öÉ豸ÀàÃèÊöÁËÒ»ÀàµÄÉ豸£¬ÀýÈçÓïÒôÉ豸»òÕßÍøÂçÉ豸¡£ÏÂÃæÊÇÒѶ¨ÒåµÄÉ豸Àà:
<Insert List of Device Classes Here>
ÿ¸öÉ豸ÀඨÒåÁËÒ»Ì×Óï·¨ºÍÉ豸×ñÑ­µÄ±à³Ì½Ó¿Ú¡£É豸Çý¶¯¾ÍÊÇΪÌض¨×ÜÏßÉϵÄ
Ìض¨É豸¶øÍê³ÉµÄÕâÌ×±à³Ì½Ó¿ÚʵÏÖ¡£
¶ÔÓÚÒ»¸öÉ豸פ×ãÔÚÄĸö×ÜÏßÉÏ£¬É豸ÀàÊDz»¿ÉÖªµÄ¡£
±à³Ì½Ó¿Ú
~~~~~~~~
É豸ÀàµÄÊý¾Ý½á¹¹ÈçÏ£º
typedef int (*devclass_add)(struct device *);
typedef void (*devclass_remove)(struct device *);
struct device_class {
    char            * name;
    rwlock_t        lock;
    u32            devnum;
    struct list_head    node;
    struct list_head    drivers;
    struct list_head    intf_list;
    struct driver_dir_entry    dir;
    struct driver_dir_entry    device_dir;
    struct driver_dir_entry    driver_dir;
    devclass_add        add_device;
    devclass_remove        remove_device;
};
Ò»¸öµäÐ͵ÄÉ豸ÀàÀàËÆÈç϶¨Ò壺
struct device_class input_devclass = {
        .name        = "input",
        .add_device    = input_add_device,
    .remove_device    = input_remove_device,
};
ÿ¸öÉ豸ÀàÊý¾Ý½á¹¹·ÅÔÚÒ»¸öÍ·ÎļþÀïµ¼³ö£¬Òò´ËËüÄܹ»±»Çý¶¯£¬À©Õ¹³ÌÐòºÍ½Ó¿Ú
ʹÓá£
ÄÚºËÀïÉ豸ÀàµÄ×¢²áºÍ×¢Ïúº¯Êý½Ó¿ÚÈçÏÂËùʾ£º
int devclass_register(struct device_class * cls);
void devclass_unregister(struct device_class * cls);
É豸
~~~~
µ±É豸°ó¶¨µ½Çý¶¯ÉÏ£¬Ëü¾Í»á±»Ìí¼Ó


Ïà¹ØÎĵµ£º

ʵսLinux Bluetooth±à³Ì£¨Èý£© HCI²ã±à³Ì

1. HCI²ãЭÒé¸ÅÊö£º
HCIÌṩһÌ×ͳһµÄ·½·¨À´·ÃÎÊBluetoothµ×²ã¡£ÈçͼËùʾ£º
´ÓͼÉÏ¿ÉÒÔ¿´³ö£¬Host Controller Interface(HCI)  ¾ÍÊÇÓÃÀ´¹µÍ¨HostºÍModule¡£Hostͨ³£¾ÍÊÇPC£¬ ModuleÔòÊÇÒÔ¸÷ÖÖÎïÀíÁ¬½ÓÐÎʽ£¨USB,serial,pc-cardµÈ£©Á¬½Óµ½PCÉϵÄbluetooth Dongle¡£
ÔÚHostÕâÒ»¶Ë£ºapplication,SDP,L2capµÈЭÒé ......

linux¶¯Ì¬Á´½Ó¿âµÄ´´½¨ÓëʹÓÃ

ʹÓÃlinux¶¯Ì¬Á´½Ó¿â£º
     ÔÚUnixÉÏ´æÔÚÁ½Öֿ⣺¶¯Ì¬¿â£¨.so£©ºÍ¾²Ì¬¿â£¨.a£©£¬²ÉÓö¯Ì¬¿â£¨¹²Ïí¶ÔÏ󣩼¼Êõ¿ÉÒÔ·½±ã³ÌÐò¼ä¹²Ïí£¬½ÚÊ¡³ÌÐòÕ¼Óпռ䣬Ôö¼Ó³ÌÐòµÄ¿ÉÀ©Õ¹ÐÔºÍÁé»îÐÔ¡£
    ²Ù×÷¶¯Ì¬¿âµÄº¯ÊýÔÚdlfcn.hÎļþÖж¨Ò壬ËùÒÔÒªÔÚʹÓö¯Ì¬¿âʱinclude <dlfcn.h>
 &n ......

ʹÓà Java ¶Ô Linux ÏÂÎļþ±àÂë¸ñʽ½øÐÐÅúÁ¿×ª»»

ʹÓà Java ¶Ô Linux ÏÂÎļþ±àÂë¸ñʽ½øÐÐÅúÁ¿×ª»»
        ²âÊÔʹÓÃ˵Ã÷£º
        1¡£½« ×Ö·û¼¯±àÂë¸ñʽΪ GB2312 µÄÎļþ test0.java£¬test1.java£¬test2.java ·ÅÔÚ /home/defonds/tmp/test Ŀ¼Ï£¨test0.java£¬test1.java£¬test2.java ×÷Õß¿ÉÒÔ ......

linux fork()º¯Êýѧϰ

#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
int main()
{
    pid_t pid;
    static int n = 0;
    printf("fork!\n"); /*printf("fork!")*/
    switch (pid = fork())
    {
 &nbs ......

Linuxµ¥Óû§Ä£Ê½£ºÐÞ¸ÄROOTÃÜÂëºÍgrub¼ÓÃÜ

Linux ϵͳ´¦ÓÚÕý³£×´Ì¬Ê±£¬·þÎñÆ÷Ö÷»ú¿ª»ú£¨»òÖØÐÂÆô¶¯£©ºó£¬Äܹ»ÓÉϵͳÒýµ¼Æ÷³ÌÐò×Ô¶¯Òýµ¼ Linux ϵͳÆô¶¯µ½¶àÓû§Ä£Ê½£¬²¢ÌṩÕý³£µÄÍøÂç·þÎñ¡£Èç¹ûϵͳ¹ÜÀíÔ±ÐèÒª½øÐÐϵͳά»¤»òϵͳ³öÏÖÆô¶¯Ò쳣ʱ£¬¾ÍÐèÒª½øÈëµ¥Óû§Ä£Ê½»òÐÞ¸´Ä£Ê½¶Ôϵͳ½øÐйÜÀíÁË¡£Ê¹Óõ¥Óû§Ä£Ê½ÓÐÒ»¸öÇ°Ìᣬ¾ÍÊÇÄúµÄϵͳÒýµ¼Æ÷£¨grub£©ÄÜÕý³£¹¤×÷£ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ