Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
DSerial
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
apps
DSerial
Commits
3bf25783
Commit
3bf25783
authored
9 years ago
by
Isabella Skořepová
Browse files
Options
Downloads
Patches
Plain Diff
Print server version on interactive start too
+ Fix history saving for ^D
parent
3e373b84
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dserial-cli/src/commands/InteractiveCommand.vala
+3
-1
3 additions, 1 deletion
dserial-cli/src/commands/InteractiveCommand.vala
dserial-cli/src/dbus-serial-client.vala
+19
-0
19 additions, 0 deletions
dserial-cli/src/dbus-serial-client.vala
with
22 additions
and
1 deletion
dserial-cli/src/commands/InteractiveCommand.vala
+
3
−
1
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
);
...
...
This diff is collapsed.
Click to expand it.
dserial-cli/src/dbus-serial-client.vala
+
19
−
0
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
*=====================================*/
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment