Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
apps
DSerial
Commits
3bf25783
Commit
3bf25783
authored
Aug 27, 2015
by
Isabella Skořepová
Browse files
Print server version on interactive start too
+ Fix history saving for ^D
parent
3e373b84
Changes
2
Hide whitespace changes
Inline
Side-by-side
dserial-cli/src/commands/InteractiveCommand.vala
View file @
3bf25783
...
...
@@ -75,7 +75,7 @@ public class InteractiveCommand : Object, Command
state
.
interactive
=
true
;
stdout
.
printf
(
"dserial: Serial communication program\n"
);
stdout
.
printf
(
"License: GPL3+\n"
);
stdout
.
printf
(
"Version: 0.5
\n"
);
stdout
.
printf
(
"Version: 0.5
.1\t\t\tServer version: %s\n"
,
Serial
.
get_server_version
()
);
stdout
.
printf
(
"Write help for help\n"
);
Readline
.
History
.
read
(
Environment
.
get_variable
(
"HOME"
)+
"/.dserial-history"
);
Readline
.
attempted_completion_function
=
readline_completion
;
...
...
@@ -87,6 +87,8 @@ public class InteractiveCommand : Object, Command
if
(
line
==
null
)
{
stdout
.
printf
(
"\n"
);
run_func
(
state
,{
"exit"
});
Readline
.
History
.
write
(
Environment
.
get_variable
(
"HOME"
)+
"/.dserial-history"
);
Readline
.
History
.
truncate_file
(
Environment
.
get_variable
(
"HOME"
)+
"/.dserial-history"
,
256
);
return
0
;
}
Readline
.
History
.
add
(
line
);
...
...
dserial-cli/src/dbus-serial-client.vala
View file @
3bf25783
...
...
@@ -112,6 +112,25 @@ public string[] get_ports() {
return
{};
}
/*=====================================
* Get server version
*=====================================*/
public
string
get_server_version
()
{
if
(
DEBUG_OUTPUT
)
stdout
.
printf
(
"get_server_version\n"
);
try
{
return
GLib
.
Bus
.
get_sync
(
BusType
.
SESSION
).
call_sync
(
"info.skorepa.DSerial1"
,
"/controller"
,
"org.freedesktop.DBus.Properties"
,
"Get"
,
new
Variant
(
"(ss)"
,
"info.skorepa.DSerial1.controller"
,
"ServerVersion"
),
null
,
DBusCallFlags
.
NONE
,
1000
).
get_child_value
(
0
).
get_variant
().
get_string
();
}
catch
(
Error
e
)
{}
return
"UNKNOWN"
;
}
/*=====================================
* Return object name for file name
*=====================================*/
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment