Skip to content
forked from tomxue/netlink

Linux netlink program, to show how to transfer information between kernel and user space

Notifications You must be signed in to change notification settings

bidebro/netlink

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hotplug.c
    snl.nl_groups = 1;
    disconnect USB-to-COM device and reconnect it once:
        root@maemo-desktop:/mnt/hgfs/VMware_share/mycode/netlink# ./hotplug
        test errno: Success
        remove@/devices/pci0000:00/0000:00:11.0/0000:02:00.0/usb2/2-2/2-2.1/2-2.1:1.0/ttyUSB0/tty/ttyUSB0
        remove@/devices/pci0000:00/0000:00:11.0/0000:02:00.0/usb2/2-2/2-2.1/2-2.1:1.0/ttyUSB0
        remove@/devices/pci0000:00/0000:00:11.0/0000:02:00.0/usb2/2-2/2-2.1/2-2.1:1.0
        remove@/devices/pci0000:00/0000:00:11.0/0000:02:00.0/usb2/2-2/2-2.1
        add@/devices/pci0000:00/0000:00:11.0/0000:02:00.0/usb2/2-2/2-2.1
        add@/devices/pci0000:00/0000:00:11.0/0000:02:00.0/usb2/2-2/2-2.1/2-2.1:1.0
        add@/devices/pci0000:00/0000:00:11.0/0000:02:00.0/usb2/2-2/2-2.1/2-2.1:1.0/ttyUSB0
        add@/devices/pci0000:00/0000:00:11.0/0000:02:00.0/usb2/2-2/2-2.1/2-2.1:1.0/ttyUSB0/tty/ttyUSB0




    snl.nl_groups = 3;
    disconnect USB-to-COM device and reconnect it once:
        inputtedroot@maemo-desktop:/mnt/hgfs/VMware_share/mycode/netlink# ./hotplug
        test errno: Success
        remove@/devices/pci0000:00/0000:00:11.0/0000:02:00.0/usb2/2-2/2-2.1/2-2.1:1.0/ttyUSB0/tty/ttyUSB0
        remove@/devices/pci0000:00/0000:00:11.0/0000:02:00.0/usb2/2-2/2-2.1/2-2.1:1.0/ttyUSB0
        remove@/devices/pci0000:00/0000:00:11.0/0000:02:00.0/usb2/2-2/2-2.1/2-2.1:1.0
        remove@/devices/pci0000:00/0000:00:11.0/0000:02:00.0/usb2/2-2/2-2.1
        libudev
        libudev
        libudev
        libudev
        add@/devices/pci0000:00/0000:00:11.0/0000:02:00.0/usb2/2-2/2-2.1
        add@/devices/pci0000:00/0000:00:11.0/0000:02:00.0/usb2/2-2/2-2.1/2-2.1:1.0
        add@/devices/pci0000:00/0000:00:11.0/0000:02:00.0/usb2/2-2/2-2.1/2-2.1:1.0/ttyUSB0
        add@/devices/pci0000:00/0000:00:11.0/0000:02:00.0/usb2/2-2/2-2.1/2-2.1:1.0/ttyUSB0/tty/ttyUSB0
        libudev
        libudev
        libudev
        libudev

Makefile
    obj-m += nl_kernel.o

make on BB_Ubuntu:
    make ARCH=arm  -C /lib/modules/3.0.4-x3/build M=$(pwd) modules

Run
    sudo insmod nl_kernel.ko
    ./nl_user
    dmesg | tail

About

Linux netlink program, to show how to transfer information between kernel and user space

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 100.0%