summaryrefslogtreecommitdiffstats
path: root/main.vala
diff options
context:
space:
mode:
authorSebastian Reichel <sre@ring0.de>2012-05-16 06:26:42 +0200
committerSebastian Reichel <sre@ring0.de>2012-05-16 06:26:42 +0200
commit75673821b1e3bf5c72b61a10bf9a6efa10188c4a (patch)
treea6b7bb1c8309fe46746305547d0d5b15093dd476 /main.vala
parent6eece4cc060f0957e93d775244afc82491cecb69 (diff)
downloadserial-barcode-scanner-75673821b1e3bf5c72b61a10bf9a6efa10188c4a.tar.bz2
add support for our status LED
Diffstat (limited to 'main.vala')
-rw-r--r--main.vala13
1 files changed, 13 insertions, 0 deletions
diff --git a/main.vala b/main.vala
index 97eb612..b5fd816 100644
--- a/main.vala
+++ b/main.vala
@@ -14,6 +14,14 @@ public static int main(string[] args) {
while(true) {
uint8 buf[64];
+ uint8 buf2[64] = {0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
+
int size = (int) Posix.read(s.fd, buf, 64);
for(int i = 0; i < size; i++)
@@ -22,6 +30,11 @@ public static int main(string[] args) {
} else {
if(detected.length > 0) {
detected += '\0';
+
+ /* use led as feedback */
+ Posix.write(s.fd, buf2, 64);
+ Posix.tcflush(s.fd, Posix.TCOFLUSH);
+
interpret((string) detected);
}
detected = {};