diff options
author | Jesse Gilles <jgilles@multitech.com> | 2010-07-27 14:38:09 -0500 |
---|---|---|
committer | Jesse Gilles <jgilles@multitech.com> | 2010-07-27 14:38:09 -0500 |
commit | b3556e09b09136ac6b4435b2ccd1f57a13365535 (patch) | |
tree | 74a29854b11d1e0fa629250686e9adab221ac63f /io-module/mts_io.c | |
parent | eee8f03b6f9a49fe072533d5aa4795d4df4ae539 (diff) | |
download | mts-io-b3556e09b09136ac6b4435b2ccd1f57a13365535.tar.gz mts-io-b3556e09b09136ac6b4435b2ccd1f57a13365535.tar.bz2 mts-io-b3556e09b09136ac6b4435b2ccd1f57a13365535.zip |
add extserial-dtr
* Add ability to read DTR pin on external serial port
Diffstat (limited to 'io-module/mts_io.c')
-rw-r--r-- | io-module/mts_io.c | 28 |
1 files changed, 28 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, |