mirror of
https://github.com/albfan/miraclecast.git
synced 2025-02-13 02:31:54 +00:00
miracle-wfdctl: add options -b and -r
add options -b and -r to control whether or not to acquiring or releasing ownershipt of WNIC Change-Id: Iaa9fdac15a7d1e23053b57500b978e0c026fa50c
This commit is contained in:
parent
b0d671c654
commit
011f2e0b98
1 changed files with 11 additions and 1 deletions
|
@ -80,6 +80,8 @@ private class WfdCtl : GLib.Application
|
|||
static string opt_authority;
|
||||
static int opt_monitor_num;
|
||||
static string opt_audio_device;
|
||||
static bool opt_dont_borrow_wnic = false;
|
||||
static bool opt_dont_return_wnic = false;
|
||||
|
||||
protected signal void link_added(string index, Link link);
|
||||
protected signal void link_removed(string index, Link link);
|
||||
|
@ -114,6 +116,8 @@ private class WfdCtl : GLib.Application
|
|||
{ "display", 'd', 0, OptionArg.STRING, ref opt_display, "display name. default: DISPLAY environment variable", "display name" },
|
||||
{ "monitor-num", 'm', 0, OptionArg.INT, ref opt_monitor_num, "monitor number. default: -1, primary monitor", "monitor number" },
|
||||
{ "audio-device", 'a', 0, OptionArg.STRING, ref opt_audio_device, "pulseaudio device name", "audio device name" },
|
||||
{ "dont-borrow", 'b', 0, OptionArg.NONE, ref opt_dont_borrow_wnic, "do not acquire the ownership of WNIC before using it", "don't borrow WNIC" },
|
||||
{ "dont-return", 'r', 0, OptionArg.NONE, ref opt_dont_return_wnic, "do not release the ownership of WNIC after using it", "don't release WNIC" },
|
||||
{ null },
|
||||
};
|
||||
|
||||
|
@ -552,6 +556,10 @@ private class WfdCtl : GLib.Application
|
|||
|
||||
private async void release_wnic_ownership() throws Error
|
||||
{
|
||||
if(opt_dont_return_wnic) {
|
||||
return;
|
||||
}
|
||||
|
||||
Link l = find_link_by_name(opt_iface);
|
||||
if(null == l) {
|
||||
throw new WfdCtlError.NO_SUCH_NIC("no such wireless adapter: %s",
|
||||
|
@ -575,7 +583,9 @@ private class WfdCtl : GLib.Application
|
|||
private async void start_wireless_display() throws Error
|
||||
{
|
||||
fetch_info_from_dbus();
|
||||
yield acquire_wnic_ownership();
|
||||
if(!opt_dont_borrow_wnic) {
|
||||
yield acquire_wnic_ownership();
|
||||
}
|
||||
yield start_p2p_scan();
|
||||
yield wait_for_target_sink();
|
||||
yield form_p2p_group();
|
||||
|
|
Loading…
Reference in a new issue