|
|
|
@ -214,6 +214,7 @@ static BUS_ATTR_READER(linecompat_show, dev, buf)
|
|
|
|
|
return len;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0)
|
|
|
|
|
static struct device_attribute span_dev_attrs[] = {
|
|
|
|
|
__ATTR_RO(name),
|
|
|
|
|
__ATTR_RO(desc),
|
|
|
|
@ -230,6 +231,39 @@ static struct device_attribute span_dev_attrs[] = {
|
|
|
|
|
__ATTR_RO(linecompat),
|
|
|
|
|
__ATTR_NULL,
|
|
|
|
|
};
|
|
|
|
|
#else
|
|
|
|
|
static DEVICE_ATTR_RO(name);
|
|
|
|
|
static DEVICE_ATTR_RO(desc);
|
|
|
|
|
static DEVICE_ATTR_RO(spantype);
|
|
|
|
|
static DEVICE_ATTR_RO(local_spanno);
|
|
|
|
|
static DEVICE_ATTR_RO(alarms);
|
|
|
|
|
static DEVICE_ATTR_RO(lbo);
|
|
|
|
|
static DEVICE_ATTR_RO(syncsrc);
|
|
|
|
|
static DEVICE_ATTR_RO(is_digital);
|
|
|
|
|
static DEVICE_ATTR_RO(is_sync_master);
|
|
|
|
|
static DEVICE_ATTR_RO(basechan);
|
|
|
|
|
static DEVICE_ATTR_RO(channels);
|
|
|
|
|
static DEVICE_ATTR_RO(lineconfig);
|
|
|
|
|
static DEVICE_ATTR_RO(linecompat);
|
|
|
|
|
|
|
|
|
|
static struct attribute *span_dev_attrs[] = {
|
|
|
|
|
&dev_attr_name.attr,
|
|
|
|
|
&dev_attr_desc.attr,
|
|
|
|
|
&dev_attr_spantype.attr,
|
|
|
|
|
&dev_attr_local_spanno.attr,
|
|
|
|
|
&dev_attr_lbo.attr,
|
|
|
|
|
&dev_attr_alarms.attr,
|
|
|
|
|
&dev_attr_syncsrc.attr,
|
|
|
|
|
&dev_attr_is_digital.attr,
|
|
|
|
|
&dev_attr_is_sync_master.attr,
|
|
|
|
|
&dev_attr_basechan.attr,
|
|
|
|
|
&dev_attr_channels.attr,
|
|
|
|
|
&dev_attr_lineconfig.attr,
|
|
|
|
|
&dev_attr_linecompat.attr,
|
|
|
|
|
NULL,
|
|
|
|
|
};
|
|
|
|
|
ATTRIBUTE_GROUPS(span_dev);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
static ssize_t master_span_show(struct device_driver *driver, char *buf)
|
|
|
|
|
{
|
|
|
|
@ -270,7 +304,11 @@ static struct bus_type spans_bus_type = {
|
|
|
|
|
.name = "dahdi_spans",
|
|
|
|
|
.match = span_match,
|
|
|
|
|
.uevent = span_uevent,
|
|
|
|
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0)
|
|
|
|
|
.dev_attrs = span_dev_attrs,
|
|
|
|
|
#else
|
|
|
|
|
.dev_groups = span_dev_groups,
|
|
|
|
|
#endif
|
|
|
|
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
|
|
|
|
|
.drv_attrs = dahdi_attrs,
|
|
|
|
|
#else
|
|
|
|
@ -482,7 +520,7 @@ static int device_uevent(struct device *dev, struct kobj_uevent_env *kenv)
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
static ssize_t
|
|
|
|
|
dahdi_device_manufacturer_show(struct device *dev,
|
|
|
|
|
manufacturer_show(struct device *dev,
|
|
|
|
|
struct device_attribute *attr, char *buf)
|
|
|
|
|
{
|
|
|
|
|
struct dahdi_device *ddev = to_ddev(dev);
|
|
|
|
@ -490,7 +528,7 @@ dahdi_device_manufacturer_show(struct device *dev,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static ssize_t
|
|
|
|
|
dahdi_device_type_show(struct device *dev,
|
|
|
|
|
type_show(struct device *dev,
|
|
|
|
|
struct device_attribute *attr, char *buf)
|
|
|
|
|
{
|
|
|
|
|
struct dahdi_device *ddev = to_ddev(dev);
|
|
|
|
@ -498,7 +536,7 @@ dahdi_device_type_show(struct device *dev,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static ssize_t
|
|
|
|
|
dahdi_device_span_count_show(struct device *dev,
|
|
|
|
|
span_count_show(struct device *dev,
|
|
|
|
|
struct device_attribute *attr, char *buf)
|
|
|
|
|
{
|
|
|
|
|
struct dahdi_device *ddev = to_ddev(dev);
|
|
|
|
@ -512,7 +550,7 @@ dahdi_device_span_count_show(struct device *dev,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static ssize_t
|
|
|
|
|
dahdi_device_hardware_id_show(struct device *dev,
|
|
|
|
|
hardware_id_show(struct device *dev,
|
|
|
|
|
struct device_attribute *attr, char *buf)
|
|
|
|
|
{
|
|
|
|
|
struct dahdi_device *ddev = to_ddev(dev);
|
|
|
|
@ -522,7 +560,7 @@ dahdi_device_hardware_id_show(struct device *dev,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static ssize_t
|
|
|
|
|
dahdi_device_location_show(struct device *dev,
|
|
|
|
|
location_show(struct device *dev,
|
|
|
|
|
struct device_attribute *attr, char *buf)
|
|
|
|
|
{
|
|
|
|
|
struct dahdi_device *ddev = to_ddev(dev);
|
|
|
|
@ -532,7 +570,7 @@ dahdi_device_location_show(struct device *dev,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static ssize_t
|
|
|
|
|
dahdi_device_auto_assign(struct device *dev, struct device_attribute *attr,
|
|
|
|
|
auto_assign_store(struct device *dev, struct device_attribute *attr,
|
|
|
|
|
const char *buf, size_t count)
|
|
|
|
|
{
|
|
|
|
|
struct dahdi_device *ddev = to_ddev(dev);
|
|
|
|
@ -541,7 +579,7 @@ dahdi_device_auto_assign(struct device *dev, struct device_attribute *attr,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static ssize_t
|
|
|
|
|
dahdi_device_assign_span(struct device *dev, struct device_attribute *attr,
|
|
|
|
|
assign_span_store(struct device *dev, struct device_attribute *attr,
|
|
|
|
|
const char *buf, size_t count)
|
|
|
|
|
{
|
|
|
|
|
int ret;
|
|
|
|
@ -576,7 +614,7 @@ dahdi_device_assign_span(struct device *dev, struct device_attribute *attr,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static ssize_t
|
|
|
|
|
dahdi_device_unassign_span(struct device *dev, struct device_attribute *attr,
|
|
|
|
|
unassign_span_store(struct device *dev, struct device_attribute *attr,
|
|
|
|
|
const char *buf, size_t count)
|
|
|
|
|
{
|
|
|
|
|
int ret;
|
|
|
|
@ -690,25 +728,56 @@ dahdi_registration_time_show(struct device *dev,
|
|
|
|
|
return count;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0)
|
|
|
|
|
static struct device_attribute dahdi_device_attrs[] = {
|
|
|
|
|
__ATTR(manufacturer, S_IRUGO, dahdi_device_manufacturer_show, NULL),
|
|
|
|
|
__ATTR(type, S_IRUGO, dahdi_device_type_show, NULL),
|
|
|
|
|
__ATTR(span_count, S_IRUGO, dahdi_device_span_count_show, NULL),
|
|
|
|
|
__ATTR(hardware_id, S_IRUGO, dahdi_device_hardware_id_show, NULL),
|
|
|
|
|
__ATTR(location, S_IRUGO, dahdi_device_location_show, NULL),
|
|
|
|
|
__ATTR(auto_assign, S_IWUSR, NULL, dahdi_device_auto_assign),
|
|
|
|
|
__ATTR(assign_span, S_IWUSR, NULL, dahdi_device_assign_span),
|
|
|
|
|
__ATTR(unassign_span, S_IWUSR, NULL, dahdi_device_unassign_span),
|
|
|
|
|
__ATTR(manufacturer, S_IRUGO, manufacturer_show, NULL),
|
|
|
|
|
__ATTR(type, S_IRUGO, type_show, NULL),
|
|
|
|
|
__ATTR(span_count, S_IRUGO, span_count_show, NULL),
|
|
|
|
|
__ATTR(hardware_id, S_IRUGO, hardware_id_show, NULL),
|
|
|
|
|
__ATTR(location, S_IRUGO, location_show, NULL),
|
|
|
|
|
__ATTR(auto_assign, S_IWUSR, NULL, auto_assign_store),
|
|
|
|
|
__ATTR(assign_span, S_IWUSR, NULL, assign_span_store),
|
|
|
|
|
__ATTR(unassign_span, S_IWUSR, NULL, unassign_span_store),
|
|
|
|
|
__ATTR(spantype, S_IWUSR | S_IRUGO, dahdi_spantype_show,
|
|
|
|
|
dahdi_spantype_store),
|
|
|
|
|
__ATTR(registration_time, S_IRUGO, dahdi_registration_time_show, NULL),
|
|
|
|
|
__ATTR_NULL,
|
|
|
|
|
};
|
|
|
|
|
#else
|
|
|
|
|
static DEVICE_ATTR_RO(manufacturer);
|
|
|
|
|
static DEVICE_ATTR_RO(type);
|
|
|
|
|
static DEVICE_ATTR_RO(span_count);
|
|
|
|
|
static DEVICE_ATTR_RO(hardware_id);
|
|
|
|
|
static DEVICE_ATTR_RO(location);
|
|
|
|
|
static DEVICE_ATTR_WO(auto_assign);
|
|
|
|
|
static DEVICE_ATTR_WO(assign_span);
|
|
|
|
|
static DEVICE_ATTR_WO(unassign_span);
|
|
|
|
|
static DEVICE_ATTR_RW(dahdi_spantype);
|
|
|
|
|
static DEVICE_ATTR_RO(dahdi_registration_time);
|
|
|
|
|
static struct attribute *dahdi_device_attrs[] = {
|
|
|
|
|
&dev_attr_manufacturer.attr,
|
|
|
|
|
&dev_attr_type.attr,
|
|
|
|
|
&dev_attr_span_count.attr,
|
|
|
|
|
&dev_attr_hardware_id.attr,
|
|
|
|
|
&dev_attr_location.attr,
|
|
|
|
|
&dev_attr_auto_assign.attr,
|
|
|
|
|
&dev_attr_assign_span.attr,
|
|
|
|
|
&dev_attr_unassign_span.attr,
|
|
|
|
|
&dev_attr_dahdi_spantype.attr,
|
|
|
|
|
&dev_attr_dahdi_registration_time.attr,
|
|
|
|
|
NULL,
|
|
|
|
|
};
|
|
|
|
|
ATTRIBUTE_GROUPS(dahdi_device);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
static struct bus_type dahdi_device_bus = {
|
|
|
|
|
.name = "dahdi_devices",
|
|
|
|
|
.uevent = device_uevent,
|
|
|
|
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0)
|
|
|
|
|
.dev_attrs = dahdi_device_attrs,
|
|
|
|
|
#else
|
|
|
|
|
.dev_groups = dahdi_device_groups,
|
|
|
|
|
#endif
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static void dahdi_sysfs_cleanup(void)
|
|
|
|
|