Compare commits
6 Commits
65797379cc
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
| a60bcba0e0 | |||
| bbe7f72f36 | |||
| 30c406f8c4 | |||
| 498aed50d2 | |||
| 96895c9755 | |||
| cb576da8b5 |
+11
-5
@@ -7,11 +7,17 @@ addMode () {
|
|||||||
#addMode "1280x960_120i" 105.90 1280 1360 1496 1712 960 963 969 1031 -HSync +Vsync interlace
|
#addMode "1280x960_120i" 105.90 1280 1360 1496 1712 960 963 969 1031 -HSync +Vsync interlace
|
||||||
#addMode "1280x960_120i" 105.50 1280 1360 1496 1712 960 963 969 1031 -HSync +VSync Interlace #119hz
|
#addMode "1280x960_120i" 105.50 1280 1360 1496 1712 960 963 969 1031 -HSync +VSync Interlace #119hz
|
||||||
addMode "1280x960_120i" 105.90 1280 1360 1496 1712 960 963 969 1031 -HSync +VSync Interlace
|
addMode "1280x960_120i" 105.90 1280 1360 1496 1712 960 963 969 1031 -HSync +VSync Interlace
|
||||||
addMode "1600x900_120i" 124.240 1600 1696 1864 2128 900 903 908 949 -HSync +VSync interlace
|
addMode "1600x900_120i" 120.000 1600 1696 1864 2128 900 903 908 975 -HSync +VSync Interlace
|
||||||
addMode "1600x1000_120i" 137.500 1600 1696 1864 2128 1000 1003 1008 1049 -HSync +VSync interlace
|
addMode "1600x1000_120i" 133.000 1600 1696 1864 2128 1000 1003 1008 1075 -HSync +VSync Interlace
|
||||||
#addMode "640x480_120p" 52.50 640 680 744 848 480 483 487 518 -hsync +vsync
|
#addMode "640x480_120p" 52.50 640 680 744 848 480 483 487 518 -hsync +vsync
|
||||||
addMode "640x480_120p" 52.41 640 680 744 848 480 481 484 515 +HSync -Vsync
|
#addMode "640x480_120p" 52.41 640 680 744 848 480 481 484 515 +HSync -Vsync
|
||||||
|
#addMode "640x480_120p" 52.35 640 680 744 848 480 481 484 515 +HSync -Vsync #flicker fix (119hz)
|
||||||
|
#addMode "640x480_120p" 51.97 640 680 744 848 480 481 484 515 +HSync -Vsync
|
||||||
|
addMode "640x480_120p" 52.95 640 680 748 856 480 482 485 516 -HSync +VSync
|
||||||
addMode "480x360_120p" 29.00 480 504 552 624 360 363 367 389 -hsync +vsync #enter the gungeon
|
addMode "480x360_120p" 29.00 480 504 552 624 360 363 367 389 -hsync +vsync #enter the gungeon
|
||||||
addMode "760x284_120p" 35.50 760 792 864 968 284 287 297 308 -hsync +vsync #downwell
|
addMode "760x284_120p" 35.50 760 792 864 968 284 287 297 308 -hsync +vsync #downwell
|
||||||
addMode "1920x240_120p" 92.443 1920 2202 2266 2744 240 245 250 281 -HSync -VSync
|
#addMode "1920x240_120p" 92.443 1920 2202 2266 2744 240 245 250 281 -HSync -VSync
|
||||||
|
#addMode 640x480_119i 27.810 640 672 736 824 480 483 488 563 -HSync -VSync Interlace
|
||||||
|
addMode "640x240_119p" 27.810 640 672 736 824 240 242 244 282 -HSync -VSync
|
||||||
|
addMode "640x360_119i_down" 27.810 640 672 736 824 360 365 373 563 -HSync -VSync Interlace
|
||||||
|
addMode "640x360_119i_up" 27.810 640 672 736 824 360 485 493 563 -HSync -VSync Interlace
|
||||||
|
|||||||
Executable
+2
@@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
cc controller-off.c -o controller-off $(pkg-config --cflags --libs sdl3)
|
||||||
Executable
BIN
Binary file not shown.
@@ -0,0 +1,704 @@
|
|||||||
|
/*
|
||||||
|
* controller-off.c
|
||||||
|
*
|
||||||
|
* Global SDL3 controller disconnect utility.
|
||||||
|
*
|
||||||
|
* Button combination:
|
||||||
|
*
|
||||||
|
* Guide/Home + North
|
||||||
|
*
|
||||||
|
* SDL mapping:
|
||||||
|
*
|
||||||
|
* PlayStation -> Home + Triangle
|
||||||
|
* Xbox -> Guide + Y
|
||||||
|
* Nintendo -> Home + X
|
||||||
|
*
|
||||||
|
* Build:
|
||||||
|
*
|
||||||
|
* cc controller-off.c -o controller-off \
|
||||||
|
* $(pkg-config --cflags --libs sdl3)
|
||||||
|
*
|
||||||
|
* Run:
|
||||||
|
*
|
||||||
|
* ./controller-off
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <SDL3/SDL.h>
|
||||||
|
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/wait.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#define MAX_CONTROLLERS 32
|
||||||
|
#define MAC_LEN 18
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
SDL_JoystickID id;
|
||||||
|
SDL_Gamepad *gamepad;
|
||||||
|
|
||||||
|
int guide_pressed;
|
||||||
|
int north_pressed;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Prevent repeated triggers while both buttons
|
||||||
|
* remain held.
|
||||||
|
*/
|
||||||
|
int triggered;
|
||||||
|
} Controller;
|
||||||
|
|
||||||
|
static Controller controllers[MAX_CONTROLLERS];
|
||||||
|
static int controller_count = 0;
|
||||||
|
|
||||||
|
static volatile sig_atomic_t running = 1;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ------------------------------------------------------------
|
||||||
|
* Check for XX:XX:XX:XX:XX:XX
|
||||||
|
* ------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
static int is_mac(const char *s)
|
||||||
|
{
|
||||||
|
if (!s || strlen(s) != 17)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
for (int i = 0; i < 17; i++) {
|
||||||
|
|
||||||
|
if (i == 2 ||
|
||||||
|
i == 5 ||
|
||||||
|
i == 8 ||
|
||||||
|
i == 11 ||
|
||||||
|
i == 14) {
|
||||||
|
|
||||||
|
if (s[i] != ':')
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if (!isxdigit(
|
||||||
|
(unsigned char)s[i]))
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ------------------------------------------------------------
|
||||||
|
* Find a connected Bluetooth device whose name matches
|
||||||
|
* the SDL controller name.
|
||||||
|
*
|
||||||
|
* bluetoothctl output:
|
||||||
|
*
|
||||||
|
* Device AA:BB:CC:DD:EE:FF PS3 Controller
|
||||||
|
*
|
||||||
|
* We use:
|
||||||
|
*
|
||||||
|
* bluetoothctl devices Connected
|
||||||
|
* ------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
static int find_bluetooth_device(
|
||||||
|
const char *controller_name,
|
||||||
|
char mac[MAC_LEN])
|
||||||
|
{
|
||||||
|
if (!controller_name)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
FILE *fp = popen(
|
||||||
|
"bluetoothctl devices Connected 2>/dev/null",
|
||||||
|
"r"
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!fp)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
char line[1024];
|
||||||
|
|
||||||
|
while (fgets(
|
||||||
|
line,
|
||||||
|
sizeof(line),
|
||||||
|
fp
|
||||||
|
)) {
|
||||||
|
|
||||||
|
char candidate_mac[MAC_LEN];
|
||||||
|
char device_name[768];
|
||||||
|
|
||||||
|
memset(
|
||||||
|
candidate_mac,
|
||||||
|
0,
|
||||||
|
sizeof(candidate_mac)
|
||||||
|
);
|
||||||
|
|
||||||
|
memset(
|
||||||
|
device_name,
|
||||||
|
0,
|
||||||
|
sizeof(device_name)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* bluetoothctl:
|
||||||
|
*
|
||||||
|
* Device MAC NAME
|
||||||
|
*/
|
||||||
|
if (sscanf(
|
||||||
|
line,
|
||||||
|
"Device %17s %[^\n]",
|
||||||
|
candidate_mac,
|
||||||
|
device_name
|
||||||
|
) != 2) {
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!is_mac(candidate_mac))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* SDL and bluetoothctl may use slightly
|
||||||
|
* different names.
|
||||||
|
*
|
||||||
|
* First try exact match.
|
||||||
|
*/
|
||||||
|
if (strcmp(
|
||||||
|
controller_name,
|
||||||
|
device_name
|
||||||
|
) == 0) {
|
||||||
|
|
||||||
|
strncpy(
|
||||||
|
mac,
|
||||||
|
candidate_mac,
|
||||||
|
MAC_LEN
|
||||||
|
);
|
||||||
|
|
||||||
|
mac[MAC_LEN - 1] = '\0';
|
||||||
|
|
||||||
|
pclose(fp);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* PS3-specific fallback.
|
||||||
|
*
|
||||||
|
* SDL:
|
||||||
|
*
|
||||||
|
* PS3 Controller
|
||||||
|
*
|
||||||
|
* BlueZ:
|
||||||
|
*
|
||||||
|
* PLAYSTATION(R)3 Controller
|
||||||
|
*/
|
||||||
|
if (
|
||||||
|
strstr(controller_name, "PS3") &&
|
||||||
|
strstr(device_name, "3 Controller")
|
||||||
|
) {
|
||||||
|
|
||||||
|
strncpy(
|
||||||
|
mac,
|
||||||
|
candidate_mac,
|
||||||
|
MAC_LEN
|
||||||
|
);
|
||||||
|
|
||||||
|
mac[MAC_LEN - 1] = '\0';
|
||||||
|
|
||||||
|
pclose(fp);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pclose(fp);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ------------------------------------------------------------
|
||||||
|
* Disconnect Bluetooth device.
|
||||||
|
* ------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
static void disconnect_bluetooth(
|
||||||
|
const char *mac)
|
||||||
|
{
|
||||||
|
if (!is_mac(mac))
|
||||||
|
return;
|
||||||
|
|
||||||
|
|
||||||
|
printf(
|
||||||
|
"Disconnecting Bluetooth device %s\n",
|
||||||
|
mac
|
||||||
|
);
|
||||||
|
|
||||||
|
fflush(stdout);
|
||||||
|
|
||||||
|
|
||||||
|
pid_t pid = fork();
|
||||||
|
|
||||||
|
if (pid < 0) {
|
||||||
|
perror("fork");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (pid == 0) {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Suppress bluetoothctl output.
|
||||||
|
*/
|
||||||
|
FILE *devnull =
|
||||||
|
fopen("/dev/null", "w");
|
||||||
|
|
||||||
|
if (devnull) {
|
||||||
|
|
||||||
|
dup2(
|
||||||
|
fileno(devnull),
|
||||||
|
STDOUT_FILENO
|
||||||
|
);
|
||||||
|
|
||||||
|
dup2(
|
||||||
|
fileno(devnull),
|
||||||
|
STDERR_FILENO
|
||||||
|
);
|
||||||
|
|
||||||
|
fclose(devnull);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
execlp(
|
||||||
|
"bluetoothctl",
|
||||||
|
"bluetoothctl",
|
||||||
|
"disconnect",
|
||||||
|
mac,
|
||||||
|
(char *)NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
_exit(127);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Reap child process.
|
||||||
|
*/
|
||||||
|
waitpid(
|
||||||
|
pid,
|
||||||
|
NULL,
|
||||||
|
0
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ------------------------------------------------------------
|
||||||
|
* Handle the button combination.
|
||||||
|
* ------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
static void disconnect_controller(
|
||||||
|
Controller *controller)
|
||||||
|
{
|
||||||
|
if (!controller ||
|
||||||
|
!controller->gamepad)
|
||||||
|
return;
|
||||||
|
|
||||||
|
|
||||||
|
const char *name =
|
||||||
|
SDL_GetGamepadName(
|
||||||
|
controller->gamepad
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
printf("\n");
|
||||||
|
printf(
|
||||||
|
"PS/Home + North detected\n"
|
||||||
|
);
|
||||||
|
|
||||||
|
printf(
|
||||||
|
"Controller: %s\n",
|
||||||
|
name ? name : "Unknown"
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
char mac[MAC_LEN];
|
||||||
|
|
||||||
|
|
||||||
|
if (!find_bluetooth_device(
|
||||||
|
name,
|
||||||
|
mac
|
||||||
|
)) {
|
||||||
|
|
||||||
|
fprintf(
|
||||||
|
stderr,
|
||||||
|
"Could not find a connected Bluetooth "
|
||||||
|
"device matching \"%s\".\n",
|
||||||
|
name ? name : "Unknown"
|
||||||
|
);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
printf(
|
||||||
|
"Bluetooth MAC: %s\n",
|
||||||
|
mac
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
disconnect_bluetooth(mac);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ------------------------------------------------------------
|
||||||
|
* Find SDL controller.
|
||||||
|
* ------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
static Controller *find_controller(
|
||||||
|
SDL_JoystickID id)
|
||||||
|
{
|
||||||
|
for (int i = 0;
|
||||||
|
i < controller_count;
|
||||||
|
i++) {
|
||||||
|
|
||||||
|
if (controllers[i].id == id)
|
||||||
|
return &controllers[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ------------------------------------------------------------
|
||||||
|
* Add controller.
|
||||||
|
* ------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
static void add_controller(
|
||||||
|
SDL_JoystickID id)
|
||||||
|
{
|
||||||
|
if (controller_count >=
|
||||||
|
MAX_CONTROLLERS) {
|
||||||
|
|
||||||
|
fprintf(
|
||||||
|
stderr,
|
||||||
|
"Controller limit reached.\n"
|
||||||
|
);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SDL_Gamepad *gamepad =
|
||||||
|
SDL_OpenGamepad(id);
|
||||||
|
|
||||||
|
|
||||||
|
if (!gamepad) {
|
||||||
|
|
||||||
|
fprintf(
|
||||||
|
stderr,
|
||||||
|
"SDL_OpenGamepad failed: %s\n",
|
||||||
|
SDL_GetError()
|
||||||
|
);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Controller *controller =
|
||||||
|
&controllers[
|
||||||
|
controller_count++
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
memset(
|
||||||
|
controller,
|
||||||
|
0,
|
||||||
|
sizeof(*controller)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
controller->id = id;
|
||||||
|
controller->gamepad = gamepad;
|
||||||
|
|
||||||
|
|
||||||
|
const char *name =
|
||||||
|
SDL_GetGamepadName(gamepad);
|
||||||
|
|
||||||
|
|
||||||
|
printf(
|
||||||
|
"Controller connected: %s\n",
|
||||||
|
name ? name : "Unknown"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ------------------------------------------------------------
|
||||||
|
* Remove controller.
|
||||||
|
* ------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
static void remove_controller(
|
||||||
|
SDL_JoystickID id)
|
||||||
|
{
|
||||||
|
for (int i = 0;
|
||||||
|
i < controller_count;
|
||||||
|
i++) {
|
||||||
|
|
||||||
|
if (controllers[i].id != id)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
|
||||||
|
SDL_CloseGamepad(
|
||||||
|
controllers[i].gamepad
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Fill the removed slot with the last
|
||||||
|
* controller.
|
||||||
|
*/
|
||||||
|
controllers[i] =
|
||||||
|
controllers[
|
||||||
|
controller_count - 1
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
controller_count--;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ------------------------------------------------------------
|
||||||
|
* Signal handler.
|
||||||
|
* ------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
static void handle_signal(
|
||||||
|
int signal)
|
||||||
|
{
|
||||||
|
(void)signal;
|
||||||
|
|
||||||
|
running = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ------------------------------------------------------------
|
||||||
|
* Main
|
||||||
|
* ------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
signal(
|
||||||
|
SIGINT,
|
||||||
|
handle_signal
|
||||||
|
);
|
||||||
|
|
||||||
|
signal(
|
||||||
|
SIGTERM,
|
||||||
|
handle_signal
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
if (!SDL_Init(
|
||||||
|
SDL_INIT_GAMEPAD)) {
|
||||||
|
|
||||||
|
fprintf(
|
||||||
|
stderr,
|
||||||
|
"SDL_Init failed: %s\n",
|
||||||
|
SDL_GetError()
|
||||||
|
);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Receive controller events even though we have
|
||||||
|
* no window/focus.
|
||||||
|
*/
|
||||||
|
SDL_SetHint(
|
||||||
|
SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS,
|
||||||
|
"1"
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
printf(
|
||||||
|
"====================================\n"
|
||||||
|
" Controller Off\n"
|
||||||
|
"====================================\n"
|
||||||
|
"Hold Home/Guide + Triangle/North\n"
|
||||||
|
"to disconnect the controller.\n\n"
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Open controllers that already exist.
|
||||||
|
*/
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
|
SDL_JoystickID *ids =
|
||||||
|
SDL_GetGamepads(&count);
|
||||||
|
|
||||||
|
|
||||||
|
if (ids) {
|
||||||
|
|
||||||
|
for (int i = 0;
|
||||||
|
i < count;
|
||||||
|
i++) {
|
||||||
|
|
||||||
|
add_controller(ids[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_free(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SDL_Event event;
|
||||||
|
|
||||||
|
|
||||||
|
while (running) {
|
||||||
|
|
||||||
|
while (SDL_PollEvent(&event)) {
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Controller added.
|
||||||
|
*/
|
||||||
|
if (event.type ==
|
||||||
|
SDL_EVENT_GAMEPAD_ADDED) {
|
||||||
|
|
||||||
|
add_controller(
|
||||||
|
event.gdevice.which
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Controller removed.
|
||||||
|
*/
|
||||||
|
else if (event.type ==
|
||||||
|
SDL_EVENT_GAMEPAD_REMOVED) {
|
||||||
|
|
||||||
|
remove_controller(
|
||||||
|
event.gdevice.which
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Button press/release.
|
||||||
|
*/
|
||||||
|
else if (
|
||||||
|
event.type ==
|
||||||
|
SDL_EVENT_GAMEPAD_BUTTON_DOWN ||
|
||||||
|
|
||||||
|
event.type ==
|
||||||
|
SDL_EVENT_GAMEPAD_BUTTON_UP
|
||||||
|
) {
|
||||||
|
|
||||||
|
Controller *controller =
|
||||||
|
find_controller(
|
||||||
|
event.gbutton.which
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
if (!controller)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
|
||||||
|
int pressed =
|
||||||
|
event.type ==
|
||||||
|
SDL_EVENT_GAMEPAD_BUTTON_DOWN;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Guide/Home/PS.
|
||||||
|
*/
|
||||||
|
if (event.gbutton.button ==
|
||||||
|
SDL_GAMEPAD_BUTTON_GUIDE) {
|
||||||
|
|
||||||
|
controller->guide_pressed =
|
||||||
|
pressed;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* North:
|
||||||
|
*
|
||||||
|
* PS = Triangle
|
||||||
|
* Xbox = Y
|
||||||
|
* Nintendo = X
|
||||||
|
*/
|
||||||
|
if (event.gbutton.button ==
|
||||||
|
SDL_GAMEPAD_BUTTON_NORTH) {
|
||||||
|
|
||||||
|
controller->north_pressed =
|
||||||
|
pressed;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Trigger only once per press.
|
||||||
|
*/
|
||||||
|
if (controller->guide_pressed &&
|
||||||
|
controller->north_pressed &&
|
||||||
|
!controller->triggered) {
|
||||||
|
|
||||||
|
controller->triggered = 1;
|
||||||
|
|
||||||
|
disconnect_controller(
|
||||||
|
controller
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Allow another trigger after
|
||||||
|
* either button is released.
|
||||||
|
*/
|
||||||
|
if (!controller->guide_pressed ||
|
||||||
|
!controller->north_pressed) {
|
||||||
|
|
||||||
|
controller->triggered = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SDL_Delay(5);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Cleanup.
|
||||||
|
*/
|
||||||
|
for (int i = 0;
|
||||||
|
i < controller_count;
|
||||||
|
i++) {
|
||||||
|
|
||||||
|
if (controllers[i].gamepad)
|
||||||
|
SDL_CloseGamepad(
|
||||||
|
controllers[i].gamepad
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SDL_Quit();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
testvidmode "640x360_119i_down" 27.810 640 672 736 824 360 365 373 563 -HSync -VSync Interlace
|
||||||
|
testvidmode "640x360_119i_up" 27.810 640 672 736 824 360 485 493 563 -HSync -VSync Interlace
|
||||||
@@ -11,4 +11,3 @@ delMode "1600x1000_120i" 137.500 1600 1696 1864 2128 1000 1003 1008 1049 -HSync
|
|||||||
delMode "640x480_120p" 52.50 640 680 744 848 480 483 487 518 -hsync +vsync
|
delMode "640x480_120p" 52.50 640 680 744 848 480 483 487 518 -hsync +vsync
|
||||||
delMode "480x360_120p" 29.00 480 504 552 624 360 363 367 389 -hsync +vsync
|
delMode "480x360_120p" 29.00 480 504 552 624 360 363 367 389 -hsync +vsync
|
||||||
delMode "760x284_120p" 35.50 760 792 864 968 284 287 297 308 -hsync +vsync
|
delMode "760x284_120p" 35.50 760 792 864 968 284 287 297 308 -hsync +vsync
|
||||||
delMode "1920x240_120p" 92.443 1920 2202 2266 2744 240 245 250 281 -HSync -VSync
|
|
||||||
|
|||||||
@@ -7,3 +7,4 @@ xmodmap -e 'remove mod4 = Hyper_L'
|
|||||||
xmodmap -e 'remove mod1 = Hyper_L'
|
xmodmap -e 'remove mod1 = Hyper_L'
|
||||||
xmodmap -e 'clear mod3'
|
xmodmap -e 'clear mod3'
|
||||||
xmodmap -e 'add mod3 = Hyper_L'
|
xmodmap -e 'add mod3 = Hyper_L'
|
||||||
|
systemctl --user restart sxhkd
|
||||||
|
|||||||
Executable
+3
@@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo nameserver 10.0.0.1 > /etc/resolv.conf
|
||||||
Executable
+108
@@ -0,0 +1,108 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Local-only Wi-Fi hotspot for Kali NetHunter / Android
|
||||||
|
# SSID: vegeta black
|
||||||
|
# Password: supermarioinreallife
|
||||||
|
|
||||||
|
IFACE="wlan1" # Change if needed (check with: ip link / iw dev)
|
||||||
|
SSID="vegeta black"
|
||||||
|
PSK="supermarioinreallife"
|
||||||
|
CHANNEL="6"
|
||||||
|
AP_IP="192.168.43.1"
|
||||||
|
DHCP_RANGE="192.168.43.10,192.168.43.50,12h"
|
||||||
|
|
||||||
|
# Check root
|
||||||
|
if [ "$(id -u)" -ne 0 ]; then
|
||||||
|
echo "This script must be run as root"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "[*] Hard reset of Wi-Fi stack..."
|
||||||
|
|
||||||
|
# Full path to Android's svc
|
||||||
|
/system/bin/svc wifi disable 2>/dev/null
|
||||||
|
killall hostapd dnsmasq wpa_supplicant wificond 2>/dev/null
|
||||||
|
sleep 1
|
||||||
|
pkill -9 hostapd
|
||||||
|
sleep 3
|
||||||
|
|
||||||
|
# Delete the interface
|
||||||
|
iw dev $IFACE del 2>/dev/null
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
# Create a fresh AP interface
|
||||||
|
iw phy phy0 interface add $IFACE type __ap 2>/dev/null || \
|
||||||
|
iw phy phy0 interface add $IFACE type ap 2>/dev/null
|
||||||
|
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
ip link set $IFACE down 2>/dev/null
|
||||||
|
ip addr flush dev $IFACE 2>/dev/null
|
||||||
|
ip link set $IFACE up
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
# Create hostapd config
|
||||||
|
cat > /tmp/hostapd-"$IFACE".conf <<EOF
|
||||||
|
interface=$IFACE
|
||||||
|
driver=nl80211
|
||||||
|
ssid=$SSID
|
||||||
|
hw_mode=g
|
||||||
|
channel=$CHANNEL
|
||||||
|
ieee80211n=1
|
||||||
|
wmm_enabled=1
|
||||||
|
auth_algs=1
|
||||||
|
ignore_broadcast_ssid=0
|
||||||
|
wpa=2
|
||||||
|
wpa_passphrase=$PSK
|
||||||
|
wpa_key_mgmt=WPA-PSK
|
||||||
|
rsn_pairwise=CCMP
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# Start hostapd
|
||||||
|
hostapd -B /tmp/hostapd-"$IFACE".conf || {
|
||||||
|
echo "hostapd failed to start"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Assign static IP to the AP interface
|
||||||
|
ip addr add "$AP_IP/24" dev "$IFACE"
|
||||||
|
ip link set "$IFACE" up
|
||||||
|
|
||||||
|
# Remove any previous rules/routes
|
||||||
|
ip rule del pref 50 2>/dev/null
|
||||||
|
ip rule del from "$AP_IP"/32 table 200 2>/dev/null
|
||||||
|
ip route flush table 200 2>/dev/null
|
||||||
|
|
||||||
|
# Policy routing for the NAO network
|
||||||
|
ip route add 192.168.43.0/24 dev "$IFACE" src "$AP_IP" table 200
|
||||||
|
ip rule add pref 50 to 192.168.43.0/24 lookup 200
|
||||||
|
ip rule add from "$AP_IP"/32 table 200
|
||||||
|
|
||||||
|
# Start dnsmasq (DHCP only – no DNS forwarding / no internet)
|
||||||
|
dnsmasq \
|
||||||
|
--interface="$IFACE" \
|
||||||
|
--bind-interfaces \
|
||||||
|
--dhcp-range="$DHCP_RANGE" \
|
||||||
|
--dhcp-option=3,"$AP_IP" \
|
||||||
|
--dhcp-option=6,"$AP_IP" \
|
||||||
|
--port=0 \
|
||||||
|
--no-resolv \
|
||||||
|
--pid-file=/tmp/dnsmasq-"$IFACE".pid \
|
||||||
|
--log-facility=/tmp/dnsmasq-"$IFACE".log &
|
||||||
|
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
# Show status
|
||||||
|
echo
|
||||||
|
echo "Local-only hotspot started"
|
||||||
|
echo " Interface : $IFACE"
|
||||||
|
echo " SSID : $SSID"
|
||||||
|
echo " Password : $PSK"
|
||||||
|
echo " Gateway : $AP_IP"
|
||||||
|
echo
|
||||||
|
iw dev "$IFACE" info 2>/dev/null | head -n 15
|
||||||
|
echo
|
||||||
|
ip addr show "$IFACE"
|
||||||
|
echo
|
||||||
|
echo "Clients will receive IPs in the range 192.168.43.10 – 192.168.43.50"
|
||||||
|
echo "No internet is shared (local network only)."
|
||||||
Executable
+39
@@ -0,0 +1,39 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Stop the local-only hotspot created by localhotspot
|
||||||
|
|
||||||
|
IFACE="wlan1" # Must match the interface used in localhotspot
|
||||||
|
|
||||||
|
# Check root
|
||||||
|
if [ "$(id -u)" -ne 0 ]; then
|
||||||
|
echo "This script must be run as root"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "[*] Stopping local hotspot..."
|
||||||
|
|
||||||
|
# Kill the daemons
|
||||||
|
killall hostapd dnsmasq 2>/dev/null
|
||||||
|
pkill -9 hostapd 2>/dev/null
|
||||||
|
pkill -9 dnsmasq 2>/dev/null
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
# Remove routing rules that were added
|
||||||
|
ip rule del pref 50 2>/dev/null
|
||||||
|
ip rule del from 192.168.43.1/32 table 200 2>/dev/null
|
||||||
|
ip route flush table 200 2>/dev/null
|
||||||
|
|
||||||
|
# Bring the interface down and remove the IP
|
||||||
|
ip addr flush dev "$IFACE" 2>/dev/null
|
||||||
|
ip link set "$IFACE" down 2>/dev/null
|
||||||
|
|
||||||
|
# Delete the AP interface
|
||||||
|
iw dev "$IFACE" del 2>/dev/null
|
||||||
|
|
||||||
|
# Clean up temporary files
|
||||||
|
rm -f /tmp/hostapd-"$IFACE".conf
|
||||||
|
rm -f /tmp/dnsmasq-"$IFACE".pid
|
||||||
|
rm -f /tmp/dnsmasq-"$IFACE".log
|
||||||
|
|
||||||
|
echo "[+] Hotspot stopped."
|
||||||
|
echo " Interface $IFACE has been removed."
|
||||||
Executable
+61
@@ -0,0 +1,61 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
IFACE="wlan1"
|
||||||
|
SSID="naorobotwifi"
|
||||||
|
PSK="supermarioinreallife"
|
||||||
|
|
||||||
|
ip link set "$IFACE" up || exit 1
|
||||||
|
|
||||||
|
cat >/tmp/wpa-"$IFACE".conf <<EOF
|
||||||
|
ctrl_interface=/run/wpa_supplicant
|
||||||
|
update_config=0
|
||||||
|
|
||||||
|
network={
|
||||||
|
ssid="$SSID"
|
||||||
|
psk="$PSK"
|
||||||
|
key_mgmt=WPA-PSK
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
killall wpa_supplicant 2>/dev/null
|
||||||
|
|
||||||
|
wpa_supplicant -B -i "$IFACE" -c /tmp/wpa-"$IFACE".conf || exit 1
|
||||||
|
|
||||||
|
if command -v dhclient >/dev/null 2>&1; then
|
||||||
|
dhclient "$IFACE"
|
||||||
|
elif command -v udhcpc >/dev/null 2>&1; then
|
||||||
|
udhcpc -i "$IFACE"
|
||||||
|
elif command -v dhcpcd >/dev/null 2>&1; then
|
||||||
|
dhcpcd "$IFACE"
|
||||||
|
else
|
||||||
|
echo "No DHCP client found."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
iw dev "$IFACE" link
|
||||||
|
ip addr show "$IFACE"
|
||||||
|
|
||||||
|
# Wait for DHCP to assign an address
|
||||||
|
sleep 2
|
||||||
|
|
||||||
|
IP=$(ip -4 -o addr show dev "$IFACE" | awk '{print $4}' | cut -d/ -f1)
|
||||||
|
|
||||||
|
if [ -z "$IP" ]; then
|
||||||
|
echo "Failed to obtain an IPv4 address on $IFACE"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Remove any previous rules/routes
|
||||||
|
ip rule del pref 50 2>/dev/null
|
||||||
|
ip rule del from "$IP"/32 table 200 2>/dev/null
|
||||||
|
ip route flush table 200 2>/dev/null
|
||||||
|
|
||||||
|
# Policy routing for the NAO network
|
||||||
|
ip route add 192.168.0.0/24 dev "$IFACE" src "$IP" table 200
|
||||||
|
ip rule add pref 50 to 192.168.0.0/24 lookup 200
|
||||||
|
ip rule add from "$IP"/32 table 200
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "Connected on $IFACE ($IP)"
|
||||||
|
echo
|
||||||
|
ip route get 192.168.0.100
|
||||||
Executable
+86
@@ -0,0 +1,86 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Local-only Wi-Fi hotspot for Kali NetHunter / Android
|
||||||
|
# SSID: vegeta black
|
||||||
|
# Password: supermarioinreallife
|
||||||
|
|
||||||
|
IFACE="wlan1" # Change if needed (check with: ip link / iw dev)
|
||||||
|
SSID="vegeta black"
|
||||||
|
PSK="supermarioinreallife"
|
||||||
|
CHANNEL="6"
|
||||||
|
AP_IP="192.168.43.1"
|
||||||
|
DHCP_RANGE="192.168.43.10,192.168.43.50,12h"
|
||||||
|
|
||||||
|
# Check root
|
||||||
|
if [ "$(id -u)" -ne 0 ]; then
|
||||||
|
echo "This script must be run as root"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Kill previous instances
|
||||||
|
killall hostapd dnsmasq wpa_supplicant 2>/dev/null
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
# Bring interface down and clean it
|
||||||
|
ip link set "$IFACE" down 2>/dev/null
|
||||||
|
ip addr flush dev "$IFACE" 2>/dev/null
|
||||||
|
ip link set "$IFACE" up || {
|
||||||
|
echo "Failed to bring up $IFACE"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Create hostapd config
|
||||||
|
cat > /tmp/hostapd-"$IFACE".conf <<EOF
|
||||||
|
interface=$IFACE
|
||||||
|
driver=nl80211
|
||||||
|
ssid=$SSID
|
||||||
|
hw_mode=g
|
||||||
|
channel=$CHANNEL
|
||||||
|
ieee80211n=1
|
||||||
|
wmm_enabled=1
|
||||||
|
auth_algs=1
|
||||||
|
ignore_broadcast_ssid=0
|
||||||
|
wpa=2
|
||||||
|
wpa_passphrase=$PSK
|
||||||
|
wpa_key_mgmt=WPA-PSK
|
||||||
|
rsn_pairwise=CCMP
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# Start hostapd
|
||||||
|
hostapd -B /tmp/hostapd-"$IFACE".conf || {
|
||||||
|
echo "hostapd failed to start"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Assign static IP to the AP interface
|
||||||
|
ip addr add "$AP_IP/24" dev "$IFACE"
|
||||||
|
ip link set "$IFACE" up
|
||||||
|
|
||||||
|
# Start dnsmasq (DHCP only – no DNS forwarding / no internet)
|
||||||
|
dnsmasq \
|
||||||
|
--interface="$IFACE" \
|
||||||
|
--bind-interfaces \
|
||||||
|
--dhcp-range="$DHCP_RANGE" \
|
||||||
|
--dhcp-option=3,"$AP_IP" \
|
||||||
|
--dhcp-option=6,"$AP_IP" \
|
||||||
|
--port=0 \
|
||||||
|
--no-resolv \
|
||||||
|
--pid-file=/tmp/dnsmasq-"$IFACE".pid \
|
||||||
|
--log-facility=/tmp/dnsmasq-"$IFACE".log &
|
||||||
|
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
# Show status
|
||||||
|
echo
|
||||||
|
echo "Local-only hotspot started"
|
||||||
|
echo " Interface : $IFACE"
|
||||||
|
echo " SSID : $SSID"
|
||||||
|
echo " Password : $PSK"
|
||||||
|
echo " Gateway : $AP_IP"
|
||||||
|
echo
|
||||||
|
iw dev "$IFACE" info 2>/dev/null | head -n 15
|
||||||
|
echo
|
||||||
|
ip addr show "$IFACE"
|
||||||
|
echo
|
||||||
|
echo "Clients will receive IPs in the range 192.168.43.10 – 192.168.43.50"
|
||||||
|
echo "No internet is shared (local network only)."
|
||||||
Executable
+85
@@ -0,0 +1,85 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
IFACE="wlan1"
|
||||||
|
SSID="vegetablack"
|
||||||
|
PSK="supermarioinreallife"
|
||||||
|
CHANNEL="11"
|
||||||
|
AP_IP="192.168.43.1"
|
||||||
|
|
||||||
|
[ "$(id -u)" -ne 0 ] && exit 1
|
||||||
|
|
||||||
|
echo "[*] Hard reset of Wi-Fi stack..."
|
||||||
|
|
||||||
|
# Full path to Android's svc
|
||||||
|
/system/bin/svc wifi disable 2>/dev/null
|
||||||
|
killall hostapd dnsmasq wpa_supplicant wificond 2>/dev/null
|
||||||
|
sleep 1
|
||||||
|
pkill -9 hostapd
|
||||||
|
sleep 3
|
||||||
|
|
||||||
|
# Delete the interface
|
||||||
|
iw dev $IFACE del 2>/dev/null
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
# Create a fresh AP interface
|
||||||
|
iw phy phy0 interface add $IFACE type __ap 2>/dev/null || \
|
||||||
|
iw phy phy0 interface add $IFACE type ap 2>/dev/null
|
||||||
|
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
ip link set $IFACE down 2>/dev/null
|
||||||
|
ip addr flush dev $IFACE 2>/dev/null
|
||||||
|
ip link set $IFACE up
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
# Simple hostapd config
|
||||||
|
cat > /tmp/hostapd.conf <<EOF
|
||||||
|
interface=$IFACE
|
||||||
|
driver=nl80211
|
||||||
|
ssid=$SSID
|
||||||
|
hw_mode=g
|
||||||
|
channel=$CHANNEL
|
||||||
|
auth_algs=1
|
||||||
|
ignore_broadcast_ssid=0
|
||||||
|
EOF
|
||||||
|
|
||||||
|
echo "[*] Starting hostapd (running in foreground)..."
|
||||||
|
echo "Look for the line: AP-ENABLED"
|
||||||
|
echo "Press Ctrl+C to stop later"
|
||||||
|
echo
|
||||||
|
|
||||||
|
hostapd /tmp/hostapd.conf
|
||||||
|
|
||||||
|
# Assign static IP to the AP interface
|
||||||
|
ip addr add "$AP_IP/24" dev "$IFACE"
|
||||||
|
ip link set "$IFACE" up
|
||||||
|
|
||||||
|
# Start dnsmasq (DHCP only – no DNS forwarding / no internet)
|
||||||
|
dnsmasq \
|
||||||
|
--interface="$IFACE" \
|
||||||
|
--bind-interfaces \
|
||||||
|
--dhcp-range="$DHCP_RANGE" \
|
||||||
|
--dhcp-option=3,"$AP_IP" \
|
||||||
|
--dhcp-option=6,"$AP_IP" \
|
||||||
|
--port=0 \
|
||||||
|
--no-resolv \
|
||||||
|
--pid-file=/tmp/dnsmasq-"$IFACE".pid \
|
||||||
|
--log-facility=/tmp/dnsmasq-"$IFACE".log &
|
||||||
|
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
# Show status
|
||||||
|
echo
|
||||||
|
echo "Local-only hotspot started"
|
||||||
|
echo " Interface : $IFACE"
|
||||||
|
echo " SSID : $SSID"
|
||||||
|
echo " Password : $PSK"
|
||||||
|
echo " Gateway : $AP_IP"
|
||||||
|
echo
|
||||||
|
iw dev "$IFACE" info 2>/dev/null | head -n 15
|
||||||
|
echo
|
||||||
|
ip addr show "$IFACE"
|
||||||
|
echo
|
||||||
|
echo "Clients will receive IPs in the range 192.168.43.10 – 192.168.43.50"
|
||||||
|
echo "No internet is shared (local network only)."
|
||||||
|
|
||||||
Executable
+98
@@ -0,0 +1,98 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Local-only Wi-Fi hotspot for Kali NetHunter / Android
|
||||||
|
# SSID: vegeta black
|
||||||
|
# Password: supermarioinreallife
|
||||||
|
|
||||||
|
IFACE="wlan1" # Change if needed (check with: ip link / iw dev)
|
||||||
|
SSID="vegeta black"
|
||||||
|
PSK="supermarioinreallife"
|
||||||
|
CHANNEL="6"
|
||||||
|
AP_IP="192.168.43.1"
|
||||||
|
DHCP_RANGE="192.168.43.10,192.168.43.50,12h"
|
||||||
|
|
||||||
|
# Check root
|
||||||
|
if [ "$(id -u)" -ne 0 ]; then
|
||||||
|
echo "This script must be run as root"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "[*] Hard reset of Wi-Fi stack..."
|
||||||
|
|
||||||
|
# Full path to Android's svc
|
||||||
|
/system/bin/svc wifi disable 2>/dev/null
|
||||||
|
killall hostapd dnsmasq wpa_supplicant wificond 2>/dev/null
|
||||||
|
sleep 1
|
||||||
|
pkill -9 hostapd
|
||||||
|
sleep 3
|
||||||
|
|
||||||
|
# Delete the interface
|
||||||
|
iw dev $IFACE del 2>/dev/null
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
# Create a fresh AP interface
|
||||||
|
iw phy phy0 interface add $IFACE type __ap 2>/dev/null || \
|
||||||
|
iw phy phy0 interface add $IFACE type ap 2>/dev/null
|
||||||
|
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
ip link set $IFACE down 2>/dev/null
|
||||||
|
ip addr flush dev $IFACE 2>/dev/null
|
||||||
|
ip link set $IFACE up
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
# Create hostapd config
|
||||||
|
cat > /tmp/hostapd-"$IFACE".conf <<EOF
|
||||||
|
interface=$IFACE
|
||||||
|
driver=nl80211
|
||||||
|
ssid=$SSID
|
||||||
|
hw_mode=g
|
||||||
|
channel=$CHANNEL
|
||||||
|
ieee80211n=1
|
||||||
|
wmm_enabled=1
|
||||||
|
auth_algs=1
|
||||||
|
ignore_broadcast_ssid=0
|
||||||
|
wpa=2
|
||||||
|
wpa_passphrase=$PSK
|
||||||
|
wpa_key_mgmt=WPA-PSK
|
||||||
|
rsn_pairwise=CCMP
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# Start hostapd
|
||||||
|
hostapd -B /tmp/hostapd-"$IFACE".conf || {
|
||||||
|
echo "hostapd failed to start"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Assign static IP to the AP interface
|
||||||
|
ip addr add "$AP_IP/24" dev "$IFACE"
|
||||||
|
ip link set "$IFACE" up
|
||||||
|
|
||||||
|
# Start dnsmasq (DHCP only – no DNS forwarding / no internet)
|
||||||
|
dnsmasq \
|
||||||
|
--interface="$IFACE" \
|
||||||
|
--bind-interfaces \
|
||||||
|
--dhcp-range="$DHCP_RANGE" \
|
||||||
|
--dhcp-option=3,"$AP_IP" \
|
||||||
|
--dhcp-option=6,"$AP_IP" \
|
||||||
|
--port=0 \
|
||||||
|
--no-resolv \
|
||||||
|
--pid-file=/tmp/dnsmasq-"$IFACE".pid \
|
||||||
|
--log-facility=/tmp/dnsmasq-"$IFACE".log &
|
||||||
|
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
# Show status
|
||||||
|
echo
|
||||||
|
echo "Local-only hotspot started"
|
||||||
|
echo " Interface : $IFACE"
|
||||||
|
echo " SSID : $SSID"
|
||||||
|
echo " Password : $PSK"
|
||||||
|
echo " Gateway : $AP_IP"
|
||||||
|
echo
|
||||||
|
iw dev "$IFACE" info 2>/dev/null | head -n 15
|
||||||
|
echo
|
||||||
|
ip addr show "$IFACE"
|
||||||
|
echo
|
||||||
|
echo "Clients will receive IPs in the range 192.168.43.10 – 192.168.43.50"
|
||||||
|
echo "No internet is shared (local network only)."
|
||||||
Executable
+107
@@ -0,0 +1,107 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Local-only hotspot using the internal SoftAP interface (wlan1)
|
||||||
|
# SSID: vegeta black
|
||||||
|
# Password: supermarioinreallife
|
||||||
|
|
||||||
|
IFACE="wlan1"
|
||||||
|
SSID="vegeta black"
|
||||||
|
PSK="supermarioinreallife"
|
||||||
|
CHANNEL="6"
|
||||||
|
AP_IP="192.168.43.1"
|
||||||
|
NET="192.168.43.0/24"
|
||||||
|
DHCP_RANGE="192.168.43.10,192.168.43.50,12h"
|
||||||
|
|
||||||
|
[ "$(id -u)" -ne 0 ] && { echo "Need root"; exit 1; }
|
||||||
|
|
||||||
|
echo "[*] Stopping Android Wi-Fi services (critical step)..."
|
||||||
|
# These commands release the radio so hostapd can take over
|
||||||
|
svc wifi disable 2>/dev/null
|
||||||
|
stop wpa_supplicant 2>/dev/null
|
||||||
|
killall wpa_supplicant hostapd dnsmasq 2>/dev/null
|
||||||
|
sleep 2
|
||||||
|
|
||||||
|
echo "[*] Preparing $IFACE..."
|
||||||
|
ip link set "$IFACE" down 2>/dev/null
|
||||||
|
ip addr flush dev "$IFACE" 2>/dev/null
|
||||||
|
|
||||||
|
# Make sure it is in AP mode
|
||||||
|
iw dev "$IFACE" set type __ap 2>/dev/null || iw dev "$IFACE" set type ap 2>/dev/null
|
||||||
|
ip link set "$IFACE" up
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
# Disable reverse path filter
|
||||||
|
echo 0 > /proc/sys/net/ipv4/conf/all/rp_filter
|
||||||
|
echo 0 > /proc/sys/net/ipv4/conf/"$IFACE"/rp_filter 2>/dev/null
|
||||||
|
|
||||||
|
# hostapd config
|
||||||
|
cat > /tmp/hostapd-$IFACE.conf <<EOF
|
||||||
|
interface=$IFACE
|
||||||
|
driver=nl80211
|
||||||
|
ssid=$SSID
|
||||||
|
hw_mode=g
|
||||||
|
channel=$CHANNEL
|
||||||
|
ieee80211n=1
|
||||||
|
wmm_enabled=1
|
||||||
|
auth_algs=1
|
||||||
|
wpa=2
|
||||||
|
wpa_passphrase=$PSK
|
||||||
|
wpa_key_mgmt=WPA-PSK
|
||||||
|
rsn_pairwise=CCMP
|
||||||
|
ignore_broadcast_ssid=0
|
||||||
|
EOF
|
||||||
|
|
||||||
|
echo "[*] Starting hostapd on $IFACE..."
|
||||||
|
hostapd -B /tmp/hostapd-$IFACE.conf
|
||||||
|
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo
|
||||||
|
echo "hostapd still failed. Trying alternative method..."
|
||||||
|
# Sometimes a short delay + re-up helps
|
||||||
|
ip link set "$IFACE" down
|
||||||
|
sleep 1
|
||||||
|
ip link set "$IFACE" up
|
||||||
|
sleep 1
|
||||||
|
hostapd -B /tmp/hostapd-$IFACE.conf || {
|
||||||
|
echo "Still failing. Paste the full hostapd error."
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
# Assign IP
|
||||||
|
ip addr add $AP_IP/24 broadcast 192.168.43.255 dev $IFACE
|
||||||
|
ip route add $NET dev $IFACE src $AP_IP 2>/dev/null
|
||||||
|
|
||||||
|
# Firewall
|
||||||
|
iptables -I INPUT -i $IFACE -j ACCEPT
|
||||||
|
iptables -I OUTPUT -o $IFACE -j ACCEPT
|
||||||
|
iptables -I FORWARD -i $IFACE -j ACCEPT
|
||||||
|
iptables -I FORWARD -o $IFACE -j ACCEPT
|
||||||
|
|
||||||
|
# DHCP
|
||||||
|
echo "[*] Starting dnsmasq..."
|
||||||
|
dnsmasq \
|
||||||
|
--interface=$IFACE \
|
||||||
|
--bind-interfaces \
|
||||||
|
--dhcp-range=$DHCP_RANGE \
|
||||||
|
--dhcp-option=3,$AP_IP \
|
||||||
|
--dhcp-option=6,$AP_IP \
|
||||||
|
--port=0 \
|
||||||
|
--no-resolv \
|
||||||
|
--pid-file=/tmp/dnsmasq-$IFACE.pid &
|
||||||
|
|
||||||
|
sleep 2
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "=== Status ==="
|
||||||
|
iw dev $IFACE info
|
||||||
|
echo
|
||||||
|
ip -4 addr show $IFACE
|
||||||
|
echo
|
||||||
|
echo "SSID : $SSID"
|
||||||
|
echo "Password : $PSK"
|
||||||
|
echo "Gateway : $AP_IP"
|
||||||
|
echo
|
||||||
|
echo "Connect your PC and try: ping 192.168.43.1"
|
||||||
Executable
+79
@@ -0,0 +1,79 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Local-only hotspot using Android's built-in SoftAP (wlan1)
|
||||||
|
# SSID & password are set in Android Settings → Hotspot
|
||||||
|
# This script only takes control of the interface afterwards
|
||||||
|
|
||||||
|
IFACE="wlan1"
|
||||||
|
AP_IP="192.168.43.1"
|
||||||
|
NET="192.168.43.0/24"
|
||||||
|
DHCP_RANGE="192.168.43.10,192.168.43.50,12h"
|
||||||
|
|
||||||
|
[ "$(id -u)" -ne 0 ] && { echo "Need root"; exit 1; }
|
||||||
|
|
||||||
|
echo "[*] Waiting for Android hotspot interface ($IFACE)..."
|
||||||
|
# Give you time to turn the hotspot on
|
||||||
|
for i in $(seq 1 15); do
|
||||||
|
if ip link show "$IFACE" >/dev/null 2>&1; then
|
||||||
|
echo " Found $IFACE"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
|
||||||
|
if ! ip link show "$IFACE" >/dev/null 2>&1; then
|
||||||
|
echo "Interface $IFACE not found."
|
||||||
|
echo "Turn on the normal Android Wi-Fi Hotspot first, then run this script again."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "[*] Taking control of $IFACE..."
|
||||||
|
|
||||||
|
# Kill any existing DHCP / hostapd from Android or previous runs
|
||||||
|
killall dnsmasq hostapd 2>/dev/null
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
# Disable reverse path filter
|
||||||
|
echo 0 > /proc/sys/net/ipv4/conf/all/rp_filter
|
||||||
|
echo 0 > /proc/sys/net/ipv4/conf/"$IFACE"/rp_filter 2>/dev/null
|
||||||
|
|
||||||
|
# Flush old addresses and routes
|
||||||
|
ip addr flush dev "$IFACE" 2>/dev/null
|
||||||
|
ip route flush dev "$IFACE" 2>/dev/null
|
||||||
|
|
||||||
|
# Assign our fixed gateway IP
|
||||||
|
ip addr add "$AP_IP/24" broadcast 192.168.43.255 dev "$IFACE"
|
||||||
|
ip link set "$IFACE" up
|
||||||
|
ip route add "$NET" dev "$IFACE" src "$AP_IP" 2>/dev/null
|
||||||
|
|
||||||
|
# Allow traffic
|
||||||
|
iptables -I INPUT -i "$IFACE" -j ACCEPT
|
||||||
|
iptables -I OUTPUT -o "$IFACE" -j ACCEPT
|
||||||
|
iptables -I FORWARD -i "$IFACE" -j ACCEPT
|
||||||
|
iptables -I FORWARD -o "$IFACE" -j ACCEPT
|
||||||
|
|
||||||
|
# Start our own DHCP (local only – no internet)
|
||||||
|
echo "[*] Starting local DHCP server..."
|
||||||
|
dnsmasq \
|
||||||
|
--interface="$IFACE" \
|
||||||
|
--bind-interfaces \
|
||||||
|
--dhcp-range="$DHCP_RANGE" \
|
||||||
|
--dhcp-option=3,"$AP_IP" \
|
||||||
|
--dhcp-option=6,"$AP_IP" \
|
||||||
|
--port=0 \
|
||||||
|
--no-resolv \
|
||||||
|
--pid-file=/tmp/dnsmasq-"$IFACE".pid \
|
||||||
|
--log-dhcp &
|
||||||
|
|
||||||
|
sleep 2
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "=== Local-only Hotspot ready ==="
|
||||||
|
echo "Interface : $IFACE"
|
||||||
|
echo "Gateway : $AP_IP"
|
||||||
|
echo "DHCP : 192.168.43.10 – 192.168.43.50"
|
||||||
|
echo
|
||||||
|
echo "SSID and password are whatever you set in Android Hotspot settings."
|
||||||
|
echo "Connect your PC and try: ping 192.168.43.1"
|
||||||
|
echo
|
||||||
|
ip -4 addr show "$IFACE"
|
||||||
Executable
+110
@@ -0,0 +1,110 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Standalone local-only hotspot (hostapd + dnsmasq)
|
||||||
|
# SSID: vegeta black
|
||||||
|
# Password: supermarioinreallife
|
||||||
|
|
||||||
|
IFACE="wlan1"
|
||||||
|
SSID="vegeta black"
|
||||||
|
PSK="supermarioinreallife"
|
||||||
|
CHANNEL="6"
|
||||||
|
AP_IP="192.168.43.1"
|
||||||
|
NET="192.168.43.0/24"
|
||||||
|
DHCP_RANGE="192.168.43.10,192.168.43.50,12h"
|
||||||
|
|
||||||
|
[ "$(id -u)" -ne 0 ] && { echo "Need root"; exit 1; }
|
||||||
|
|
||||||
|
echo "[*] Cleaning previous state..."
|
||||||
|
killall hostapd dnsmasq wpa_supplicant 2>/dev/null
|
||||||
|
svc wifi disable 2>/dev/null
|
||||||
|
sleep 2
|
||||||
|
|
||||||
|
# Fully reset the interface
|
||||||
|
ip link set "$IFACE" down 2>/dev/null
|
||||||
|
ip addr flush dev "$IFACE" 2>/dev/null
|
||||||
|
ip route flush dev "$IFACE" 2>/dev/null
|
||||||
|
|
||||||
|
# Force AP mode
|
||||||
|
iw dev "$IFACE" set type __ap 2>/dev/null || iw dev "$IFACE" set type ap 2>/dev/null
|
||||||
|
sleep 1
|
||||||
|
ip link set "$IFACE" up
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
# Disable reverse path filter
|
||||||
|
echo 0 > /proc/sys/net/ipv4/conf/all/rp_filter
|
||||||
|
echo 0 > /proc/sys/net/ipv4/conf/"$IFACE"/rp_filter 2>/dev/null
|
||||||
|
|
||||||
|
# hostapd config
|
||||||
|
cat > /tmp/hostapd-$IFACE.conf <<EOF
|
||||||
|
interface=$IFACE
|
||||||
|
driver=nl80211
|
||||||
|
ssid=$SSID
|
||||||
|
hw_mode=g
|
||||||
|
channel=$CHANNEL
|
||||||
|
ieee80211n=1
|
||||||
|
wmm_enabled=1
|
||||||
|
auth_algs=1
|
||||||
|
wpa=2
|
||||||
|
wpa_passphrase=$PSK
|
||||||
|
wpa_key_mgmt=WPA-PSK
|
||||||
|
rsn_pairwise=CCMP
|
||||||
|
ignore_broadcast_ssid=0
|
||||||
|
EOF
|
||||||
|
|
||||||
|
echo "[*] Starting hostapd..."
|
||||||
|
hostapd -B /tmp/hostapd-$IFACE.conf
|
||||||
|
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo
|
||||||
|
echo "hostapd failed. Trying one more time after extra reset..."
|
||||||
|
ip link set "$IFACE" down
|
||||||
|
sleep 2
|
||||||
|
iw dev "$IFACE" set type __ap 2>/dev/null
|
||||||
|
ip link set "$IFACE" up
|
||||||
|
sleep 2
|
||||||
|
hostapd -B /tmp/hostapd-$IFACE.conf || {
|
||||||
|
echo "hostapd still failed."
|
||||||
|
echo "Run this and paste the output:"
|
||||||
|
echo " hostapd -d /tmp/hostapd-$IFACE.conf"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
# Assign IP
|
||||||
|
ip addr add $AP_IP/24 broadcast 192.168.43.255 dev $IFACE
|
||||||
|
ip link set $IFACE up
|
||||||
|
ip route add $NET dev $IFACE src $AP_IP 2>/dev/null
|
||||||
|
|
||||||
|
# Firewall
|
||||||
|
iptables -I INPUT -i $IFACE -j ACCEPT
|
||||||
|
iptables -I OUTPUT -o $IFACE -j ACCEPT
|
||||||
|
iptables -I FORWARD -i $IFACE -j ACCEPT
|
||||||
|
iptables -I FORWARD -o $IFACE -j ACCEPT
|
||||||
|
|
||||||
|
# DHCP
|
||||||
|
echo "[*] Starting dnsmasq..."
|
||||||
|
dnsmasq \
|
||||||
|
--interface=$IFACE \
|
||||||
|
--bind-interfaces \
|
||||||
|
--dhcp-range=$DHCP_RANGE \
|
||||||
|
--dhcp-option=3,$AP_IP \
|
||||||
|
--dhcp-option=6,$AP_IP \
|
||||||
|
--port=0 \
|
||||||
|
--no-resolv \
|
||||||
|
--pid-file=/tmp/dnsmasq-$IFACE.pid &
|
||||||
|
|
||||||
|
sleep 2
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "=== Standalone Hotspot Started ==="
|
||||||
|
echo "SSID : $SSID"
|
||||||
|
echo "Password : $PSK"
|
||||||
|
echo "Gateway : $AP_IP"
|
||||||
|
echo
|
||||||
|
iw dev $IFACE info 2>/dev/null | head -15
|
||||||
|
echo
|
||||||
|
ip -4 addr show $IFACE
|
||||||
|
echo
|
||||||
|
echo "Connect your PC and try: ping 192.168.43.1"
|
||||||
Executable
+60
@@ -0,0 +1,60 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Reliable local-only hotspot using Android SoftAP
|
||||||
|
# 1. Turn Android Hotspot ON first
|
||||||
|
# 2. Run this script
|
||||||
|
|
||||||
|
IFACE="wlan1"
|
||||||
|
AP_IP="192.168.43.1"
|
||||||
|
NET="192.168.43.0/24"
|
||||||
|
DHCP_RANGE="192.168.43.10,192.168.43.50,12h"
|
||||||
|
|
||||||
|
[ "$(id -u)" -ne 0 ] && { echo "Need root"; exit 1; }
|
||||||
|
|
||||||
|
if ! ip link show "$IFACE" >/dev/null 2>&1; then
|
||||||
|
echo "Turn the Android Hotspot ON first, then run this script."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "[*] Taking control of Android SoftAP on $IFACE..."
|
||||||
|
|
||||||
|
# Only kill DHCP, leave Android's hostapd running
|
||||||
|
killall dnsmasq 2>/dev/null
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
# Disable reverse path filter
|
||||||
|
echo 0 > /proc/sys/net/ipv4/conf/all/rp_filter
|
||||||
|
echo 0 > /proc/sys/net/ipv4/conf/$IFACE/rp_filter 2>/dev/null
|
||||||
|
|
||||||
|
# Add our gateway IP (keep whatever Android already has)
|
||||||
|
ip addr add $AP_IP/24 broadcast 192.168.43.255 dev $IFACE 2>/dev/null
|
||||||
|
ip link set $IFACE up
|
||||||
|
ip route add $NET dev $IFACE src $AP_IP 2>/dev/null
|
||||||
|
|
||||||
|
# Allow traffic
|
||||||
|
iptables -C INPUT -i $IFACE -j ACCEPT 2>/dev/null || iptables -I INPUT -i $IFACE -j ACCEPT
|
||||||
|
iptables -C OUTPUT -o $IFACE -j ACCEPT 2>/dev/null || iptables -I OUTPUT -o $IFACE -j ACCEPT
|
||||||
|
iptables -C FORWARD -i $IFACE -j ACCEPT 2>/dev/null || iptables -I FORWARD -i $IFACE -j ACCEPT
|
||||||
|
iptables -C FORWARD -o $IFACE -j ACCEPT 2>/dev/null || iptables -I FORWARD -o $IFACE -j ACCEPT
|
||||||
|
|
||||||
|
# Start our DHCP
|
||||||
|
dnsmasq \
|
||||||
|
--interface=$IFACE \
|
||||||
|
--bind-interfaces \
|
||||||
|
--dhcp-range=$DHCP_RANGE \
|
||||||
|
--dhcp-option=3,$AP_IP \
|
||||||
|
--dhcp-option=6,$AP_IP \
|
||||||
|
--port=0 \
|
||||||
|
--no-resolv \
|
||||||
|
--pid-file=/tmp/dnsmasq-$IFACE.pid &
|
||||||
|
|
||||||
|
sleep 2
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "=== Local-only Hotspot Ready ==="
|
||||||
|
echo "SSID & Password = whatever you set in Android Hotspot settings"
|
||||||
|
echo "Gateway = $AP_IP"
|
||||||
|
echo
|
||||||
|
ip -4 addr show $IFACE
|
||||||
|
echo
|
||||||
|
echo "Connect your PC and ping 192.168.43.1"
|
||||||
Executable
+123
@@ -0,0 +1,123 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Aggressive standalone local-only hotspot
|
||||||
|
# Tries to fully release Android's control of the radio
|
||||||
|
|
||||||
|
IFACE="wlan1"
|
||||||
|
SSID="vegeta black"
|
||||||
|
PSK="supermarioinreallife"
|
||||||
|
CHANNEL="6"
|
||||||
|
AP_IP="192.168.43.1"
|
||||||
|
NET="192.168.43.0/24"
|
||||||
|
DHCP_RANGE="192.168.43.10,192.168.43.50,12h"
|
||||||
|
|
||||||
|
[ "$(id -u)" -ne 0 ] && { echo "Need root"; exit 1; }
|
||||||
|
|
||||||
|
echo "[*] Aggressively stopping Android Wi-Fi stack..."
|
||||||
|
|
||||||
|
# Stop as many Android Wi-Fi related services as possible
|
||||||
|
svc wifi disable 2>/dev/null
|
||||||
|
stop wpa_supplicant 2>/dev/null
|
||||||
|
stop wifi 2>/dev/null
|
||||||
|
killall wpa_supplicant hostapd dnsmasq wificond 2>/dev/null
|
||||||
|
sleep 2
|
||||||
|
|
||||||
|
# Extra force
|
||||||
|
setprop ctl.stop wpa_supplicant 2>/dev/null
|
||||||
|
setprop ctl.stop wifi 2>/dev/null
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
echo "[*] Fully resetting $IFACE..."
|
||||||
|
ip link set "$IFACE" down 2>/dev/null
|
||||||
|
ip addr flush dev "$IFACE" 2>/dev/null
|
||||||
|
ip route flush dev "$IFACE" 2>/dev/null
|
||||||
|
|
||||||
|
# Delete and recreate the interface if possible
|
||||||
|
iw dev "$IFACE" del 2>/dev/null
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
# Try to create a clean AP interface
|
||||||
|
iw phy phy0 interface add "$IFACE" type __ap 2>/dev/null || \
|
||||||
|
iw phy phy0 interface add "$IFACE" type ap 2>/dev/null
|
||||||
|
|
||||||
|
sleep 1
|
||||||
|
ip link set "$IFACE" up 2>/dev/null
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
# Disable reverse path filter
|
||||||
|
echo 0 > /proc/sys/net/ipv4/conf/all/rp_filter
|
||||||
|
echo 0 > /proc/sys/net/ipv4/conf/"$IFACE"/rp_filter 2>/dev/null
|
||||||
|
|
||||||
|
# hostapd config
|
||||||
|
cat > /tmp/hostapd-$IFACE.conf <<EOF
|
||||||
|
interface=$IFACE
|
||||||
|
driver=nl80211
|
||||||
|
ssid=$SSID
|
||||||
|
hw_mode=g
|
||||||
|
channel=$CHANNEL
|
||||||
|
ieee80211n=1
|
||||||
|
wmm_enabled=1
|
||||||
|
auth_algs=1
|
||||||
|
wpa=2
|
||||||
|
wpa_passphrase=$PSK
|
||||||
|
wpa_key_mgmt=WPA-PSK
|
||||||
|
rsn_pairwise=CCMP
|
||||||
|
ignore_broadcast_ssid=0
|
||||||
|
EOF
|
||||||
|
|
||||||
|
echo "[*] Starting hostapd..."
|
||||||
|
hostapd -B /tmp/hostapd-$IFACE.conf
|
||||||
|
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo
|
||||||
|
echo "Still failed. Trying one last method..."
|
||||||
|
# Last resort: bring interface down/up again
|
||||||
|
ip link set "$IFACE" down
|
||||||
|
sleep 2
|
||||||
|
iw dev "$IFACE" set type __ap 2>/dev/null
|
||||||
|
ip link set "$IFACE" up
|
||||||
|
sleep 2
|
||||||
|
hostapd -B /tmp/hostapd-$IFACE.conf || {
|
||||||
|
echo
|
||||||
|
echo "Standalone hostapd is not working reliably on this device."
|
||||||
|
echo "The internal Wi-Fi firmware is still holding management frames."
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
# Configure IP
|
||||||
|
ip addr add $AP_IP/24 broadcast 192.168.43.255 dev $IFACE
|
||||||
|
ip link set $IFACE up
|
||||||
|
ip route add $NET dev $IFACE src $AP_IP 2>/dev/null
|
||||||
|
|
||||||
|
# Firewall
|
||||||
|
iptables -I INPUT -i $IFACE -j ACCEPT
|
||||||
|
iptables -I OUTPUT -o $IFACE -j ACCEPT
|
||||||
|
iptables -I FORWARD -i $IFACE -j ACCEPT
|
||||||
|
iptables -I FORWARD -o $IFACE -j ACCEPT
|
||||||
|
|
||||||
|
# DHCP
|
||||||
|
echo "[*] Starting dnsmasq..."
|
||||||
|
dnsmasq \
|
||||||
|
--interface=$IFACE \
|
||||||
|
--bind-interfaces \
|
||||||
|
--dhcp-range=$DHCP_RANGE \
|
||||||
|
--dhcp-option=3,$AP_IP \
|
||||||
|
--dhcp-option=6,$AP_IP \
|
||||||
|
--port=0 \
|
||||||
|
--no-resolv \
|
||||||
|
--pid-file=/tmp/dnsmasq-$IFACE.pid &
|
||||||
|
|
||||||
|
sleep 2
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "=== Standalone Hotspot ==="
|
||||||
|
echo "SSID : $SSID"
|
||||||
|
echo "Password : $PSK"
|
||||||
|
echo "Gateway : $AP_IP"
|
||||||
|
echo
|
||||||
|
iw dev $IFACE info 2>/dev/null | head -12
|
||||||
|
echo
|
||||||
|
ip -4 addr show $IFACE
|
||||||
Executable
+55
@@ -0,0 +1,55 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
IFACE="wlan1"
|
||||||
|
SSID="vegeta black"
|
||||||
|
PSK="supermarioinreallife"
|
||||||
|
CHANNEL="6"
|
||||||
|
AP_IP="192.168.43.1"
|
||||||
|
NET="192.168.43.0/24"
|
||||||
|
DHCP_RANGE="192.168.43.10,192.168.43.50,12h"
|
||||||
|
|
||||||
|
[ "$(id -u)" -ne 0 ] && exit 1
|
||||||
|
|
||||||
|
killall hostapd dnsmasq 2>/dev/null
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
# Simple, highly compatible hostapd config
|
||||||
|
cat > /tmp/hostapd-$IFACE.conf <<EOF
|
||||||
|
interface=$IFACE
|
||||||
|
driver=nl80211
|
||||||
|
ssid=$SSID
|
||||||
|
hw_mode=g
|
||||||
|
channel=$CHANNEL
|
||||||
|
macaddr_acl=0
|
||||||
|
auth_algs=1
|
||||||
|
ignore_broadcast_ssid=0
|
||||||
|
wpa=2
|
||||||
|
wpa_passphrase=$PSK
|
||||||
|
wpa_key_mgmt=WPA-PSK
|
||||||
|
wpa_pairwise=CCMP
|
||||||
|
rsn_pairwise=CCMP
|
||||||
|
EOF
|
||||||
|
|
||||||
|
hostapd -B /tmp/hostapd-$IFACE.conf
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
ip addr flush dev $IFACE
|
||||||
|
ip addr add $AP_IP/24 broadcast 192.168.43.255 dev $IFACE
|
||||||
|
ip link set $IFACE up
|
||||||
|
ip route add $NET dev $IFACE src $AP_IP
|
||||||
|
|
||||||
|
iptables -I INPUT -i $IFACE -j ACCEPT
|
||||||
|
iptables -I OUTPUT -o $IFACE -j ACCEPT
|
||||||
|
|
||||||
|
dnsmasq --interface=$IFACE --bind-interfaces \
|
||||||
|
--dhcp-range=$DHCP_RANGE \
|
||||||
|
--dhcp-option=3,$AP_IP \
|
||||||
|
--dhcp-option=6,$AP_IP \
|
||||||
|
--port=0 --no-resolv &
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "Hotspot should be up."
|
||||||
|
echo "SSID: $SSID"
|
||||||
|
echo "Password: $PSK"
|
||||||
|
echo
|
||||||
|
iw dev $IFACE info | head -10
|
||||||
Executable
+44
@@ -0,0 +1,44 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
IFACE="wlan1"
|
||||||
|
SSID="vegeta black"
|
||||||
|
PSK="supermarioinreallife"
|
||||||
|
CHANNEL="6"
|
||||||
|
AP_IP="192.168.43.1"
|
||||||
|
|
||||||
|
[ "$(id -u)" -ne 0 ] && exit 1
|
||||||
|
|
||||||
|
echo "[*] Hard reset of Wi-Fi stack..."
|
||||||
|
|
||||||
|
svc wifi disable
|
||||||
|
killall hostapd dnsmasq wpa_supplicant wificond 2>/dev/null
|
||||||
|
sleep 3
|
||||||
|
|
||||||
|
# Delete the interface completely
|
||||||
|
iw dev $IFACE del 2>/dev/null
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
# Create a fresh AP interface
|
||||||
|
iw phy phy0 interface add $IFACE type __ap
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
ip link set $IFACE down
|
||||||
|
ip addr flush dev $IFACE
|
||||||
|
ip link set $IFACE up
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
# Very simple hostapd config
|
||||||
|
cat > /tmp/hostapd.conf <<EOF
|
||||||
|
interface=$IFACE
|
||||||
|
driver=nl80211
|
||||||
|
ssid=$SSID
|
||||||
|
hw_mode=g
|
||||||
|
channel=$CHANNEL
|
||||||
|
wpa=2
|
||||||
|
wpa_passphrase=$PSK
|
||||||
|
wpa_key_mgmt=WPA-PSK
|
||||||
|
rsn_pairwise=CCMP
|
||||||
|
EOF
|
||||||
|
|
||||||
|
echo "[*] Starting hostapd (watch for errors)..."
|
||||||
|
hostapd /tmp/hostapd.conf
|
||||||
Executable
+51
@@ -0,0 +1,51 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
IFACE="wlan1"
|
||||||
|
SSID="vegeta black"
|
||||||
|
PSK="supermarioinreallife"
|
||||||
|
CHANNEL="6"
|
||||||
|
AP_IP="192.168.43.1"
|
||||||
|
|
||||||
|
[ "$(id -u)" -ne 0 ] && exit 1
|
||||||
|
|
||||||
|
echo "[*] Hard reset of Wi-Fi stack..."
|
||||||
|
|
||||||
|
# Full path to Android's svc
|
||||||
|
/system/bin/svc wifi disable 2>/dev/null
|
||||||
|
killall hostapd dnsmasq wpa_supplicant wificond 2>/dev/null
|
||||||
|
sleep 3
|
||||||
|
|
||||||
|
# Delete the interface
|
||||||
|
iw dev $IFACE del 2>/dev/null
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
# Create a fresh AP interface
|
||||||
|
iw phy phy0 interface add $IFACE type __ap 2>/dev/null || \
|
||||||
|
iw phy phy0 interface add $IFACE type ap 2>/dev/null
|
||||||
|
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
ip link set $IFACE down 2>/dev/null
|
||||||
|
ip addr flush dev $IFACE 2>/dev/null
|
||||||
|
ip link set $IFACE up
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
# Simple hostapd config
|
||||||
|
cat > /tmp/hostapd.conf <<EOF
|
||||||
|
interface=$IFACE
|
||||||
|
driver=nl80211
|
||||||
|
ssid=$SSID
|
||||||
|
hw_mode=g
|
||||||
|
channel=$CHANNEL
|
||||||
|
wpa=2
|
||||||
|
wpa_passphrase=$PSK
|
||||||
|
wpa_key_mgmt=WPA-PSK
|
||||||
|
rsn_pairwise=CCMP
|
||||||
|
EOF
|
||||||
|
|
||||||
|
echo "[*] Starting hostapd (running in foreground)..."
|
||||||
|
echo "Look for the line: AP-ENABLED"
|
||||||
|
echo "Press Ctrl+C to stop later"
|
||||||
|
echo
|
||||||
|
|
||||||
|
hostapd /tmp/hostapd.conf
|
||||||
@@ -0,0 +1,166 @@
|
|||||||
|
#profile: executed by the command interpreter for login shells.
|
||||||
|
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
|
||||||
|
# exists.
|
||||||
|
# see /usr/share/doc/bash/examples/startup-files for examples.
|
||||||
|
# the files are located in the bash-doc package.
|
||||||
|
|
||||||
|
# the default umask is set in /etc/profile; for setting the umask
|
||||||
|
# for ssh logins, install and configure the libpam-umask package.
|
||||||
|
#umask 022
|
||||||
|
|
||||||
|
|
||||||
|
# set PATH so it includes user's private bin if it exists
|
||||||
|
if [ -d "$HOME/bin" ] ; then
|
||||||
|
PATH="$HOME/bin:$PATH"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# set PATH so it includes user's private bin if it exists
|
||||||
|
if [ -d "$HOME/.local/bin" ] ; then
|
||||||
|
PATH="$HOME/.local/bin:$PATH"
|
||||||
|
fi
|
||||||
|
|
||||||
|
#text colors
|
||||||
|
txtblk='\e[0;30m' # Black - Regular
|
||||||
|
txtred='\e[0;31m' # Red
|
||||||
|
txtgrn='\e[0;32m' # Green
|
||||||
|
txtylw='\e[0;33m' # Yellow
|
||||||
|
txtblu='\e[0;34m' # Blue
|
||||||
|
txtpur='\e[0;35m' # Purple
|
||||||
|
txtcyn='\e[0;36m' # Cyan
|
||||||
|
txtwht='\e[0;37m' # White
|
||||||
|
|
||||||
|
x="/etc/X11/xorg.conf.d"
|
||||||
|
xmonad="$HOME/.xmonad/xmonad.hs"
|
||||||
|
xmo=$xmonad
|
||||||
|
gpc="$HOME/mnt/gaming-win/C:/Users/lucka/"
|
||||||
|
brc="$HOME/.bashrc"
|
||||||
|
alias v="vim"
|
||||||
|
alias s="sudo"
|
||||||
|
alias mg="sshfs gaming-pc.mario:/ ~/mnt/gaming-pc"
|
||||||
|
alias mt="sshfs lucka@terraria.mario: ~/mnt/terraria.mario"
|
||||||
|
alias umg="umount ~/mnt/gaming-pc"
|
||||||
|
#alias ms="sshfs truenas.mario:/mnt/b8ce9a57-7ce7-47b8-a233-21184c8a0953/share ~/share -o reconnect -o ServerAliveInterval=15"
|
||||||
|
#alias ums="umount ~/share"
|
||||||
|
alias p="~/sh/ytmusicquick"
|
||||||
|
alias nas="ssh nas.mario"
|
||||||
|
#alias mn="sshfs -o allow_root truenas.mario:/mnt/mario ~/mnt/truenas.mario"
|
||||||
|
mn () {
|
||||||
|
sudo mount -o rsize=131072,wsize=131072,nconnect=16 -t nfs 10.0.21.1:/mnt/mario/share ~/mnt/truenas.mario/share
|
||||||
|
sudo mount -o rsize=131072,wsize=131072,nconnect=16 -t nfs 10.0.21.1:/mnt/mario/websites ~/mnt/truenas.mario/websites
|
||||||
|
sudo mount -o rsize=131072,wsize=131072,nconnect=16 -t nfs 10.0.21.1:/mnt/mario/roms ~/mnt/truenas.mario/roms
|
||||||
|
#sudo mount -o rsize=130048,wsize=131007,bsize=16777216,username=roms,password=00P9sVAgGQymKp2hZi79TYXliJt20tAT,uid=1000,gid=1000,iocharset=utf8,mapposix,actimeo=6,echo_interval=1,nostrictsync,cache=loose,nocase,soft,vers=3.1.1 -t cifs //10.0.21.1/roms ~/mnt/truenas.mario/roms
|
||||||
|
sudo mount --bind /home/lucka/.steam/steam/steamapps/compatdata /home/lucka/mnt/truenas.mario/roms/windows/Steamm/steamapps/compatdata
|
||||||
|
sudo mount -o rsize=131072,wsize=131072,nconnect=16 -t nfs 10.0.21.1:/mnt/slowpool/movies ~/mnt/truenas.mario/movies
|
||||||
|
sudo mount -o rsize=131072,wsize=131072,nconnect=16 -t nfs 10.0.21.1:/mnt/mario/os-isos/template/iso ~/mnt/truenas.mario/os-isos
|
||||||
|
}
|
||||||
|
alias umn="sudo umount ~/mnt/truenas.mario/*"
|
||||||
|
alias mfs="~/sh/mount-all-filesystems.sh"
|
||||||
|
alias lgctl="~/sh/lgctl"
|
||||||
|
alias bs="barriers -f -c ~/.config/barrier-server.conf --disable-crypto"
|
||||||
|
alias xe="vim ~/.xmonad/xmonad.hs"
|
||||||
|
sshfs(){
|
||||||
|
/usr/bin/sshfs -o reconnect,allow_root,workaround=buflimit,ServerAliveInterval=15,ServerAliveCountMax=3 $*
|
||||||
|
}
|
||||||
|
ytmp3 () {
|
||||||
|
yt-dlp --extract-audio --audio-format mp3 $@
|
||||||
|
}
|
||||||
|
ytmp3numbered () {
|
||||||
|
ytmp3 --output "%(autonumber)s - %(title)s.%(ext)s" $@
|
||||||
|
}
|
||||||
|
ytdl () {
|
||||||
|
yt-dlp "$*"
|
||||||
|
}
|
||||||
|
tfcfg () {
|
||||||
|
ssh gaming-win -t "e: && cd steamlibrary\steamapps\common\team fortress 2\tf\cfg && cmd"
|
||||||
|
}
|
||||||
|
gremote () {
|
||||||
|
#bash -c 'sleep 2 && remmina -c vnc://127.0.0.1:5901' &
|
||||||
|
ssh -L 5901:127.0.0.1:5901 $1 'pkill x11vnc; x11vnc -display :0 -rfbport 5901 -localhost -threads -noxfixes -noxdamage'
|
||||||
|
}
|
||||||
|
i () {
|
||||||
|
sudo apt install "$*"
|
||||||
|
}
|
||||||
|
u () {
|
||||||
|
sudo apt purge "$*"
|
||||||
|
}
|
||||||
|
sshmnt () {
|
||||||
|
mkdir -p ~/mnt/$1
|
||||||
|
sshfs -o ServerAliveInterval=7 $1 ~/mnt/$1
|
||||||
|
}
|
||||||
|
n () {
|
||||||
|
numlockx off
|
||||||
|
}
|
||||||
|
terminal-open () {
|
||||||
|
xfce4-terminal --command "$*"
|
||||||
|
}
|
||||||
|
topen () {
|
||||||
|
terminal-open "$*"
|
||||||
|
}
|
||||||
|
+x () {
|
||||||
|
chmod ug+x $*
|
||||||
|
}
|
||||||
|
cdwm () {
|
||||||
|
cd ~/compile/lukedwm/dwm
|
||||||
|
}
|
||||||
|
recordto () {
|
||||||
|
ffmpeg -f pulse -i default -codec:a flac "${1}.flac"
|
||||||
|
}
|
||||||
|
getclip () {
|
||||||
|
xclip -selection c -o
|
||||||
|
}
|
||||||
|
setclip () {
|
||||||
|
xclip -selection c
|
||||||
|
}
|
||||||
|
sshsus () {
|
||||||
|
ssh -J root@10.0.42.69 $*
|
||||||
|
}
|
||||||
|
webp () {
|
||||||
|
ffmpeg -i $1 -vcodec libwebp -filter:v fps=fps=60 -lossless 1 -loop 0 -preset default -an -vsync 0 $1.webp
|
||||||
|
}
|
||||||
|
alias py="python3"
|
||||||
|
pssh () {
|
||||||
|
adb forward tcp:65522 tcp:22; ssh root@127.0.0.1 -p 65522 $*
|
||||||
|
}
|
||||||
|
testvidmode () {
|
||||||
|
xrandr --delmode HDMI-A-0 $1
|
||||||
|
xrandr --rmmode $1
|
||||||
|
xrandr --newmode $*
|
||||||
|
xrandr --addmode HDMI-A-0 $1
|
||||||
|
xrandr --output HDMI-A-0 --mode $1
|
||||||
|
}
|
||||||
|
nintendontify () {
|
||||||
|
for i in *; do mkdir "$(echo $i | sed 's/.iso//')"; mv "$i" "$(echo $i | sed 's/.iso//')"/game.iso; done
|
||||||
|
}
|
||||||
|
wiiconnect () {
|
||||||
|
bluetoothctl connect 00:1E:35:3A:A9:B5
|
||||||
|
}
|
||||||
|
vsync () {
|
||||||
|
picom --backend glx --vsync
|
||||||
|
}
|
||||||
|
testvidmode2 () {
|
||||||
|
xrandr --delmode DisplayPort-0 $1
|
||||||
|
xrandr --rmmode $1
|
||||||
|
xrandr --newmode $*
|
||||||
|
xrandr --addmode DisplayPort-0 $1
|
||||||
|
xrandr --output DisplayPort-0 --mode $1
|
||||||
|
}
|
||||||
|
crtTV () {
|
||||||
|
testvidmode2 "640x480_60i" 13.038 640 666 727 831 480 483 489 523 interlace -hsync -vsync
|
||||||
|
xrandr --output DisplayPort-0 --transform none --below HDMI-A-0
|
||||||
|
}
|
||||||
|
crtTVscale () {
|
||||||
|
testvidmode2 "1280x480_60i" 26.108 1280 1364 1487 1664 480 483 489 523 interlace -hsync -vsync
|
||||||
|
xrandr --output DisplayPort-0 --mode 1280x480_60i --scale-from 1280x960 --same-as HDMI-A-0
|
||||||
|
}
|
||||||
|
crtTV240 () {
|
||||||
|
# testvidmode2 "320x240_60" 6.515 320 333 364 416 240 241 244 261 -hsync -vsync
|
||||||
|
testvidmode2 "320x240_60" 6.515 320 341 372 416 240 241 244 261 -hsync -vsync
|
||||||
|
xrandr --output DisplayPort-0 --transform none --below HDMI-A-0
|
||||||
|
}
|
||||||
|
crtTV240scale () {
|
||||||
|
testvidmode2 "1280x240_60" 26.108 1280 1364 1487 1664 240 241 244 262 -hsync -vsync
|
||||||
|
xrandr --output DisplayPort-0 --mode 1280x240_60 --scale-from 1280x960 --same-as HDMI-A-0
|
||||||
|
}
|
||||||
|
crtTVOff () {
|
||||||
|
xrandr --output DisplayPort-0 --off
|
||||||
|
}
|
||||||
Executable
+11
@@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
delMode () {
|
||||||
|
xrandr --delmode HDMI-A-0 "$1"
|
||||||
|
xrandr --rmmode "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
for i in $(xrandr | grep -o '1280x960_[^ ]*')
|
||||||
|
do
|
||||||
|
delMode $i
|
||||||
|
done
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
normal
|
||||||
Executable
+15
@@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Toggle between crtTV240 and crtTV240ra each time this script is run
|
||||||
|
|
||||||
|
source ~/.profile 2>/dev/null || true
|
||||||
|
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
STATE_FILE="$SCRIPT_DIR/.crt_tv_toggle"
|
||||||
|
|
||||||
|
if [[ -f "$STATE_FILE" && $(cat "$STATE_FILE") == "ra" ]]; then
|
||||||
|
crtTV240
|
||||||
|
echo "normal" > "$STATE_FILE"
|
||||||
|
else
|
||||||
|
crtTV240ra
|
||||||
|
echo "ra" > "$STATE_FILE"
|
||||||
|
fi
|
||||||
Executable
+15
@@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Toggle between crtTV240 and crtTV240ra each time this script is run
|
||||||
|
|
||||||
|
source ~/.profile 2>/dev/null || true
|
||||||
|
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
STATE_FILE="$SCRIPT_DIR/.crt_tv_toggle"
|
||||||
|
|
||||||
|
if [[ -f "$STATE_FILE" && $(cat "$STATE_FILE") == "ra" ]]; then
|
||||||
|
crtTV
|
||||||
|
echo "normal" > "$STATE_FILE"
|
||||||
|
else
|
||||||
|
crtTVscale
|
||||||
|
echo "ra" > "$STATE_FILE"
|
||||||
|
fi
|
||||||
Executable
+4
@@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
xrandr --newmode "1600x900_60p" 118.25 1600 1688 1856 2112 900 903 908 934 -hsync +vsync
|
||||||
|
xrandr --addmode DisplayPort-1 1600x900_60p
|
||||||
|
xrandr --output HDMI-A-0 --mode 1600x900_120i --primary --output DisplayPort-1 --mode 1600x900_60p --same-as HDMI-A-0
|
||||||
@@ -1,2 +1,2 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
xrandr --output DisplayPort-0 --off --output DisplayPort-1 --primary --mode 1920x1080 --pos 0x0 --rotate normal --output DisplayPort-2 --off --output HDMI-A-0 --off
|
xrandr --output DisplayPort-0 --off --output DisplayPort-1 --primary --mode 1920x1080 --scale-from 1920x1080 --pos 0x0 --rotate normal --output DisplayPort-2 --off --output HDMI-A-0 --off
|
||||||
|
|||||||
@@ -1,2 +1,5 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
xrandr --output DisplayPort-0 --off --output DisplayPort-1 --primary --mode 1280x720 --pos 0x0 --rotate normal --output DisplayPort-2 --off --output HDMI-A-0 --off
|
xrandr --newmode "1280x720_60.00" 74.50 1280 1344 1472 1664 720 723 728 748 -hsync +vsync
|
||||||
|
xrandr --addmode DisplayPort-1 "1280x720_60.00"
|
||||||
|
|
||||||
|
xrandr --output DisplayPort-0 --off --output DisplayPort-1 --primary --mode "1280x720_60.00" --pos 0x0 --rotate normal --output DisplayPort-2 --off --output HDMI-A-0 --off
|
||||||
|
|||||||
@@ -0,0 +1,103 @@
|
|||||||
|
shift + Escape
|
||||||
|
/home/lucka/sh/keymaps.sh
|
||||||
|
mod3 + {1,9,0}
|
||||||
|
smartplug.sh hs100-wega.mario off && addCRTModes.sh && xrandr --output HDMI-A-0 --mode {1280x960_120i,1600x900_120i,1600x1000_120i} --scale 1
|
||||||
|
# mm {1280x960@120i,wegaOnly,bedroomLCD1080p,bedroomLCD720p,3dsWega}
|
||||||
|
mod3 + shift + 1
|
||||||
|
smartplug.sh hs100-wega.mario off && addCRTModes.sh && xrandr --output HDMI-A-0 --mode 640x480_120p
|
||||||
|
mod3 + shift + 2
|
||||||
|
xrandr --output HDMI-A-0 --mode 640x480i --scale-from 1280x960 --filter bilinear; delCRTModes.sh && smartplug.sh hs100-wega.mario on
|
||||||
|
mod3 + shift + 9
|
||||||
|
smartplug.sh hs100-wega.mario off && addCRTModes.sh && ~/sh/screenlayout/mirror900p.sh
|
||||||
|
mod3 + 2
|
||||||
|
xrandr --output HDMI-A-0 --mode 640x480i --scale 1; delCRTModes.sh && smartplug.sh hs100-wega.mario on
|
||||||
|
mod3 + alt + 2
|
||||||
|
xrandr --output HDMI-A-0 --mode 640x240_119p --scale-from 320x240; delCRTModes.sh && smartplug.sh hs100-wega.mario on
|
||||||
|
mod3 + alt + shift + 2
|
||||||
|
xrandr --output HDMI-A-0 --mode 640x240_119p --scale-from 1280x960; delCRTModes.sh && smartplug.sh hs100-wega.mario on
|
||||||
|
mod3 + {3,4}
|
||||||
|
smartplug.sh hs100-wega.mario off && ~/.screenlayout/{3monitors.sh,tv720p.sh}
|
||||||
|
mod3 + shift + 3
|
||||||
|
~/.screenlayout/crtOnly.sh
|
||||||
|
mod3 + alt + 3
|
||||||
|
xrandr --output DisplayPort-2 --off
|
||||||
|
mod3 + shift + 4
|
||||||
|
smartplug.sh hs100-wega.mario off && ~/.screenlayout/tv1080p.sh
|
||||||
|
mod3 + 5
|
||||||
|
smartplug.sh hs100-bedroomCRT.mario on
|
||||||
|
mod3 + F5
|
||||||
|
smartplug.sh hs100-bedroomCRT2.mario on
|
||||||
|
mod3 + shift + F5
|
||||||
|
smartplug.sh hs100-bedroomCRT2.mario off
|
||||||
|
mod3 + shift + 5
|
||||||
|
smartplug.sh hs100-bedroomCRT.mario off
|
||||||
|
mod3 + 6
|
||||||
|
smartplug.sh hs103-bedroomLCD.mario on
|
||||||
|
mod3 + shift + 6
|
||||||
|
smartplug.sh hs103-bedroomLCD.mario off
|
||||||
|
mod3 + 7
|
||||||
|
~/sh/screenlayout/crt15khz240p.sh
|
||||||
|
mod3 + shift + 7
|
||||||
|
~/sh/screenlayout/crt15khz480i.sh
|
||||||
|
mod3 + {Left,Right}
|
||||||
|
curl -v -u lucka:h0gC3PMwSCXjJH8L "http://wattbox.mario/control.cgi?outlet=1&command={0,1}"
|
||||||
|
ctrl + shift + super + alt + {Left,Right}
|
||||||
|
curl -v -u lucka:h0gC3PMwSCXjJH8L "http://wattbox.mario/control.cgi?outlet=1&command={0,1}"
|
||||||
|
ctrl + shift + super + alt + {Up,Down}
|
||||||
|
bash -c 'comm={1,0}; curl -v -u lucka:h0gC3PMwSCXjJH8L "http://wattbox.mario/control.cgi?outlet=2&command=$comm" & curl -v -u lucka:h0gC3PMwSCXjJH8L "http://wattbox.mario/control.cgi?outlet=3&command=$comm"'
|
||||||
|
|
||||||
|
#{XF86AudioForward,XF86AudioRewind}
|
||||||
|
mod3 + Up
|
||||||
|
bash -c 'curl -v -u lucka:h0gC3PMwSCXjJH8L "http://wattbox.mario/control.cgi?outlet=2&command=1" & curl -v -u lucka:h0gC3PMwSCXjJH8L "http://wattbox.mario/control.cgi?outlet=3&command=1"'
|
||||||
|
mod3 + Down
|
||||||
|
bash -c 'curl -v -u lucka:h0gC3PMwSCXjJH8L "http://wattbox.mario/control.cgi?outlet=2&command=0" & curl -v -u lucka:h0gC3PMwSCXjJH8L "http://wattbox.mario/control.cgi?outlet=3&command=0"'
|
||||||
|
mod3 + shift + Left
|
||||||
|
~/sh/ha/light.sh bedroom off
|
||||||
|
mod3 + shift + Right
|
||||||
|
~/sh/ha/light.sh bedroom on
|
||||||
|
mod3 + shift + Up
|
||||||
|
~/sh/ha/light.sh bedroom 100
|
||||||
|
mod3 + shift + Down
|
||||||
|
~/sh/ha/light.sh bedroom 1
|
||||||
|
|
||||||
|
super + shift + {0-9}
|
||||||
|
cd /home/lucka/sh && python3 clipboardbuffers.py copy {0-9}
|
||||||
|
#{KP_Insert,KP_End,KP_Down,KP_Next,KP_Left,KP_Begin,KP_Right,KP_Home,KP_Up,KP_Prior}
|
||||||
|
# cd /home/lucka/sh && python3 clipboardbuffers.py edit {0-9}
|
||||||
|
#mod5 + {KP_Insert,KP_End,KP_Down,KP_Next,KP_Left,KP_Begin,KP_Right,KP_Home,KP_Up,KP_Prior}
|
||||||
|
# cd /home/lucka/sh && python3 clipboardbuffers.py paste {0-9}
|
||||||
|
alt + {comma,period,m,slash}
|
||||||
|
/home/lucka/sh/warpMouse.sh {1-4}
|
||||||
|
alt + shift + {comma,period,m,slash}
|
||||||
|
/home/lucka/sh/warpMouseAndWindow.sh {1-4}
|
||||||
|
Print
|
||||||
|
flameshot gui
|
||||||
|
alt + shift + w
|
||||||
|
librewolf -P
|
||||||
|
alt + w
|
||||||
|
librewolf -P Default
|
||||||
|
F10
|
||||||
|
/home/lucka/sh/keymaps.sh
|
||||||
|
alt + shift + Return
|
||||||
|
konsole
|
||||||
|
alt + F1
|
||||||
|
~/sh/typeclipboard.sh
|
||||||
|
mod3 + s
|
||||||
|
rofi -show rofi-sound -modi "rofi-sound:rofi-sound-output-chooser"
|
||||||
|
mod3 + shift + s
|
||||||
|
~/sh/hdmi-audio-selector.sh
|
||||||
|
mod3 + alt + s
|
||||||
|
~/sh/hdmi-audio-selector.sh
|
||||||
|
mod3 + a
|
||||||
|
pactl set-card-profile bluez_card.00_6A_8E_17_25_51 a2dp-sink
|
||||||
|
mod3 + d
|
||||||
|
# pactl set-card-profile bluez_card.00_6A_8E_17_25_51 headset-head-unit
|
||||||
|
~/sh/bt-disconnect.sh
|
||||||
|
mod3 + b
|
||||||
|
viewnior --fullscreen ~/black.jpg
|
||||||
|
mod3 + alt + b
|
||||||
|
pkill -f "viewnior --fullscreen /home/lucka/black.jpg"
|
||||||
|
super + f
|
||||||
|
xdotool search --class moonlight key --window %@ ctrl+alt+shift+x
|
||||||
|
mod3 + v
|
||||||
|
~/sh/vsyncToggle.sh
|
||||||
Executable
+13
@@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Toggle picom with --backend glx --vsync
|
||||||
|
|
||||||
|
if pgrep -x "picom" > /dev/null; then
|
||||||
|
# Picom is running → kill it
|
||||||
|
pkill -x picom
|
||||||
|
notify-send "Picom" "Compositor disabled" 2>/dev/null || true
|
||||||
|
else
|
||||||
|
# Picom is not running → start it
|
||||||
|
picom --backend glx --vsync &
|
||||||
|
notify-send "Picom" "Compositor enabled (GLX + VSync)" 2>/dev/null || true
|
||||||
|
fi
|
||||||
+2
-1
@@ -4,7 +4,8 @@ xdotool windowactivate $(xdotool getmouselocation|sed "s/.*://")
|
|||||||
}
|
}
|
||||||
case $1 in
|
case $1 in
|
||||||
1)
|
1)
|
||||||
xdotool mousemove 800 400
|
#xdotool mousemove 800 400 # top left of ultrawide display
|
||||||
|
xdotool mousemove 2080 2160 #15khz crt
|
||||||
focusWindowUnderMouse
|
focusWindowUnderMouse
|
||||||
;;
|
;;
|
||||||
2)
|
2)
|
||||||
|
|||||||
@@ -11,7 +11,8 @@ wmctrl -r :ACTIVE: -b remove,maximized_vert,maximized_horz
|
|||||||
moveWindowToMonitor () {
|
moveWindowToMonitor () {
|
||||||
if [ "$(xprop -id $(xdotool getmouselocation --shell | awk -F= '/WINDOW/{print $2}') WM_CLASS | awk -F\" '{print $4}')" != "plasmashell" ]; then
|
if [ "$(xprop -id $(xdotool getmouselocation --shell | awk -F= '/WINDOW/{print $2}') WM_CLASS | awk -F\" '{print $4}')" != "plasmashell" ]; then
|
||||||
unMaximizeWindow
|
unMaximizeWindow
|
||||||
xdotool getactivewindow windowsize 800 600
|
#xdotool getactivewindow windowsize 800 600
|
||||||
|
xdotool getactivewindow windowsize 200 100
|
||||||
xdotool mousemove $1 $2
|
xdotool mousemove $1 $2
|
||||||
xdotool getactivewindow windowmove $1 $2
|
xdotool getactivewindow windowmove $1 $2
|
||||||
maximizeWindow
|
maximizeWindow
|
||||||
@@ -20,7 +21,8 @@ fi
|
|||||||
|
|
||||||
case $1 in
|
case $1 in
|
||||||
1)
|
1)
|
||||||
moveWindowToMonitor 800 400
|
#moveWindowToMonitor 800 400 # top left of ultrawide display
|
||||||
|
moveWindowToMonitor 2080 2160 #15khz crt
|
||||||
;;
|
;;
|
||||||
2)
|
2)
|
||||||
moveWindowToMonitor 2650 500
|
moveWindowToMonitor 2650 500
|
||||||
|
|||||||
Reference in New Issue
Block a user