mirror of git://git.sysmocom.de/ofono
gisi: provide modem identifier through Netlink API
This commit is contained in:
parent
ffcbb25105
commit
20f73898ec
|
@ -408,12 +408,12 @@ static struct ofono_modem_attribute_ops ops = {
|
|||
.query_serial = isi_query_serial
|
||||
};
|
||||
|
||||
static void netlink_status_cb(bool up, uint8_t addr, unsigned idx,
|
||||
static void netlink_status_cb(bool up, uint8_t addr, GIsiModem *idx,
|
||||
void *data)
|
||||
{
|
||||
struct isi_data *isi = data;
|
||||
|
||||
DBG("PhoNet is %s, addr=0x%02x, idx=%d",
|
||||
DBG("PhoNet is %s, addr=0x%02x, idx=%p",
|
||||
up ? "up" : "down", addr, idx);
|
||||
|
||||
if (up) {
|
||||
|
|
|
@ -48,6 +48,11 @@ struct _GPhonetNetlink {
|
|||
guint watch;
|
||||
};
|
||||
|
||||
static inline GIsiModem *make_modem(unsigned idx)
|
||||
{
|
||||
return (void *)(uintptr_t)idx;
|
||||
}
|
||||
|
||||
/* Parser Netlink messages */
|
||||
static gboolean g_pn_nl_process(GIOChannel *channel, GIOCondition cond,
|
||||
gpointer data)
|
||||
|
@ -108,7 +113,8 @@ static gboolean g_pn_nl_process(GIOChannel *channel, GIOCondition cond,
|
|||
rta = RTA_NEXT(rta, len))
|
||||
if (rta->rta_type == IFA_LOCAL)
|
||||
memcpy(&addr, RTA_DATA(rta), 1);
|
||||
self->callback(up, addr, ifa->ifa_index, self->opaque);
|
||||
self->callback(up, addr,
|
||||
make_modem(ifa->ifa_index), self->opaque);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <gisi/modem.h>
|
||||
|
||||
#ifndef __GPHONET_NETLINK_H
|
||||
#define __GPHONET_NETLINK_H
|
||||
|
@ -34,7 +35,7 @@ extern "C" {
|
|||
struct _GPhonetNetlink;
|
||||
typedef struct _GPhonetNetlink GPhonetNetlink;
|
||||
|
||||
typedef void (*GPhonetNetlinkFunc)(bool up, uint8_t addr, unsigned idx,
|
||||
typedef void (*GPhonetNetlinkFunc)(bool up, uint8_t addr, GIsiModem *idx,
|
||||
void *data);
|
||||
|
||||
GPhonetNetlink *g_pn_netlink_start(GPhonetNetlinkFunc func, void *data);
|
||||
|
|
Loading…
Reference in New Issue