summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Fiore <mfiore@multitech.com>2013-08-12 11:56:12 -0500
committerMike Fiore <mfiore@multitech.com>2013-08-12 11:56:12 -0500
commita7eb04eef347e5481a42a3afd0bcd038e1b4acda (patch)
tree204f51cf667b57c8961114c452ba91f4dcdff6b7
parent5b405021260a35757d594bddc313b75d2c15a994 (diff)
downloadmts-io-a7eb04eef347e5481a42a3afd0bcd038e1b4acda.tar.gz
mts-io-a7eb04eef347e5481a42a3afd0bcd038e1b4acda.tar.bz2
mts-io-a7eb04eef347e5481a42a3afd0bcd038e1b4acda.zip
add option to set serial-mode to hw loopback
-rw-r--r--io-module/mts_io.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/io-module/mts_io.c b/io-module/mts_io.c
index 211dbc4..4d2bc64 100644
--- a/io-module/mts_io.c
+++ b/io-module/mts_io.c
@@ -596,7 +596,7 @@ static struct gpio_pin gpio_pins_mtr2_0_0[] = {
.attr_name = "serial_mode",
.pin = AT91_PIN_PC23,
.direction = GPIO_DIR_OUTPUT,
- .output_value = 1,
+ .output_value = 0,
.use_pullup = 0,
},
{
@@ -2281,6 +2281,8 @@ static ssize_t mts_attr_show_serial_mode(struct device *dev,
ret = sprintf(buf, "rs485\n");
else if (smode2 == 1 && smode1 == 0 && smode0 == 0)
ret = sprintf(buf, "rs422\n");
+ else if (smode2 == 0 && smode1 == 0 && smode0 == 0)
+ ret = sprintf(buf, "loopback\n");
else
ret = sprintf(buf, "error\n");
@@ -2317,6 +2319,11 @@ static ssize_t mts_attr_store_serial_mode(struct device *dev,
smode1 = 0;
smode0 = 0;
}
+ else if (!strcasecmp(buf, "loopback")) {
+ smode2 = 0;
+ smode1 = 0;
+ smode0 = 0;
+ }
else {
return -EINVAL;
}