summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--io-module/mts_io.c28
-rwxr-xr-xio-tool/mts-io-sysfs1
-rwxr-xr-xio-tool/sysfs-tests8
3 files changed, 37 insertions, 0 deletions
diff --git a/io-module/mts_io.c b/io-module/mts_io.c
index 3609d1a..bc5db24 100644
--- a/io-module/mts_io.c
+++ b/io-module/mts_io.c
@@ -481,6 +481,33 @@ static struct device_attribute dev_attr_extserial_dsr = {
.store = store_extserial_dsr,
};
+static ssize_t show_extserial_dtr(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
+{
+ int value;
+
+ mutex_lock(&mts_io_mutex);
+
+ value = !at91_get_gpio_value(GPIO_DTR1);
+
+ mutex_unlock(&mts_io_mutex);
+
+ if (value < 0) {
+ return value;
+ }
+
+ return sprintf(buf, "%d\n", value);
+}
+
+static struct device_attribute dev_attr_extserial_dtr = {
+ .attr = {
+ .name = "extserial-dtr",
+ .mode = 0444,
+ },
+ .show = show_extserial_dtr,
+};
+
static ssize_t show_led_sig1(struct device *dev,
struct device_attribute *attr,
char *buf)
@@ -970,6 +997,7 @@ static struct attribute *platform_attributes[] = {
&dev_attr_extserial_dcd.attr,
&dev_attr_extserial_ri.attr,
&dev_attr_extserial_dsr.attr,
+ &dev_attr_extserial_dtr.attr,
&dev_attr_led_sig1.attr,
&dev_attr_led_sdk_c.attr,
&dev_attr_led_sig2.attr,
diff --git a/io-tool/mts-io-sysfs b/io-tool/mts-io-sysfs
index de06bb9..911dce1 100755
--- a/io-tool/mts-io-sysfs
+++ b/io-tool/mts-io-sysfs
@@ -76,6 +76,7 @@ usage() {
printf " extserial-dcd |\n" >&${out}
printf " extserial-ri |\n" >&${out}
printf " extserial-dsr |\n" >&${out}
+ printf " extserial-dtr |\n" >&${out}
printf " led-cd |\n" >&${out}
printf " led-sdk-b |\n" >&${out}
printf " led-sig1 |\n" >&${out}
diff --git a/io-tool/sysfs-tests b/io-tool/sysfs-tests
index 3c55a3d..fb465b4 100755
--- a/io-tool/sysfs-tests
+++ b/io-tool/sysfs-tests
@@ -133,10 +133,18 @@ show_assert extserial-dcd 0
store_assert extserial-dcd 1
store_assert extserial-dcd 0
+show_assert extserial-dsr 0
+store_assert extserial-dsr 1
+store_assert extserial-dsr 0
+
show_assert extserial-ri 0
store_assert extserial-ri 1
store_assert extserial-ri 0
+show_assert extserial-dtr 0
+store extserial-dtr 1
+show_assert extserial-dtr 0
+
show_assert led-sig1 0
store_assert led-sig1 1
store_assert led-sig1 0