netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Zhang Rui <rui.zhang@intel.com>
To: jamal <hadi@cyberus.ca>
Cc: netdev@vger.kernel.org, linux-acpi@vger.kernel.org, lenb@kernel.org
Subject: Re: Fwd: [PATCH] [-mm] ACPI: export ACPI events via netlink
Date: Thu, 14 Jun 2007 16:59:36 +0800	[thread overview]
Message-ID: <1181811576.5411.27.camel@localhost.localdomain> (raw)
In-Reply-To: <4466a10705270634j3560c9a3j9c3630ddc20a24aa@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 4950 bytes --]

Hi, Jamal,

Now the genl utility can find the acpi event genetlink family.
And a simple user space demo is finished for handling acpi event.
I really appreciate your help. :)

I think the patch which exposes ACPI events via netlink is ok.
But I still have some problems on
how to listen to specified genetlink family in user space?

I can get the dynamic id for "acpi_event" genl family.
But I don't know how to use this to receive messages from
specified genl family.
It seems that "#genl ctrl monitor" has something to do with this,
IMO, rtnl_open_byproto(&rth, nl_mgrp(GENL_ID_CTRL), NETLINK_GENERIC) is
used to receive messages from the nlctrl(controller) only, but
unfortunately it never works for me. :(

Any suggestions? What interfaces should I use? Or where can I find some
example code?

Attachment is the simple user space demo I made.
It receives all the broadcasted genetlink messages and only parses the
ones sent by "acpi_event" genl family.


Thanks,
Rui

On Sun, 2007-05-27 at 09:34 -0400, jamal wrote: 
> On 5/27/07, Zhang Rui <rui.zhang@intel.com> wrote:
> >
> > I need to write a user application to test my patch.
> > Netlink messages can be sent/received using the standard socket API.
> 
> sure.
> 
> > But how to receive Genetlink messages from specified genetlink family?
> > There is no socket ACPI with such a parameter, right?
> 
> Each module has a unique identifier that it receives dynamically on
>  insertion at the kernel.
> 
> > Do I have to receive all the genetlink messages first?
> 
>  No, just the ones for your dynamic id. Try what i described first for
>  kernel side on the earlier email. I will repeat it here for clarity.
> Then look at genl code and if you have questions i can
>  help.
> Note: You need to discover your dynamic id (the iproute2/genl code has a stub
> example code)
>  As i told you in the earlier email, in your development:
>  - start first by just writting your kernel side.
>  - Then use the genl utility - which is part of iproute2 to see if the
>  kernel side is "discoverable".
> 
>  E.g if i wanted to "discover" currently loaded modules on my laptop, i
>  would do this:
> 
>  ---------------
>  hadi@lilsol:~$ genl ctrl ls
> 
>  Name: nlctrl
>          ID: 0x10  Version: 0x2  header size: 0  max attribs: 6
>          commands supported:
>                  #1:  ID-0x3  flags-0xe
> 
> 
>  Name: nl80211
>          ID: 0x11  Version: 0x1  header size: 0  max attribs: 22
>          commands supported:
>                  #1:  ID-0x1  flags-0xa
>                  #2:  ID-0x6  flags-0xa
>                  #3:  ID-0x8  flags-0xa
>                  #4:  ID-0x3  flags-0xb
>                  #5:  ID-0x4  flags-0xb
>                  #6:  ID-0x5  flags-0xb
>                  #7:  ID-0xa  flags-0xb
>                  #8:  ID-0xb  flags-0xa
>                  #9:  ID-0xf  flags-0xb
>                  #10:  ID-0x10  flags-0xa
>                  #11:  ID-0x12  flags-0xb
>                  #12:  ID-0x13  flags-0xa
>                  #13:  ID-0x15  flags-0xa
>                  #14:  ID-0x19  flags-0xb
>                  #15:  ID-0x17  flags-0xb
>                  #16:  ID-0x18  flags-0xb
>                  #17:  ID-0x1a  flags-0xb
>                  #18:  ID-0x1b  flags-0xa
>                  #19:  ID-0xd  flags-0xb
> 
> 
>  Name: TASKSTATS
>          ID: 0x12  Version: 0x1  header size: 0  max attribs: 4
>          commands supported:
>                  #1:  ID-0x1  flags-0xa
>  ---------------------------
> 
>  As you can see, i can see from user space the name of the kernel end
>  point, its numeric id, what version it is running (so i can make sure
>  user space is compatible), what extra header it may have, what the
>  maximum number of attributes it can take. The last thing that gets
>  listed is the commands, and flags for those commands.
> 
>  Lets load tipc kernel module and repeat...
> 
>  -----------
> 
>  hadi@lilsol:~$ sudo modprobe tipc
>  Name: nlctrl
>          ID: 0x10  Version: 0x2  header size: 0  max attribs: 6
>          commands supported:
>                  #1:  ID-0x3  flags-0xe
> 
>  ....
>  [same as before]
>  ....
> 
>  Name: TIPC
>          ID: 0x13  Version: 0x1  header size: 8  max attribs: 0
>          commands supported:
>                  #1:  ID-0x1  flags-0x2
> 
>  ===============
> 
> > It would be great if there are any examples on user space communication.
> 
> 
> 
> Bug Thomas - he has written some simple example. I also have some but i
>  changed laptops and i have to go and dig it up for you.
>  I do have plans for making this easier for people - but havent had time.
>  If there is persistence - or someone out there wants to be a hero email
>  me privately and i will explain it.
> 
> > Or should I use libnl library instead?
> 
> Why am i answering all these questions if you are fine with using libnl?
> Last time you said you couldnt use a library, no?
> 
> cheers,
> jamal
> 
> 
> > Thanks,
> > Rui.
> >

[-- Attachment #2: acpi_genl.tgz --]
[-- Type: application/x-compressed-tar, Size: 8401 bytes --]

  reply	other threads:[~2007-06-14  8:59 UTC|newest]

Thread overview: 71+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-22  9:47 [PATCH] [-mm] ACPI: export ACPI events via netlink Zhang Rui
2007-05-22 10:05 ` Samuel Ortiz
2007-05-22 10:10   ` Evgeniy Polyakov
2007-05-22 11:03 ` jamal
2007-05-23  1:17   ` Zhang Rui
2007-05-27  9:40   ` Zhang Rui
     [not found]     ` <4466a10705270629h31977813hd2fc8330bcd87f78@mail.gmail.com>
2007-05-27 13:34       ` Fwd: " jamal
2007-06-14  8:59         ` Zhang Rui [this message]
2007-06-14 11:28           ` jamal
2007-06-15  1:01             ` Zhang Rui
2007-06-15 10:26               ` jamal
2007-06-18 15:01               ` jamal
2007-06-19  3:32                 ` Zhang Rui
2007-06-25 22:40                   ` Johannes Berg
2007-06-26 13:33                     ` jamal
2007-06-26 13:42                       ` Johannes Berg
2007-06-27 23:24                     ` jamal
2007-06-28  9:45                       ` Johannes Berg
2007-06-29 11:17                         ` jamal
2007-06-29 11:28                           ` Johannes Berg
2007-06-29 11:48                             ` jamal
2007-06-29 11:58                               ` Johannes Berg
2007-06-29 11:51                         ` Patrick McHardy
2007-06-29 11:59                           ` Johannes Berg
2007-06-29 12:04                             ` Patrick McHardy
2007-06-29 12:01                           ` jamal
2007-06-29 12:09                             ` Patrick McHardy
2007-06-29 12:46                           ` Johannes Berg
2007-06-29 12:48                             ` Patrick McHardy
2007-06-29 12:51                               ` Johannes Berg
2007-06-29 13:02                               ` jamal
2007-06-29 13:12                                 ` Patrick McHardy
2007-06-29 13:27                                   ` jamal
2007-06-29 13:32                                     ` Patrick McHardy
2007-06-29 13:13                                 ` Johannes Berg
2007-06-29 12:57                       ` Johannes Berg
2007-06-29 13:11                         ` Patrick McHardy
2007-06-29 13:15                           ` Johannes Berg
2007-06-29 13:23                             ` Patrick McHardy
2007-06-29 13:34                               ` Johannes Berg
2007-06-29 13:44                                 ` Patrick McHardy
2007-06-29 13:49                                   ` Johannes Berg
2007-06-29 13:53                                     ` Patrick McHardy
2007-06-29 14:05                                       ` Johannes Berg
2007-06-29 14:18                                         ` Johannes Berg
2007-06-29 14:56                                           ` Johannes Berg
2007-06-30 15:32                                             ` jamal
2007-07-02  8:43                                               ` Johannes Berg
2007-07-02 12:56                                                 ` Patrick McHardy
2007-07-02 14:34                                                   ` Johannes Berg
2007-07-02 14:38                                                     ` Patrick McHardy
2007-07-02 14:48                                                       ` Johannes Berg
2007-07-02 22:12                                                         ` Johannes Berg
2007-07-03 10:08                                                           ` [PATCH] netlink: allocate group bitmaps dynamically Johannes Berg
2007-07-03 12:05                                                             ` Patrick McHardy
2007-07-03 14:09                                                               ` Johannes Berg
2007-07-03 14:11                                                                 ` Patrick McHardy
2007-07-03 14:32                                                                   ` Johannes Berg
2007-07-03 23:13                                                                   ` Johannes Berg
2007-07-03 10:09                                                           ` [PATCH] netlink: allow removing multicast groups Johannes Berg
2007-07-03 10:10                                                           ` [PATCH] generic netlink: dynamic " Johannes Berg
2007-07-03 11:56                                                           ` Fwd: [PATCH] [-mm] ACPI: export ACPI events via netlink Patrick McHardy
2007-06-29 13:24                             ` jamal
2007-06-29 13:11                         ` jamal
2007-06-19 11:30                 ` Johannes Berg
2007-06-19 16:20                   ` jamal
2007-06-20 11:25                     ` Johannes Berg
2007-06-21 15:47                       ` jamal
2007-06-22 10:09                         ` Johannes Berg
2007-06-25 17:08                           ` jamal
2007-06-26  8:50                             ` Johannes Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1181811576.5411.27.camel@localhost.localdomain \
    --to=rui.zhang@intel.com \
    --cc=hadi@cyberus.ca \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).