Ticket refs #921: TR-181: Device.USB. object

This commit is contained in:
Omar Kallel 2019-08-02 09:14:41 +01:00
parent b0f29f5102
commit 1ff8577dda
5 changed files with 1187 additions and 5 deletions

2
.gitignore vendored
View file

@ -27,4 +27,4 @@ missing
.dirstamp
.git_update
.pkgdir/
json/source_*

View file

@ -65,8 +65,10 @@ libdatamodel_la_SOURCES += \
../dm/dmtree/tr181/users.c \
../dm/dmtree/tr181/dhcpv6.c \
../dm/dmtree/tr181/dsl.c \
../dm/dmtree/tr181/interfacestack.c \
../dm/dmtree/tr181/qos.c
../dm/dmtree/tr181/interfacestack.c \
../dm/dmtree/tr181/qos.c \
../dm/dmtree/tr181/usb.c
if UPNP_TR064
libdatamodel_la_SOURCES += \
@ -96,7 +98,8 @@ libdatamodel_la_LIBADD = \
$(LIBUBOX_LIBS) \
$(LIBUBUS_LIBS) \
$(LIBJSON_LIBS) \
$(LBLOBMSG_LIBS)
$(LBLOBMSG_LIBS) \
-lusb-1.0
libdatamodel_la_CFLAGS+=-DCWMP_VERSION=\"$(CWMP_VERSION)\"
libdatamodel_la_LDFLAGS+=-DCWMP_VERSION=\"$(CWMP_VERSION)\"
@ -196,7 +199,8 @@ icwmpd_LDADD = \
$(LBLOBMSG_LIBS) \
$(LIBZ_LIBS) \
$(LIBM_LIBS) \
-ldatamodel
-ldatamodel \
-lusb-1.0
icwmpd_CFLAGS+=-DCWMP_VERSION=\"$(CWMP_VERSION)\"
icwmpd_LDFLAGS+=-DCWMP_VERSION=\"$(CWMP_VERSION)\"

View file

@ -57,6 +57,7 @@
#include "dhcpv6.h"
#include "interfacestack.h"
#include "qos.h"
#include "usb.h"
#ifdef UPNP_TR064
#include "upnp_deviceinfo.h"
@ -154,6 +155,7 @@ DMOBJ tRoot_181_Obj[] = {
{"DNS", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tDNSObj, tDNSParams, NULL},
{"Users", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tUsersObj, tUsersParams, NULL},
{"InterfaceStack", &DMREAD, NULL, NULL, NULL, browseInterfaceStackInst, NULL, NULL, NULL, tInterfaceStackParams, NULL},
{"USB", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tUSBObj, tUSBParams, NULL},
//{"QoS", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tQoSObj, tQoSParams, NULL},
#ifdef XMPP_ENABLE
{"XMPP", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL,tXMPPObj, tXMPPParams, NULL},

1050
dm/dmtree/tr181/usb.c Normal file

File diff suppressed because it is too large Load diff

126
dm/dmtree/tr181/usb.h Normal file
View file

@ -0,0 +1,126 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Copyright (C) 2019 iopsys Software Solutions AB
* Author: Omar Kallel <omar.kallel@pivasoftware.com>
*/
#ifndef __USB_H
#define __USB_H
#include <libusb-1.0/libusb.h>
extern DMOBJ tUSBObj[];
extern DMLEAF tUSBParams[];
extern DMOBJ tUSBInterfaceObj[];
extern DMLEAF tUSBInterfaceParams[];
extern DMLEAF tUSBInterfaceStatsParams[];
extern DMLEAF tUSBPortParams[];
extern DMOBJ tUSBUSBHostsObj[];
extern DMLEAF tUSBUSBHostsParams[];
extern DMOBJ tUSBUSBHostsHostObj[];
extern DMLEAF tUSBUSBHostsHostParams[];
extern DMOBJ tUSBUSBHostsHostDeviceObj[];
extern DMLEAF tUSBUSBHostsHostDeviceParams[];
extern DMOBJ tUSBUSBHostsHostDeviceConfigurationObj[];
extern DMLEAF tUSBUSBHostsHostDeviceConfigurationParams[];
extern DMLEAF tUSBUSBHostsHostDeviceConfigurationInterfaceParams[];
struct usbPort {
struct uci_section *dm_usb;
libusb_device *dev;
struct libusb_device_descriptor desc;
struct libusb_config_descriptor *config;
const struct libusb_interface_descriptor *interface;
char *name;
};
int browseUSBInterfaceInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browseUSBPortInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browseUSBUSBHostsHostInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browseUSBUSBHostsHostDeviceInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browseUSBUSBHostsHostDeviceConfigurationInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browseUSBUSBHostsHostDeviceConfigurationInterfaceInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int get_USB_InterfaceNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_USB_PortNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_USBInterface_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_USBInterface_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_USBInterface_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_USBInterface_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_USBInterface_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_USBInterface_Name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_USBInterface_LastChange(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_USBInterface_LowerLayers(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_USBInterface_LowerLayers(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_USBInterface_Upstream(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_USBInterface_MACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_USBInterface_MaxBitRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_USBInterface_Port(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_USBInterfaceStats_BytesSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_USBInterfaceStats_BytesReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_USBInterfaceStats_PacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_USBInterfaceStats_PacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_USBInterfaceStats_ErrorsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_USBInterfaceStats_ErrorsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_USBInterfaceStats_UnicastPacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_USBInterfaceStats_UnicastPacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_USBInterfaceStats_DiscardPacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_USBInterfaceStats_DiscardPacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_USBInterfaceStats_MulticastPacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_USBInterfaceStats_MulticastPacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_USBInterfaceStats_BroadcastPacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_USBInterfaceStats_BroadcastPacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_USBInterfaceStats_UnknownProtoPacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_USBPort_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_USBPort_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_USBPort_Name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_USBPort_Standard(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_USBPort_Type(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_USBPort_Receptacle(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_USBPort_Rate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_USBPort_Power(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_USBUSBHosts_HostNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_USBUSBHostsHost_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_USBUSBHostsHost_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_USBUSBHostsHost_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_USBUSBHostsHost_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_USBUSBHostsHost_Name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_USBUSBHostsHost_Type(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_USBUSBHostsHost_Reset(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_USBUSBHostsHost_Reset(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_USBUSBHostsHost_PowerManagementEnable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_USBUSBHostsHost_PowerManagementEnable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_USBUSBHostsHost_USBVersion(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_USBUSBHostsHost_DeviceNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_USBUSBHostsHostDevice_DeviceNumber(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_USBUSBHostsHostDevice_USBVersion(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_USBUSBHostsHostDevice_DeviceClass(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_USBUSBHostsHostDevice_DeviceSubClass(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_USBUSBHostsHostDevice_DeviceVersion(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_USBUSBHostsHostDevice_DeviceProtocol(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_USBUSBHostsHostDevice_ProductID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_USBUSBHostsHostDevice_VendorID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_USBUSBHostsHostDevice_Manufacturer(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_USBUSBHostsHostDevice_ProductClass(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_USBUSBHostsHostDevice_SerialNumber(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_USBUSBHostsHostDevice_Port(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_USBUSBHostsHostDevice_USBPort(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_USBUSBHostsHostDevice_Rate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_USBUSBHostsHostDevice_Parent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_USBUSBHostsHostDevice_MaxChildren(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_USBUSBHostsHostDevice_IsSuspended(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_USBUSBHostsHostDevice_IsSelfPowered(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_USBUSBHostsHostDevice_ConfigurationNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_USBUSBHostsHostDeviceConfiguration_ConfigurationNumber(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_USBUSBHostsHostDeviceConfiguration_InterfaceNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_USBUSBHostsHostDeviceConfigurationInterface_InterfaceNumber(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_USBUSBHostsHostDeviceConfigurationInterface_InterfaceClass(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_USBUSBHostsHostDeviceConfigurationInterface_InterfaceSubClass(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_USBUSBHostsHostDeviceConfigurationInterface_InterfaceProtocol(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_linker_usb_port(char *refparam, struct dmctx *dmctx, void *data, char *instance, char **linker);
#endif //__USB_H