Skip to content

Commit

Permalink
Obtaining device IP now uses only wlan0, minor changes to string valu…
Browse files Browse the repository at this point in the history
…es (mostly errors), added manual entry of device IP.
  • Loading branch information
Sergey004 committed Dec 8, 2023
1 parent 3ebb884 commit 89111c2
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 25 deletions.
16 changes: 13 additions & 3 deletions Quest2-VRC.Core/Modules/ADB.cs
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,10 @@ public static string GetIP()
device = client.GetDevices().FirstOrDefault();
Thread.Sleep(500);
ConsoleOutputReceiver ipquery = new ConsoleOutputReceiver();
client.ExecuteRemoteCommand("ip route", device, ipquery);
client.ExecuteRemoteCommand("ip route | grep wlan0", device, ipquery);
deviceip = Regex.Match(ipquery.ToString(), @"\S*\d+", RegexOptions.RightToLeft).ToString();


return deviceip;
}
public static async Task<string> GetZeroConfIP()
Expand Down Expand Up @@ -231,8 +232,17 @@ public static void StopADB()
{
if (!AdbServer.Instance.GetStatus().IsRunning == false)
{
client.KillAdb();
Environment.Exit(1987);
try

{
client.KillAdb();
Environment.Exit(1987);
}
catch
{
// IDK how thos works
}

}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace Quest2_VRC
{

public class Check_Device
public class Device_Management
{

private static readonly string DeviceName = "Oculus Composite ADB Interface";
Expand All @@ -29,5 +29,8 @@ public static bool CheckDevice()
}
return deviceConnected;
}



}
}
4 changes: 2 additions & 2 deletions Quest2-VRC.Core/Services/Sender.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,10 @@ public static async Task questwd(int Uport, bool wirlessmode, bool audioEnadled,
catch (AdbException)
{
string inputbox = "input";
LogToConsole("Error: Connection to the headset is lost! Waiting for reconnect...");
LogToConsole("Error: headset has been disconnected or has entered sleep mode! Waiting for reconnection...");
if (disableerrmsg == false)
{
VRChatMessage MsgErr = new VRChatMessage(inputbox, "Error: Connection to the headset is lost! Waiting for reconnect...");
VRChatMessage MsgErr = new VRChatMessage(inputbox, "Error: headset has been disconnected or has entered sleep mode! Waiting for reconnection...");
SendPacket(MsgErr);
}
await Task.Delay(1000);
Expand Down
9 changes: 7 additions & 2 deletions Quest2-VRC.GUI/MainWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ private async void materialSwitch1_CheckedChanged(object sender, EventArgs e)
if (materialSwitch1.Checked)
{
materialLabel5.Text = resources.GetString("TCPIPmode");
DialogResult dialogResult1 = MessageBox.Show(resources.GetString("NewOrOld"), resources.GetString("ADBInTCPIP"), MessageBoxButtons.YesNo, MessageBoxIcon.Question);
DialogResult dialogResult1 = MessageBox.Show(resources.GetString("NewOrOld"), resources.GetString("ADBInTCPIP"), MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
if (dialogResult1 == DialogResult.Yes)
{
MessageBox.Show(resources.GetString("WakeDevice"), resources.GetString("ADBInTCPIP"), MessageBoxButtons.OK, MessageBoxIcon.Information);
Expand All @@ -334,7 +334,7 @@ private async void materialSwitch1_CheckedChanged(object sender, EventArgs e)
else if (dialogResult1 == DialogResult.No)
{
MessageBox.Show(resources.GetString("USBCon"), resources.GetString("ADBInTCPIP"), MessageBoxButtons.OK, MessageBoxIcon.Information);
if (Check_Device.CheckDevice())
if (Device_Management.CheckDevice())
{

ADB.StartTCPIP();
Expand All @@ -350,6 +350,11 @@ private async void materialSwitch1_CheckedChanged(object sender, EventArgs e)
}

}
else if (dialogResult1 == DialogResult.Cancel)
{
materialTextBox1.Enabled = true;
MessageBox.Show(resources.GetString("Manualinput"), resources.GetString("ADBInTCPIP"), MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}

Expand Down
14 changes: 10 additions & 4 deletions Quest2-VRC.GUI/MainWindow.en-US.resx
Original file line number Diff line number Diff line change
Expand Up @@ -2976,13 +2976,13 @@
<value>1) Connect the headset to your computer
2) Set the switch to "AirLink (or VD)".
3) Wait for ADB to switch to TCPIP mode.
4) Click the "Start by Default" button to connect.
4) Click the "Default run" button to connect.

If this does not work
Connecting manually
Enter
"platform-tools\adb tcpip 5555"
"platform-tools\\\\adb connect QUEST_IP:5555."</value>
"platform-tools\adb connect QUEST_IP:5555."</value>
</data>
<data name="Error" xml:space="preserve">
<value>Error</value>
Expand Down Expand Up @@ -3056,8 +3056,11 @@ Note that this action will stop the ADB server (if rinning)</value>
</data>
<data name="NewOrOld" xml:space="preserve">
<value>Do you want the program to find the IP address the old way or with ZeroConf?
ZeroConf requires an additional program to be installed on Quest "https://github.com/Sergey004/Quest2-VRC/releases/tag/Finaly". (Yes, that's what it's called).
Yes for ZeroConf, No for the old method.</value>
ZeroConf requires an additional program to be installed on Quest
"https://github.com/Sergey004/Quest2-VRC/releases/tag/Finaly". (Yes, that's what it's called).
"Yes" for ZeroConf,
"No" for the old method,
"Cancel" for manual IP entry.</value>
</data>
<data name="NoADB" xml:space="preserve">
<value>No ADB mode</value>
Expand Down Expand Up @@ -3095,4 +3098,7 @@ Yes for ZeroConf, No for the old method.</value>
<data name="$this.Text" xml:space="preserve">
<value>Quest2-VRC GUI</value>
</data>
<data name="Manualinput" xml:space="preserve">
<value>The input box has been unlocked for manual entry</value>
</data>
</root>
3 changes: 3 additions & 0 deletions Quest2-VRC.GUI/MainWindow.resx
Original file line number Diff line number Diff line change
Expand Up @@ -3640,4 +3640,7 @@
<data name="Ready" xml:space="preserve">
<value></value>
</data>
<data name="Manualinput" xml:space="preserve">
<value></value>
</data>
</root>
16 changes: 11 additions & 5 deletions Quest2-VRC.GUI/MainWindow.ru-RU.resx
Original file line number Diff line number Diff line change
Expand Up @@ -3060,13 +3060,13 @@
<value>1) Подключите гарнитуру к компьютеру
2) Переведите переключатель в положение "AirLink (или VD)".
3) Дождитесь, пока ADB переключится в режим TCPIP.
4) Нажмите кнопку "Запуск по умолчанию" для подключения.
4) Нажмите кнопку "Запустить все" для подключения.

Если это не работает
Подключение вручную
Введите
"platform-tools\adb tcpip 5555"
"platform-tools\\\adb connect QUEST_IP:5555"</value>
"platform-tools\adb connect QUEST_IP:5555"</value>
</data>
<data name="Error" xml:space="preserve">
<value>Ошибка</value>
Expand All @@ -3086,8 +3086,11 @@
</data>
<data name="NewOrOld" xml:space="preserve">
<value>Вы хотите, чтобы программа находила IP-адрес старым способом или с помощью ZeroConf?
Поиск через ZeroConf требует установки дополнительной программы на Quest "https://github.com/Sergey004/Quest2-VRC/releases/tag/Finaly". (Да оно именно так и называеться)
Да для ZeroConf, Нет для старого метода</value>
Поиск через ZeroConf требует установки дополнительной программы на Quest
"https://github.com/Sergey004/Quest2-VRC/releases/tag/Finaly". (Да оно именно так и называеться)
"Да" для ZeroConf,
"Нет" для старого метода,
"Отмена" для ручного ввода IP</value>
</data>
<data name="NoADB" xml:space="preserve">
<value>Нет режима ADB</value>
Expand Down Expand Up @@ -3132,6 +3135,9 @@
<value>Status msg</value>
</data>
<data name="materialLabel4.Text" xml:space="preserve">
<value>Status msg</value>
<value>commit</value>
</data>
<data name="Manualinput" xml:space="preserve">
<value>Строка ввода была разблокирована для ручного ввода</value>
</data>
</root>
9 changes: 2 additions & 7 deletions Quest2-VRC.GUI/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,17 +96,12 @@ static void GUI()
}
else
{
try
{

Application.EnableVisualStyles();
Application.SetHighDpiMode(HighDpiMode.SystemAware);
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainWindow());
}
catch (SystemException)
{
// Ignores errors
}


}

Expand Down
2 changes: 1 addition & 1 deletion Quest2-VRC.GUI/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"profiles": {
"Quest2-VRC.GUI": {
"commandName": "Project",
"commandLineArgs": "-eoc"
"commandLineArgs": ""
}
}
}

0 comments on commit 89111c2

Please sign in to comment.