Skip to content

Commit

Permalink
Merge pull request #1465 from AuxXxilium/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
AuxXxilium authored May 11, 2024
2 parents 9ac6979 + ab40ee4 commit f90f4e0
Show file tree
Hide file tree
Showing 5 changed files with 117 additions and 9 deletions.
9 changes: 9 additions & 0 deletions fbsize/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
CFLAGS = -Wall -pedantic

all: fbsize

fbsize: main.o
cc -o $@ $^

clean:
rm -f fbsize *.o
Binary file added fbsize/fbsize
Binary file not shown.
99 changes: 99 additions & 0 deletions fbsize/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
/*
* Copyright (C) 2022 Ing <https://github.com/wjz304>
*
* This is free software, licensed under the MIT License.
* See /LICENSE for more information.
*
*/

#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <linux/fb.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <getopt.h>

#define VERSION "1.0"

int main(int argc, char *argv[])
{
int c;

while (1)
{
int option_index = 0;
static struct option long_options[] = {
{"resolution", required_argument, 0, 'r'},
{"buffer", required_argument, 0, 'b'},
{"offset", required_argument, 0, 'o'},
{"screen", required_argument, 0, 's'},
{"help", no_argument, 0, 'h'},
{0, 0, 0, 0}};

c = getopt_long(argc, argv, "r:b:o:s:h", long_options, &option_index);
if (c == -1)
break;

switch (c)
{
case 'r':
case 'b':
case 'o':
case 's':
int fbfd = 0;
struct fb_var_screeninfo var_info;

// 打开设备文件
fbfd = open(optarg, O_RDWR);
if (fbfd == -1)
{
perror("Error: cannot open framebuffer device");
return 1;
}

// 获取屏幕参数
if (ioctl(fbfd, FBIOGET_VSCREENINFO, &var_info) == -1)
{
perror("Error reading variable information");
return 1;
}

if (c == 'r')
{
printf("%dx%d\n", var_info.xres, var_info.yres);
}
else if (c == 'b')
{
printf("%dx%d\n", var_info.xres_virtual, var_info.yres_virtual);
}
else if (c == 'o')
{
printf("%dx%d\n", var_info.xoffset, var_info.yoffset);
}
else if (c == 's')
{
printf("%dx%d\n", var_info.height, var_info.width);
}

// 关闭设备文件
close(fbfd);
break;
case 'h':
case '?':
printf("Usage: %s [options] <framebuffer_device>\n", argv[0]);
printf("Version: %s\n", VERSION);
printf("Options:\n");
printf(" -r, --resolution Display the resolution of the screen\n");
printf(" -b, --buffer Display the resolution of the framebuffer\n");
printf(" -o, --offset Display the offset of the screen\n");
printf(" -s, --screen Display the size of the screen\n");
printf(" -h, --help Display this help message\n");
return 0;
default:
return 1;
}
}

return 0;
}
2 changes: 1 addition & 1 deletion files/initrd/opt/arc/arc-functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ function modulesMenu() {
[ $? -ne 0 ] && return
[ ! -d "${USER_UP_PATH}" ] && mkdir -p "${USER_UP_PATH}"
mv -f "${TMP_PATH}/modulelist.user" "${USER_UP_PATH}/modulelist"
dos2unix "${USER_UP_PATH}/modulelist"
dos2unix "${USER_UP_PATH}/modulelist" 2>/dev/null
break
done
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
Expand Down
16 changes: 8 additions & 8 deletions files/initrd/opt/arc/arc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ function arcVersion() {
done <<<$(getAllModules "${PLATFORM}" "${KVERP}")
[ ! -d "${USER_UP_PATH}" ] && mkdir -p "${USER_UP_PATH}"
mv -f "${TMP_PATH}/modulelist.user" "${USER_UP_PATH}/modulelist"
dos2unix "${USER_UP_PATH}/modulelist"
dos2unix "${USER_UP_PATH}/modulelist" 2>/dev/null
if [ "${CUSTOM}" = "false" ]; then
if [ "${ONLYVERSION}" != "true" ]; then
arcPatch
Expand Down Expand Up @@ -461,7 +461,6 @@ function arcSettings() {
if [ "${CUSTOM}" = "false" ]; then
dialog --backtitle "$(backtitle)" --colors --title "DSM Addons" \
--infobox "Loading Addons Table..." 3 30
sleep 2
# Add Arc Addons
writeConfigKey "addons.cpuinfo" "" "${USER_CONFIG_FILE}"
# Select Addons
Expand Down Expand Up @@ -617,6 +616,7 @@ function make() {
--infobox "Reading Models..." 3 20
# Read Model Config
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
MODELID="$(readConfigKey "modelid" "${USER_CONFIG_FILE}")"
PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")"
PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")"
DT="$(readConfigKey "platforms.${PLATFORM}.dt" "${P_FILE}")"
Expand All @@ -640,8 +640,8 @@ function make() {
--infobox "Get PAT Data from Syno..." 3 30
idx=0
while [ ${idx} -le 5 ]; do # Loop 5 times, if successful, break
PAT_URL="$(curl -m 5 -skL "https://www.synology.com/api/support/findDownloadInfo?lang=en-us&product=${MODEL/+/%2B}&major=${PRODUCTVER%%.*}&minor=${PRODUCTVER##*.}" | jq -r '.info.system.detail[0].items[0].files[0].url')"
PAT_HASH="$(curl -m 5 -skL "https://www.synology.com/api/support/findDownloadInfo?lang=en-us&product=${MODEL/+/%2B}&major=${PRODUCTVER%%.*}&minor=${PRODUCTVER##*.}" | jq -r '.info.system.detail[0].items[0].files[0].checksum')"
PAT_URL="$(curl -m 5 -skL "https://www.synology.com/api/support/findDownloadInfo?lang=en-us&product=${MODELID/+/%2B}&major=${PRODUCTVER%%.*}&minor=${PRODUCTVER##*.}" | jq -r '.info.system.detail[0].items[0].files[0].url')"
PAT_HASH="$(curl -m 5 -skL "https://www.synology.com/api/support/findDownloadInfo?lang=en-us&product=${MODELID/+/%2B}&major=${PRODUCTVER%%.*}&minor=${PRODUCTVER##*.}" | jq -r '.info.system.detail[0].items[0].files[0].checksum')"
PAT_URL=${PAT_URL%%\?*}
if [[ -n "${PAT_URL}" && -n "${PAT_HASH}" ]]; then
break
Expand All @@ -654,8 +654,8 @@ function make() {
--infobox "Syno Connection failed,\ntry to get from Github..." 4 30
idx=0
while [ ${idx} -le 3 ]; do # Loop 3 times, if successful, break
PAT_URL="$(curl -m 5 -skL "https://raw.githubusercontent.com/AuxXxilium/arc-dsm/main/dsm/${MODEL/+/%2B}/${PRODUCTVER%%.*}.${PRODUCTVER##*.}/pat_url")"
PAT_HASH="$(curl -m 5 -skL "https://raw.githubusercontent.com/AuxXxilium/arc-dsm/main/dsm/${MODEL/+/%2B}/${PRODUCTVER%%.*}.${PRODUCTVER##*.}/pat_hash")"
PAT_URL="$(curl -m 5 -skL "https://raw.githubusercontent.com/AuxXxilium/arc-dsm/main/dsm/${MODELID/+/%2B}/${PRODUCTVER%%.*}.${PRODUCTVER##*.}/pat_url")"
PAT_HASH="$(curl -m 5 -skL "https://raw.githubusercontent.com/AuxXxilium/arc-dsm/main/dsm/${MODELID/+/%2B}/${PRODUCTVER%%.*}.${PRODUCTVER##*.}/pat_hash")"
PAT_URL=${PAT_URL%%\?*}
if [[ -n "${PAT_URL}" && -n "${PAT_HASH}" ]]; then
break
Expand Down Expand Up @@ -702,7 +702,7 @@ function make() {
# Check for existing Files
DSM_FILE="${UNTAR_PAT_PATH}/${PAT_HASH}.tar"
# Get new Files
DSM_URL="https://raw.githubusercontent.com/AuxXxilium/arc-dsm/main/files/${MODEL/+/%2B}/${PRODUCTVER}/${PAT_HASH}.tar"
DSM_URL="https://raw.githubusercontent.com/AuxXxilium/arc-dsm/main/files/${MODELID/+/%2B}/${PRODUCTVER}/${PAT_HASH}.tar"
STATUS=$(curl --insecure -s -w "%{http_code}" -L "${DSM_URL}" -o "${DSM_FILE}")
if [[ $? -ne 0 || ${STATUS} -ne 200 ]]; then
dialog --backtitle "$(backtitle)" --title "DSM Download" --aspect 18 \
Expand Down Expand Up @@ -1053,7 +1053,7 @@ else
echo "F \"\Z1Format Sata/NVMe Disk\Zn \" " >>"${TMP_PATH}/menu"
echo "G \"Install opkg Package Manager \" " >>"${TMP_PATH}/menu"
fi
echo "= \"\Z4====== Misc Settings =====\Zn \" " >>"${TMP_PATH}/menu"
echo "= \"\Z4========== Misc ==========\Zn \" " >>"${TMP_PATH}/menu"
echo "x \"Backup/Restore/Recovery \" " >>"${TMP_PATH}/menu"
echo "9 \"Offline Mode: \Z4${OFFLINE}\Zn \" " >>"${TMP_PATH}/menu"
echo "y \"Choose a Keymap \" " >>"${TMP_PATH}/menu"
Expand Down

0 comments on commit f90f4e0

Please sign in to comment.