pax_global_header00006660000000000000000000000064152261144750014521gustar00rootroot0000000000000052 comment=f3b142bd5fa4c0df4d8dd2001c42b51a97edde99 C0rn3j-sc-controller-f3b142b/000077500000000000000000000000001522611447500157515ustar00rootroot00000000000000C0rn3j-sc-controller-f3b142b/.dockerignore000066400000000000000000000001301522611447500204170ustar00rootroot00000000000000# In case we were about to copy dist files from existing local builds, remove them dist C0rn3j-sc-controller-f3b142b/.github/000077500000000000000000000000001522611447500173115ustar00rootroot00000000000000C0rn3j-sc-controller-f3b142b/.github/dependabot.yml000066400000000000000000000001661522611447500221440ustar00rootroot00000000000000version: 2 updates: - package-ecosystem: "github-actions" directory: "/" schedule: interval: "weekly" C0rn3j-sc-controller-f3b142b/.github/workflows/000077500000000000000000000000001522611447500213465ustar00rootroot00000000000000C0rn3j-sc-controller-f3b142b/.github/workflows/appimage.yml000066400000000000000000000126531522611447500236630ustar00rootroot00000000000000name: Build and publish AppImages on: release: types: [published] workflow_dispatch: jobs: build: runs-on: ubuntu-latest strategy: matrix: target: - platform: linux/amd64 arch: amd64 - platform: linux/arm64 arch: arm64 base: - os: ubuntu codename: noble pubkey: 871920D1991BC93C recipe: AppImageBuilder.yml - os: ubuntu codename: resolute pubkey: 871920D1991BC93C recipe: AppImageBuilder.yml - os: debian codename: bookworm pubkey: 54404762BBB6E853 pubkey_security: 6ED0E7B82643E131 recipe: AppImageBuilder.debian.yml - os: debian codename: trixie pubkey: BDE6D2B9216EC7A8 pubkey_security: 8E9F831205B4BA95 pubkey_updates: 78DBA3BC47EF2265 recipe: AppImageBuilder.debian.yml steps: - uses: actions/checkout@v7 with: fetch-depth: 0 - uses: rlespinasse/github-slug-action@v5 - name: Setup qemu for docker uses: docker/setup-qemu-action@v4 if: matrix.target.platform != 'linux/amd64' - name: Setup buildx for docker uses: docker/setup-buildx-action@v4 - name: Compile in docker uses: docker/build-push-action@v7 with: context: . platforms: ${{ matrix.target.platform }} outputs: build build-args: | BASE_OS=${{ matrix.base.os }} BASE_CODENAME=${{ matrix.base.codename }} - name: Prepare environment to build AppImage env: TARGET_PLATFORM: ${{ matrix.target.platform }} shell: bash run: | set -eua if [ -r build/.build-metadata.env ]; then . build/.build-metadata.env rm build/.build-metadata.env fi APPIMAGE_SOURCE=build APPIMAGE_VERSION="${VERSION}-${{ matrix.base.codename }}" APPIMAGE_APT_ARCH="${TARGETARCH}" APPIMAGE_APT_DISTRO="${{ matrix.base.codename }}" APPIMAGE_APT_PUBKEY="${{ matrix.base.pubkey }}" APPIMAGE_APT_PUBKEY_UPDATES="${{ matrix.base.pubkey_updates }}" APPIMAGE_APT_PUBKEY_SECURITY="${{ matrix.base.pubkey_security }}" APPIMAGE_ARCH="${TARGETMACHINE}" printenv | grep ^APPIMAGE_ >>"${GITHUB_ENV}" - name: Build AppImage uses: C0rn3j/build-appimage@v1.3 with: command: ${{ format('sh -c "set -eu; {0}; {1}; {2}; appimage-builder --recipe {3}"', 'pip install --upgrade setuptools packaging packaging-legacy', 'pip install --extra-index-url https://lief.s3-website.fr-par.scw.cloud/latest \"lief>=0.16.0.dev0\"', 'find /usr/local/lib -name package.py | while read -r file; do sed -i -e \"s/^from.packaging/&_legacy/\" \"${file}\"; done', matrix.base.recipe) }} - name: Upload artifacts uses: actions/upload-artifact@v7 with: name: appimage-${{ matrix.base.codename }}-${{ matrix.target.arch }} path: | ./*.AppImage ./*.AppImage.zsync if-no-files-found: error test: runs-on: ${{ matrix.target.os }} needs: - build strategy: fail-fast: false matrix: target: - platform: linux/amd64 arch: amd64 os: ubuntu-latest # arm64 AppImages created by appimage-builder <= v1.1.0 are broken # and fail with `APPRUN_ERROR: No such file or directory` on amd64 # due to https://github.com/AppImageCrafters/appimage-builder/issues/272 # # This comment can be removed when a fixed appimage-builder release is available. #- platform: linux/arm64 # arch: arm64 # os: ubuntu-24.04-arm base: - os: ubuntu codename: noble - os: ubuntu codename: resolute - os: debian codename: bookworm - os: debian codename: trixie - os: fedora codename: "43" - os: fedora codename: "44" steps: - name: Checkout uses: actions/checkout@v7 - name: Download artifacts uses: actions/download-artifact@v8 with: pattern: appimage-*-${{ matrix.target.arch }} path: appimages merge-multiple: true - name: Setup buildx for docker uses: docker/setup-buildx-action@v4 - name: Test AppImages uses: docker/build-push-action@v7 with: file: AppImageBuilder.test.Dockerfile context: appimages platforms: ${{ matrix.target.platform }} build-args: | BASE_OS=${{ matrix.base.os }} BASE_CODENAME=${{ matrix.base.codename }} release: runs-on: ubuntu-latest needs: - build - test permissions: contents: write steps: - name: Download artifacts uses: actions/download-artifact@v8 with: pattern: appimage-* path: assets merge-multiple: true - name: Upload artifacts to GitHub release uses: softprops/action-gh-release@v3 with: draft: ${{ !startsWith(github.ref, 'refs/tags/') }} files: assets/* C0rn3j-sc-controller-f3b142b/.github/workflows/scc-linux.yml000066400000000000000000000012231522611447500237740ustar00rootroot00000000000000name: SCC Linux CI on: push: branches: - main - master - python3 pull_request: branches: - main - master - python3 workflow_dispatch: jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 - uses: actions/setup-python@v6 with: python-version: '3.14' - name: Install dependencies run: pip install build evdev setuptools ioctl-opt libusb1 vdf pytest - name: Build SCC run: python -m build - name: Install SCC run: python -m pip install dist/*.whl - name: Run tests run: python -m pytest tests C0rn3j-sc-controller-f3b142b/.gitignore000066400000000000000000000003251522611447500177410ustar00rootroot00000000000000*.pyc .* *~ *.so *.patch !scc/*tester* test.* test[0-9].* build/ build-output/ venv/ .atomignore commit* profiles .idea/ out.svg *.AppImage appimage/ *.cpp *.vdf .kateconfig dist/ sccontroller.egg-info/ !.github C0rn3j-sc-controller-f3b142b/ADDITIONAL-LICENSES000066400000000000000000000013661522611447500205150ustar00rootroot00000000000000All images in images/ directory, profile files in default_profiles/ and profile_examples/ and menu files in default_menus/ directories are licensed under the CC0 license - https://creativecommons.org/publicdomain/zero/1.0/ Images in images/menu-icons subdirectories are licensed as described in the 'LICENSES' files in their respective subdirectories. lib/jsonencoder.py is licensed under the PSFL, https://www.python.org/download/releases/2.7/license/ scripts/gamecontrollerdb.txt is taken from the Simple DirectMedia Layer library and licensed under the zlib license. lib/xwrappers.py and lib/vdf.py are part of SC Controller, licensed under GPL2 like the rest of the project. Everything else is licensed under GPL2, as described in the 'LICENSE' file. C0rn3j-sc-controller-f3b142b/AppImageBuilder.debian.yml000066400000000000000000000205221522611447500227100ustar00rootroot00000000000000version: 1 script: - | set -eu if [ "{{APPIMAGE_SOURCE}}" != "${TARGET_APPDIR}" ]; then mv "{{APPIMAGE_SOURCE}}" "${TARGET_APPDIR}" fi # Manual installation of squashfs-tools is required # until https://github.com/AppImageCrafters/build-appimage/issues/5 is fixed if ! command -v mksquashfs >/dev/null; then apt-get update && apt-get install -y --no-install-recommends squashfs-tools fi AppDir: app_info: id: org.c0rn3j.sc-controller name: sc-controller version: "{{APPIMAGE_VERSION}}" icon: sc-controller exec: usr/bin/python3 exec_args: -c "import os, sys; os.execvp('$APPDIR/usr/bin/scc', ['$APPDIR/usr/bin/scc'] + (sys.argv[1:] if len(sys.argv) > 1 else ['gui']))" $@ after_bundle: | set -eu # install python3-ioctl-opt manually as it is not packaged anywhere pip install --target "${TARGET_APPDIR}/usr/lib/python3/dist-packages/" ioctl-opt # appimage-builder expects .desktop file to start with appinfo-id desktop="$(find "${TARGET_APPDIR}/usr" -name sc-controller.desktop)" sed -i "s:Exec=.*:Exec=./usr/bin/scc gui:g" "${desktop}" ln -sr "${desktop}" "${TARGET_APPDIR}/usr/share/applications/org.c0rn3j.sc-controller.desktop" # appimage-builder expects utf-8 encoding when patching shebangs, # but pygettext3 has iso-8859-1 encoding find "${TARGET_APPDIR}/usr/bin" -name 'pygettext*' | while read -r file; do encoding="ISO-8859-1" if file -bi "${file}" | grep -iq "${encoding}"; then <"${file}" iconv -f "${encoding}" -t utf-8 -o "${file}" sed -i -E '1,2 s|^(\s*#.*coding[=:]\s*)([[:alnum:].-]+)|\1utf-8|g' "${file}" fi done # remove unused icons icons="${TARGET_APPDIR}/usr/share/icons" keep=$( # Subset of: `wget -q https://specifications.freedesktop.org/icon-naming-spec/latest -O- | sed -nE 's:.*([^<]+).*:\1:p' | sort` printf '%s\n' index.theme close- edit- go- list- pan- window- grep -rhoP '"icon_name">\K[^<]+(?=<)' glade grep -rhoP 'icon_name *= *"\K[^"]+(?=")' scc ) map_item() { echo "${1}" | while read -r item; do printf -- "${2}" "${item}"; done; } paths=$(find "${icons}" '(' -false $(map_item "${keep}" ' -o -name %s*') ')' -print -type l -printf '%h/%l\n' | sort | uniq) find "${icons}" \( -type d -empty -or -not -type d $(map_item "${paths}" ' -not -samefile %s') \) -delete cancel() { echo >&2 "ERROR: ${@}" && return 1; } if find "${icons}" -xtype l | grep .; then cancel 'The symlinks shown above are broken.' fi if echo "${keep}" | while read -r icon; do echo "${paths}" | grep -q "${icon}[^/]*$" || echo "${icon}"; done | grep .; then cancel 'The icons above are missing.' fi # Enable icon theme xdg_settings="${TARGET_APPDIR}/etc/xdg/gtk-3.0/settings.ini" if [ ! -e "${xdg_settings}" ]; then mkdir -p "$(dirname "${xdg_settings}")" theme=$(find "${icons}" -mindepth 1 -maxdepth 1 -type d -printf %f -quit) printf '[Settings]\ngtk-icon-theme-name = %s\n' "${theme}" >"${xdg_settings}" fi # python3-usb1 expects 'libusb-1.0.so', see https://github.com/vpelletier/python-libusb1/issues/78 find "${TARGET_APPDIR}" -name 'libusb-1.0.so.[0-9]' | while read -r file; do path="$(dirname "${file}")" link="${file%.[0-9]}" [ -e "${link}" ] || ln -sr "${file}" "${link}" done # Trixie expects libpixbufloader libs with a dash suffix, not underscore # see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1082676 find "${TARGET_APPDIR}" -type f -name 'libpixbufloader_*' | while read -r file; do path="$(dirname "${file}")" link="${path}/$(echo "$(basename "${file}")" | tr _ -)" [ -e "${link}" ] || ln -sr "${file}" "${link}" done after_runtime: | set -eu # python3 is linked against 'lib64/ld-linux-x86-64.so.2' but 'compat/lib64' is missing compat="${TARGET_APPDIR}/runtime/compat" if [ ! -e "${compat}/lib64" ] && [ -d "${compat}/usr/lib64" ]; then ln -s "usr/lib64" "${compat}/" fi apt: arch: - "{{APPIMAGE_APT_ARCH}}" sources: - sourceline: deb http://deb.debian.org/debian {{APPIMAGE_APT_DISTRO}} main key_url: http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x{{APPIMAGE_APT_PUBKEY}} - sourceline: deb http://deb.debian.org/debian {{APPIMAGE_APT_DISTRO}}-updates main key_url: http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x{{APPIMAGE_APT_PUBKEY_UPDATES}} - sourceline: deb http://deb.debian.org/debian-security/ {{APPIMAGE_APT_DISTRO}}-security main key_url: http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x{{APPIMAGE_APT_PUBKEY_SECURITY}} include: - gir1.2-gtk-3.0 - gir1.2-rsvg-2.0 - libbluetooth3 - libgtk-3-0 - libgtk-layer-shell-dev - gir1.2-gtklayershell-0.1 - gir1.2-ayatanaappindicator3-0.1 - libdbusmenu-glib4 - libdbusmenu-gtk3-4 - librsvg2-common - libwayland-client0 - libwayland-cursor0 - libwayland-egl1 - python-is-python3 - python3-evdev - python3-gi-cairo - python3-pylibacl - python3-usb1 - python3-vdf - binutils # required for detection of bluetooth library - coreutils # provides /usr/bin/env - paper-icon-theme # required for icons - shared-mime-info # required for gui if host provides no MIME info, e.g. when XDG_DATA_DIRS is missing exclude: # coreutils - libgmp* # arithmetics # gir1.2-rsvg-2.0 # NOTE: libicu* and libxml* are intentionally NOT excluded. The bundled # librsvg needs libxml2 (which pulls in icu), and minimal hosts such as # SteamOS do not provide them, so excluding them gives a fatal # "libxml2.so.2: cannot open shared object file" at GUI startup. Bundling # them matches what the older appimage-build.sh shipped. - libstdc* # development # libgtk3-0 - "*-icon-theme" # gui - "*crypt*" # security - "*dconf*" # gui configuration - "libdbus-1*" # process communication (keep libdbusmenu for the tray icon) - "*gcc*" # development - "*systemd*" # linux core - libblk* # filesystem - libcolord* # gui - libcups* # printing - libepoxy* # gui - libfontconfig* # fonts - libfreetype* # fonts - libfribidi* # i18n - libgtk-3-common # gui - liblz* # codec - libtiff* # codec - libwebp* # codec # python3 - "*krb*" # security - "*readline*" # terminal - "*sqlite*" # database - libbz* # codec - libdb* # database - libmpdec* # arithmetics - libncurses* # terminal - libnsl* # network - libssl* # security - libtirpc* # development - libuuid* # development - media-types # codec # Debian Trixie - libgprofng* # development - libjansson* # codec - libsframe* # development - netbase # network - tzdata # date/time files: exclude: - usr/bin/*gold* # alternative for ld - usr/bin/*gp-display-html* # requires perl - usr/lib/*/gconv # unicode - usr/lib/*/gdk-pixbuf-2.0/*/loaders/libpixbufloader-??[!g]*.so # only png & svg are required - usr/lib/*/glib-2.0 - usr/lib/python*/cgi.py - usr/lib/python*/test - usr/lib/python*/unittest - usr/share/doc - usr/share/glib-2.0 - usr/share/gtk-doc - usr/share/icu - usr/share/locale - usr/share/man - usr/share/python3/runtime.d - usr/share/thumbnailers runtime: env: # `usr/lib/python3.*/site-packages` is required in $PYTHONPATH, # but the python version and hence the actual location is unknown here. # Fortunately the site-packages directory is on the $PATH, so we add $PATH instead. # It must precede an existing $PYTHONPATH to work. PYTHONPATH: "${APPDIR}/usr/lib/python3/dist-packages:${PATH}:${PYTHONPATH}" SCC_SHARED: "${APPDIR}/usr/share/scc" AppImage: arch: "{{APPIMAGE_ARCH}}" update-information: "gh-releases-zsync|C0rn3j|sc-controller|latest|sc-controller-*-{{APPIMAGE_APT_DISTRO}}-{{APPIMAGE_ARCH}}.AppImage.zsync" C0rn3j-sc-controller-f3b142b/AppImageBuilder.test.Dockerfile000066400000000000000000000022241522611447500237120ustar00rootroot00000000000000# syntax=docker/dockerfile:1 ARG BASE_OS=ubuntu ARG BASE_CODENAME=noble FROM $BASE_OS:$BASE_CODENAME WORKDIR /tmp COPY *.AppImage /opt/ RUN <&2 "${@}" } cancel() { log "${@}" return 1 } prepare() { if command -v apt-get >/dev/null; then apt-get update && apt-get install -y --no-install-recommends libx11-6 elif command -v pacman >/dev/null; then pacman -Syu --noconfirm libx11 elif command -v dnf >/dev/null; then dnf install -y libX11 fi } main() { files="$(find /opt/ -maxdepth 1 -type f -name '*.AppImage')" if [ -z "${files}" ]; then cancel "Error: No AppImage file found." fi prepare config_path="${HOME}/.config/scc" mkdir -p "${config_path}" echo '{}' >"${config_path}/config.json" echo "${files}" | while read -r file; do log "Testing ${file}" chmod +x "${file}" rm -rf squashfs-root/ "${file}" --appimage-extract >/dev/null ( cd squashfs-root/runtime/compat ../../AppRun dependency-check ../../AppRun daemon --help ) rm -f "${file}" done } main "${@}" EOR C0rn3j-sc-controller-f3b142b/AppImageBuilder.yml000066400000000000000000000202451522611447500214710ustar00rootroot00000000000000version: 1 script: - | set -eu if [ "{{APPIMAGE_SOURCE}}" != "${TARGET_APPDIR}" ]; then mv "{{APPIMAGE_SOURCE}}" "${TARGET_APPDIR}" fi # Manual installation of squashfs-tools is required # until https://github.com/AppImageCrafters/build-appimage/issues/5 is fixed if ! command -v mksquashfs >/dev/null; then apt-get update && apt-get install -y --no-install-recommends squashfs-tools fi AppDir: app_info: id: org.c0rn3j.sc-controller name: sc-controller version: "{{APPIMAGE_VERSION}}" icon: sc-controller exec: usr/bin/python3 exec_args: -c "import os, sys; os.execvp('$APPDIR/usr/bin/scc', ['$APPDIR/usr/bin/scc'] + (sys.argv[1:] if len(sys.argv) > 1 else ['gui']))" $@ after_bundle: | set -eu # install python3-ioctl-opt manually as it is not packaged anywhere pip install --target "${TARGET_APPDIR}/usr/lib/python3/dist-packages/" ioctl-opt # appimage-builder expects .desktop file to start with appinfo-id desktop="$(find "${TARGET_APPDIR}/usr" -name sc-controller.desktop)" sed -i "s:Exec=.*:Exec=./usr/bin/scc gui:g" "${desktop}" ln -sr "${desktop}" "${TARGET_APPDIR}/usr/share/applications/org.c0rn3j.sc-controller.desktop" # appimage-builder expects utf-8 encoding when patching shebangs, # but pygettext3 has iso-8859-1 encoding find "${TARGET_APPDIR}/usr/bin" -name 'pygettext*' | while read -r file; do encoding="ISO-8859-1" if file -bi "${file}" | grep -iq "${encoding}"; then <"${file}" iconv -f "${encoding}" -t utf-8 -o "${file}" sed -i -E '1,2 s|^(\s*#.*coding[=:]\s*)([[:alnum:].-]+)|\1utf-8|g' "${file}" fi done # remove unused icons icons="${TARGET_APPDIR}/usr/share/icons" keep=$( # Subset of: `wget -q https://specifications.freedesktop.org/icon-naming-spec/latest -O- | sed -nE 's:.*([^<]+).*:\1:p' | sort` printf '%s\n' index.theme close- edit- go- list- pan- window- grep -rhoP '"icon_name">\K[^<]+(?=<)' glade grep -rhoP 'icon_name *= *"\K[^"]+(?=")' scc ) map_item() { echo "${1}" | while read -r item; do printf -- "${2}" "${item}"; done; } paths=$(find "${icons}" '(' -false $(map_item "${keep}" ' -o -name %s*') ')' -print -type l -printf '%h/%l\n' | sort | uniq) find "${icons}" \( -type d -empty -or -not -type d $(map_item "${paths}" ' -not -samefile %s') \) -delete cancel() { echo >&2 "ERROR: ${@}" && return 1; } if find "${icons}" -xtype l | grep .; then cancel 'The symlinks shown above are broken.' fi if echo "${keep}" | while read -r icon; do echo "${paths}" | grep -q "${icon}[^/]*$" || echo "${icon}"; done | grep .; then cancel 'The icons above are missing.' fi # Enable icon theme xdg_settings="${TARGET_APPDIR}/etc/xdg/gtk-3.0/settings.ini" if [ ! -e "${xdg_settings}" ]; then mkdir -p "$(dirname "${xdg_settings}")" theme=$(find "${icons}" -mindepth 1 -maxdepth 1 -type d -printf %f -quit) printf '[Settings]\ngtk-icon-theme-name = %s\n' "${theme}" >"${xdg_settings}" fi # python3-usb1 expects 'libusb-1.0.so', see https://github.com/vpelletier/python-libusb1/issues/78 find "${TARGET_APPDIR}" -name 'libusb-1.0.so.[0-9]' | while read -r file; do path="$(dirname "${file}")" link="${file%.[0-9]}" [ -e "${link}" ] || ln -sr "${file}" "${link}" done after_runtime: | set -eu # python3 is linked against 'lib64/ld-linux-x86-64.so.2' but 'compat/lib64' is missing compat="${TARGET_APPDIR}/runtime/compat" if [ ! -e "${compat}/lib64" ] && [ -d "${compat}/usr/lib64" ]; then ln -s "usr/lib64" "${compat}/" fi apt: arch: - "{{APPIMAGE_APT_ARCH}}" sources: - sourceline: deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ {{APPIMAGE_APT_DISTRO}} main universe key_url: http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x{{APPIMAGE_APT_PUBKEY}} - sourceline: deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ {{APPIMAGE_APT_DISTRO}}-updates main universe - sourceline: deb [arch=amd64] http://security.ubuntu.com/ubuntu/ {{APPIMAGE_APT_DISTRO}}-security main universe - sourceline: deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ {{APPIMAGE_APT_DISTRO}} main universe - sourceline: deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ {{APPIMAGE_APT_DISTRO}}-updates main universe - sourceline: deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ {{APPIMAGE_APT_DISTRO}}-security main universe include: - gir1.2-gtk-3.0 - gir1.2-rsvg-2.0 - libbluetooth3 - libgtk-3-0 - libgtk-layer-shell-dev - gir1.2-gtklayershell-0.1 - gir1.2-ayatanaappindicator3-0.1 - libdbusmenu-glib4 - libdbusmenu-gtk3-4 - librsvg2-common - libwayland-client0 - libwayland-cursor0 - libwayland-egl1 - python-is-python3 - python3-evdev - python3-gi-cairo - python3-pylibacl - python3-usb1 - python3-vdf - binutils # required for detection of bluetooth library - coreutils # provides /usr/bin/env - paper-icon-theme # required for icons - shared-mime-info # required for gui if host provides no MIME info, e.g. when XDG_DATA_DIRS is missing exclude: # coreutils - libgmp* # arithmetics # gir1.2-rsvg-2.0 # NOTE: libicu* and libxml* are intentionally NOT excluded. The bundled # librsvg needs libxml2 (which pulls in icu), and minimal hosts such as # SteamOS do not provide them, so excluding them gives a fatal # "libxml2.so.2: cannot open shared object file" at GUI startup. Bundling # them matches what the older appimage-build.sh shipped. - libstdc* # development # libgtk3-0 - "*-icon-theme" # gui - "*crypt*" # security - "*dconf*" # gui configuration - "libdbus-1*" # process communication (keep libdbusmenu for the tray icon) - "*gcc*" # development - "*systemd*" # linux core - libblk* # filesystem - libcolord* # gui - libcups* # printing - libepoxy* # gui - libfontconfig* # fonts - libfreetype* # fonts - libfribidi* # i18n - libgtk-3-common # gui - liblz* # codec - libtiff* # codec - libwebp* # codec # python3 - "*krb*" # security - "*readline*" # terminal - "*sqlite*" # database - libbz* # codec - libdb* # database - libmpdec* # arithmetics - libncurses* # terminal - libnsl* # network - libssl* # security - libtirpc* # development - libuuid* # development - media-types # codec # Ubuntu Noble - libgprofng* # development - libjansson* # codec - libsframe* # development - netbase # network - tzdata # date/time files: exclude: - usr/bin/*gold* # alternative for ld - usr/bin/*gp-display-html* # requires perl - usr/lib/*/gconv # unicode - usr/lib/*/gdk-pixbuf-2.0/*/loaders/libpixbufloader-??[!g]*.so # only png & svg are required - usr/lib/*/glib-2.0 - usr/lib/python*/cgi.py - usr/lib/python*/test - usr/lib/python*/unittest - usr/share/doc - usr/share/glib-2.0 - usr/share/gtk-doc - usr/share/icu - usr/share/locale - usr/share/man - usr/share/python3/runtime.d - usr/share/thumbnailers runtime: env: # `usr/lib/python3.*/site-packages` is required in $PYTHONPATH, # but the python version and hence the actual location is unknown here. # Fortunately the site-packages directory is on the $PATH, so we add $PATH instead. # It must precede an existing $PYTHONPATH to work. PYTHONPATH: "${APPDIR}/usr/lib/python3/dist-packages:${PATH}:${PYTHONPATH}" SCC_SHARED: "${APPDIR}/usr/share/scc" AppImage: arch: "{{APPIMAGE_ARCH}}" update-information: "gh-releases-zsync|C0rn3j|sc-controller|latest|sc-controller-*-{{APPIMAGE_APT_DISTRO}}-{{APPIMAGE_ARCH}}.AppImage.zsync" C0rn3j-sc-controller-f3b142b/Dockerfile000066400000000000000000000051511522611447500177450ustar00rootroot00000000000000# syntax=docker/dockerfile:1 ARG BASE_OS=ubuntu ARG BASE_CODENAME=noble FROM $BASE_OS:$BASE_CODENAME AS build-stage # Download build dependencies RUN <>/build/.build-metadata.env # Keep only files required for runtime FROM scratch AS export-stage COPY --from=build-stage /build / C0rn3j-sc-controller-f3b142b/LICENSE000066400000000000000000000355621522611447500167710ustar00rootroot00000000000000GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS C0rn3j-sc-controller-f3b142b/README.md000066400000000000000000000130421522611447500172300ustar00rootroot00000000000000# SC Controller [![SCC Linux CI](https://github.com/C0rn3j/sc-controller/actions/workflows/scc-linux.yml/badge.svg?branch=python3)](https://github.com/C0rn3j/sc-controller/actions/workflows/scc-linux.yml) [![Build and publish AppImages](https://github.com/C0rn3j/sc-controller/actions/workflows/appimage.yml/badge.svg?event=release)](https://github.com/C0rn3j/sc-controller/actions/workflows/appimage.yml) User-mode driver, mapper and GTK3 based GUI for Steam Controller, DS4 and many other controllers. [![screenshot1](docs/screenshot1-tn.png?raw=true)](docs/screenshot1.png?raw=true) [![screenshot2](docs/screenshot2-tn.png?raw=true)](docs/screenshot2.png?raw=true) [![screenshot3](docs/screenshot3-tn.png?raw=true)](docs/screenshot3.png?raw=true) [![screenshot3](docs/screenshot4-tn.png?raw=true)](docs/screenshot4.png?raw=true) ## Features - Allows to setup, configure and use the Steam Controller without ever launching Steam - Connect multiple controllers at the same time - Supports profiles switchable in GUI or with controller button - Stick, Pads and Gyroscope input - Haptic Feedback and in-game Rumble support - OSD, Menus, On-Screen Keyboard for desktop *and* in games. - Automatic profile switching based on active window. - Macros, button cycling, rapid fire, modeshift, mouse regions, … - Emulates Xbox360 controller, mouse, trackball and keyboard. Based on [Standalone Steam Controller Driver](https://github.com/ynsta/steamcontroller) by [Ynsta](https://github.com/ynsta). ## Like what I'm doing? You can check out the ways to donate on [my website](https://rys.rs/donate), or just go straight to my [Ko-Fi](https://ko-fi.com/martinrys). Donation links for kozec, who is the original developer, can be found on the [old upstream repository](https://github.com/kozec/sc-controller?tab=readme-ov-file#like-what-im-doing). ## Packages [![Packaging status](https://repology.org/badge/vertical-allrepos/sc-controller.svg?exclude_unsupported=1)](https://repology.org/project/sc-controller/versions) Linux: - **Arch Linux:** Found in official [extra](https://archlinux.org/packages/extra/x86_64/sc-controller/) repository and [AUR/sc-controller-git](https://aur.archlinux.org/packages/sc-controller-git/) - **Ubuntu (24.04-noble, 26.04-resolute):** Packaged as AppImage in [GitHub releases](https://github.com/C0rn3j/sc-controller/releases), ***which may also run fine on other operating systems - noble image is currently the most compatible one*** - **Gentoo:** Packaged as [game-util/sc-controller](https://packages.gentoo.org/packages/games-util/sc-controller) - **Void Linux:** Packaged as [sc-controller](https://github.com/void-linux/void-packages/blob/master/srcpkgs/sc-controller/template) - Run `xbps-install -S sc-controller` in a terminal, points to archived Ryochan7's fork at the time of writing - **Others:** You can attempt to use one of the AppImages (try all, AppImages built on older distributions tend to work better), or a package meant for your parent distribution if applicable. Flatpak is planned. Windows: - It should be possible to get it running as per the [wiki](https://github.com/C0rn3j/sc-controller/wiki/Running-SC-Controller-on-Windows), but this is untested and might be broken, report a bug if so ## Building the package by yourself ### Dependencies - Python 3.11+ - GTK 3.24+ - [PyGObject](https://live.gnome.org/PyGObject) - [python-gi-cairo](https://packages.debian.org/sid/python-gi-cairo) and [gir1.2-rsvg-2.0](https://packages.debian.org/sid/gir1.2-rsvg-2.0) on Debian-based distributions (included in PyGObject elsewhere) - [setuptools](https://pypi.python.org/pypi/setuptools) - [python-evdev](https://python-evdev.readthedocs.io/en/latest/) - [python-pylibacl](http://pylibacl.k1024.org/) - [python-vdf](https://pypi.org/project/vdf/) - [python-libusb1](https://github.com/vpelletier/python-libusb1) - [python-ioctl-opt](https://pypi.org/project/ioctl-opt/) - [gtk-layer-shell](https://github.com/wmww/gtk-layer-shell) ### Via Python into a local build directory - ~~Download and extract [latest release](https://github.com/C0rn3j/sc-controller/releases/latest)~~ .zip releases without .git directory are currently broken - tracked in [#50](https://github.com/C0rn3j/sc-controller/issues/50) - Clone the repository `git clone https://github.com/C0rn3j/sc-controller.git` and navigate into it: `cd sc-controller` - `python3 -m build --wheel` - `python3 -m installer --destdir="./build" dist/*.whl` - Run the app via: `SCC_SHARED="${PWD}" PYTHONPATH="./build/usr/lib/python3.12/site-packages" PATH="${PWD}/build/usr/bin:${PATH}" ./build/usr/bin/sc-controller` ### Via Docker A test build with Docker can be created using the following way: ```bash docker build -o build-output --build-arg BASE_CODENAME=noble . ``` ### Via Python venv through run.sh - ~~Download and extract [latest release](https://github.com/C0rn3j/sc-controller/releases/latest)~~ .zip releases without .git directory are currently broken - tracked in [#50](https://github.com/C0rn3j/sc-controller/issues/50) - Clone the repository `git clone https://github.com/C0rn3j/sc-controller.git` and navigate into it: `cd sc-controller` - Optionally checkout a branch or a tag, like `python3`(default) or `v0.4.9.8.8` - Execute `./run.sh`, this automatically builds the project into a venv called `.env`, activates it and runs sc-controller, which in turn runs scc-daemon if one does not run already - If you are debugging an issue, running `./run.sh daemon` first will launch the daemon in debug mode, allowing you to launch sc-controller in another terminal with `./run.sh` C0rn3j-sc-controller-f3b142b/TODO.md000066400000000000000000000017661522611447500170520ustar00rootroot00000000000000List of (possibly) planned features in no particular order: - Multiple on-screen menus (and possibly keyboards) when using multiple controllers - Injecting emulated xbox controller into wine Hard stuff: - Injecting emulated xbox controller into PlayOnLinux Very hard stuff: - Visual feedback in binding editor ( [what this guy says](https://www.reddit.com/r/linux_gaming/comments/5pcdmr/sc_controller_use_steam_controller_without_steam/dcqpvf4/) ) **Done** stuff: - Multicontroller support - Configurable gamepad type (e.g. 4 axes and 16 buttons) - Steam Profile import - Radial Menu for the Joystick/Trackpad - Copy & paste - Cycling Buttons - Process monitor (or active window monitor) with switch - Mouse regions - Touch-Menu - Menu in OSD - OSD - double click - on-screen keyboard - Spining mouse wheel rotation - Haptic feedback support - Gyroscope input - Gamepad button as modifier (modeshift) - Macros - Turbo - Trigger settings - DPAD that acts only when clicked - 8-way DPAD - Selector for media keysC0rn3j-sc-controller-f3b142b/appimage-build.sh000077500000000000000000000160651522611447500212000ustar00rootroot00000000000000#!/bin/bash set -ex APP="sc-controller" EXEC="scc" LIB="lib" EVDEV_VERSION=0.7.0 [[ "$BUILD_APPDIR" == "" ]] && BUILD_APPDIR=$(pwd)/appimage PYTHON_VERSION=$(python3 -c 'import sys; version=sys.version_info[:3]; print("{0}.{1}".format(*version))') SITE_PACKAGES_PATH=$(python3 -c "import os,sys; print([p for p in sys.path if p.endswith('site-packages') and sys.prefix in p][0])") if [[ -z "${SITE_PACKAGES_PATH}" ]]; then echo "Could not determine global site-packages path. Exiting" exit 1 fi function download_dep() { NAME=$1 URL=$2 if [ -e ../../${NAME}.obstargz ] ; then # Special case for OBS cp ../../${NAME}.obstargz /tmp/${NAME}.tar.gz elif [ -e ${NAME}.tar.gz ] ; then cp ${NAME}.tar.gz /tmp/${NAME}.tar.gz elif [ -e /tmp/${NAME}.tar.gz ] ; then echo "/tmp/${NAME}.tar.gz already downloaded" else wget -c "${URL}" -O /tmp/${NAME}.tar.gz fi } function build_dep() { NAME="$1" mkdir -p /tmp/${NAME} pushd /tmp/${NAME} tar --extract --strip-components=1 -f /tmp/${NAME}.tar.gz PYTHONPATH=${BUILD_APPDIR}/usr/lib/python${PYTHON_VERSION}/site-packages python3 \ setup.py install --optimize=1 \ --prefix="/usr/" --root="${BUILD_APPDIR}" mkdir -p "${BUILD_APPDIR}/usr/lib/python${PYTHON_VERSION}/site-packages/" python3 setup.py install --prefix="/usr/" --root="${BUILD_APPDIR}" popd } function unpack_dep() { NAME="$1" pushd ${BUILD_APPDIR} tar --extract --exclude="usr/include**" --exclude="usr/lib/pkgconfig**" \ --exclude="usr/lib/python2.7**" -f /tmp/${NAME}.tar.gz popd } # Download deps download_dep "python-evdev-0.7.0" "https://github.com/gvalkov/python-evdev/archive/v0.7.0.tar.gz" download_dep "pylibacl-0.6.0" "https://github.com/iustin/pylibacl/releases/download/v0.6.0/pylibacl-0.6.0.tar.gz" download_dep "python-gobject-3.36.1" "https://archive.archlinux.org/packages/p/python-gobject/python-gobject-3.36.1-1-x86_64.pkg.tar.zst" download_dep "python-vdf-3.4" "https://github.com/ValvePython/vdf/archive/v3.4.tar.gz" download_dep "libpng-1.6.34" "https://archive.archlinux.org/packages/l/libpng/libpng-1.6.34-2-x86_64.pkg.tar.xz" download_dep "gdk-pixbuf-2.36.9" "https://archive.archlinux.org/packages/g/gdk-pixbuf2/gdk-pixbuf2-2.36.9-1-x86_64.pkg.tar.xz" download_dep "libcroco-0.6.13" "https://archive.archlinux.org/packages/l/libcroco/libcroco-0.6.13-1-x86_64.pkg.tar.xz" download_dep "libxml2-2.9.10" "https://archive.archlinux.org/packages/l/libxml2/libxml2-2.9.10-2-x86_64.pkg.tar.zst" download_dep "librsvg-2.48.7" "https://archive.archlinux.org/packages/l/librsvg/librsvg-2%3A2.48.7-1-x86_64.pkg.tar.zst" download_dep "icu-67.1" "https://archive.archlinux.org/packages/i/icu/icu-67.1-1-x86_64.pkg.tar.zst" download_dep "zlib-1:1.2.12" "https://archive.archlinux.org/packages/z/zlib/zlib-1%3A1.2.12-2-x86_64.pkg.tar.zst" download_dep "libffi-3.4.3" "https://archive.archlinux.org/packages/l/libffi/libffi-3.4.3-1-x86_64.pkg.tar.zst" # Prepare & build deps export PYTHONPATH=${BUILD_APPDIR}/usr/lib/python${PYTHON_VERSION}/site-packages/ mkdir -p "$PYTHONPATH" if [[ $(grep ID_LIKE /etc/os-release) == *"suse"* ]] ; then # Special handling for OBS ln -s lib64 ${BUILD_APPDIR}/usr/lib export PYTHONPATH="$PYTHONPATH":${BUILD_APPDIR}/usr/lib64/python${PYTHON_VERSION}/site-packages/ LIB=lib64 fi build_dep "python-evdev-0.7.0" build_dep "pylibacl-0.6.0" build_dep "python-vdf-3.4" unpack_dep "python-gobject-3.36.1" unpack_dep "libpng-1.6.34" unpack_dep "gdk-pixbuf-2.36.9" unpack_dep "libcroco-0.6.13" unpack_dep "libxml2-2.9.10" unpack_dep "librsvg-2.48.7" unpack_dep "icu-67.1" unpack_dep "zlib-1:1.2.12" unpack_dep "libffi-3.4.3" # Remove uneeded files rm -f "${BUILD_APPDIR}/usr/${LIB}/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-ani.so" rm -f "${BUILD_APPDIR}/usr/${LIB}/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-bmp.so" rm -f "${BUILD_APPDIR}/usr/${LIB}/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-gif.so" rm -f "${BUILD_APPDIR}/usr/${LIB}/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-icns.so" rm -f "${BUILD_APPDIR}/usr/${LIB}/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-ico.so" rm -f "${BUILD_APPDIR}/usr/${LIB}/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-jasper.so" rm -f "${BUILD_APPDIR}/usr/${LIB}/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-jpeg.so" rm -f "${BUILD_APPDIR}/usr/${LIB}/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-qtif.so" rm -f "${BUILD_APPDIR}/usr/${LIB}/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-tga.so" rm -f "${BUILD_APPDIR}/usr/${LIB}/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-tiff.so" rm -R "${BUILD_APPDIR}/usr/lib/cmake" rm -R "${BUILD_APPDIR}/usr/share/doc" rm -R "${BUILD_APPDIR}/usr/share/gtk-doc" rm -R "${BUILD_APPDIR}/usr/share/locale" rm -R "${BUILD_APPDIR}/usr/share/man" rm -R "${BUILD_APPDIR}/usr/share/thumbnailers" rm -R "${BUILD_APPDIR}/usr/share/vala" rm -R "${BUILD_APPDIR}/usr/share/icu" # Build important part. Need executable flag to place custom interpreter line. # Setuptools overrrides original #! line in scripts with /usr/bin/python. # Ubuntu 22.04 LTS does not provide an executable at /usr/bin/python # by default. python3 setup.py build --executable "/usr/bin/env python3" # Need to use single-version-externally-managed due to setuptools behavior python3 setup.py install --single-version-externally-managed --prefix ${BUILD_APPDIR}/usr --record /dev/null # Move udev stuff mv ${BUILD_APPDIR}/usr/lib/udev/rules.d/69-${APP}.rules ${BUILD_APPDIR}/ rmdir ${BUILD_APPDIR}/usr/lib/udev/rules.d/ rmdir ${BUILD_APPDIR}/usr/lib/udev/ mkdir -p ${BUILD_APPDIR}/usr/${LIB}/python${PYTHON_VERSION}/site-packages/scc/ cp "/usr/include/linux/input-event-codes.h" ${BUILD_APPDIR}/usr/${LIB}/python${PYTHON_VERSION}/site-packages/scc/ # Move & patch desktop file mv ${BUILD_APPDIR}/usr/share/applications/${APP}.desktop ${BUILD_APPDIR}/ sed -i "s/Icon=.*/Icon=${APP}/g" ${BUILD_APPDIR}/${APP}.desktop sed -i "s/Exec=.*/Exec=.\/usr\/bin\/scc gui/g" ${BUILD_APPDIR}/${APP}.desktop # Convert icon convert -background none ${BUILD_APPDIR}/usr/share/pixmaps/${APP}.svg ${BUILD_APPDIR}/${APP}.png # Copy appdata.xml mkdir -p ${BUILD_APPDIR}/usr/share/metainfo/ cp scripts/${APP}.appdata.xml ${BUILD_APPDIR}/usr/share/metainfo/${APP}.appdata.xml # Make symlinks ln -sfr ${BUILD_APPDIR}${SITE_PACKAGES_PATH}/libcemuhook.cpython-310-x86_64-linux-gnu.so ${BUILD_APPDIR}${SITE_PACKAGES_PATH}/libcemuhook.so ln -sfr ${BUILD_APPDIR}${SITE_PACKAGES_PATH}/libhiddrv.cpython-310-x86_64-linux-gnu.so ${BUILD_APPDIR}${SITE_PACKAGES_PATH}//libhiddrv.so ln -sfr ${BUILD_APPDIR}${SITE_PACKAGES_PATH}/libremotepad.cpython-310-x86_64-linux-gnu.so ${BUILD_APPDIR}${SITE_PACKAGES_PATH}/libremotepad.so ln -sfr ${BUILD_APPDIR}${SITE_PACKAGES_PATH}/libsc_by_bt.cpython-310-x86_64-linux-gnu.so ${BUILD_APPDIR}${SITE_PACKAGES_PATH}/libsc_by_bt.so ln -sfr ${BUILD_APPDIR}${SITE_PACKAGES_PATH}/libuinput.cpython-310-x86_64-linux-gnu.so ${BUILD_APPDIR}${SITE_PACKAGES_PATH}/libuinput.so ln -sfr ${BUILD_APPDIR}${SITE_PACKAGES_PATH}/posix1e.cpython-310-x86_64-linux-gnu.so ${BUILD_APPDIR}${SITE_PACKAGES_PATH}/posix1e.so # Copy AppRun script cp scripts/appimage-AppRun.sh ${BUILD_APPDIR}/AppRun chmod +x ${BUILD_APPDIR}/AppRun echo "Run appimagetool -n ${BUILD_APPDIR} to finish prepared appimage" C0rn3j-sc-controller-f3b142b/daemon.sh000077500000000000000000000004671522611447500175620ustar00rootroot00000000000000#!/bin/bash # Ensure correct cwd cd "$(dirname "$0")" # Set PATH SCRIPTS="$(pwd)/scripts" export PATH="$SCRIPTS":"$PATH" export PYTHONPATH=".":"$PYTHONPATH" export SCC_SHARED="$(pwd)" if [ "$1" == "lldb" ] ; then shift lldb python3 -- 'scripts/scc-daemon' debug $@ else python3 'scripts/scc-daemon' $@ fi C0rn3j-sc-controller-f3b142b/default_menus/000077500000000000000000000000001522611447500206045ustar00rootroot00000000000000C0rn3j-sc-controller-f3b142b/default_menus/.autoswitch.menu000066400000000000000000000001411522611447500237360ustar00rootroot00000000000000[{ "separator": true, "name": "Autoswitch Options" }, { "generator": "autoswitch" }] C0rn3j-sc-controller-f3b142b/default_menus/.games.menu000066400000000000000000000001201522611447500226350ustar00rootroot00000000000000[{ "separator": true, "name": "Games" }, { "generator" : "games" }] C0rn3j-sc-controller-f3b142b/default_menus/.windowlist.menu000066400000000000000000000001311522611447500237460ustar00rootroot00000000000000[{ "separator": true, "name": "Switch to" }, { "generator" : "windowlist" }] C0rn3j-sc-controller-f3b142b/default_menus/Default.menu000066400000000000000000000011401522611447500230520ustar00rootroot00000000000000[{ "separator": true, "name": "Recent profiles" }, { "generator": "recent", "rows": 3 }, { "submenu": "Profiles.menu", "icon": "system/profiles", "name": "All Profiles" }, { "separator": true, "name": "Options" }, { "submenu": ".autoswitch.menu", "icon": "system/autoswitch", "name": "Autoswitch Options" }, { "action": "turnoff()", "id": "item4", "icon": "system/turn-off", "name": "Turn Controller OFF", "osd": true }, { "action": "keyboard()", "id": "item5", "icon": "system/keyboard", "name": "Display Keyboard" }] C0rn3j-sc-controller-f3b142b/default_menus/Profiles.menu000066400000000000000000000001321522611447500232510ustar00rootroot00000000000000[{ "separator": true, "name": "All profiles" }, { "generator" : "profiles" }] C0rn3j-sc-controller-f3b142b/default_profiles/000077500000000000000000000000001522611447500213005ustar00rootroot00000000000000C0rn3j-sc-controller-f3b142b/default_profiles/.scc-osd.keyboard.sccprofile000066400000000000000000000020001522611447500265530ustar00rootroot00000000000000{ "buttons": { "A": { "action": "button(Keys.KEY_ENTER)" }, "B": { "action": "button(Keys.KEY_ESC)" }, "C": { "action": "OSK.close()" }, "LB": { "action": "button(Keys.KEY_BACKSPACE)" }, "RB": { "action": "button(Keys.KEY_SPACE)" }, "LGRIP": { "action": "button(Keys.KEY_LEFTSHIFT)" }, "LPAD": { "action": "OSK.press(LEFT)" }, "RGRIP": { "action": "button(Keys.KEY_RIGHTALT)" }, "RPAD": { "action": "OSK.press(RIGHT)" }, "START": { "action": "button(Keys.KEY_TAB)" }, "X": { "action": "OSK.close()" }, "Y": { "action": "OSK.close()" } }, "pad_left": { "action": "OSK.cursor(LEFT)" }, "pad_right": { "action": "OSK.cursor(RIGHT)" }, "trigger_left": { "action": "button(Keys.KEY_LEFTSHIFT)" }, "trigger_right": { "action": "button(Keys.KEY_LEFTCTRL)" }, "stick": { "action": "dpad(button(Keys.KEY_UP), button(Keys.KEY_DOWN), button(Keys.KEY_LEFT), button(Keys.KEY_RIGHT))", "modes": { "RGRIP": { "action": "OSK.move()" } } }, "gyro": {}, "menus": {}, "version": 1 } C0rn3j-sc-controller-f3b142b/default_profiles/.scc-osd.profile_editor.sccprofile000066400000000000000000000023741522611447500277770ustar00rootroot00000000000000{ "_": "", "buttons": { "A": { "action": "button(Keys.KEY_SPACE)" }, "B": { "action": "button(Keys.KEY_ESC)" }, "C": { "action": "restart()" }, "LB": { "action": "button(Keys.KEY_BACKSPACE)" }, "LPAD": { "action": "button(Keys.BTN_RIGHT)" }, "RB": { "action": "button(Keys.KEY_SPACE)" }, "RPAD": { "action": "button(Keys.BTN_LEFT)" }, "Y": { "action": "button(Keys.KEY_F2)" } }, "cpad": {}, "gyro": {}, "is_template": false, "menus": {}, "pad_left": { "action": "feedback(LEFT, 4090, 16, ball(XY(mouse(Rels.REL_HWHEEL), mouse(Rels.REL_WHEEL))))" }, "pad_right": { "action": "smooth(8, 0.78, 2.0, feedback(RIGHT, 256, ball(mouse())))" }, "stick": { "action": "dpad(button(Keys.KEY_UP), button(Keys.KEY_DOWN), button(Keys.KEY_LEFT), button(Keys.KEY_RIGHT))" }, "trigger_left": { "action": "trigger(50, 50, button(Keys.BTN_RIGHT))" }, "trigger_right": { "action": "trigger(50, 255, button(Keys.BTN_LEFT))" }, "version": 1.4 }C0rn3j-sc-controller-f3b142b/default_profiles/Desktop.sccprofile000066400000000000000000000030361522611447500247660ustar00rootroot00000000000000{ "_": "", "buttons": { "A": { "action": "button(Keys.KEY_ENTER)" }, "B": { "action": "button(Keys.KEY_ESC)" }, "BACK": { "action": "button(Keys.KEY_BACKSPACE)" }, "C": { "action": "hold(menu('Default.menu'), menu('Default.menu'))" }, "CPADPRESS": { "action": "button(Keys.BTN_LEFT)" }, "LB": { "action": "button(Keys.KEY_LEFTCTRL)" }, "RB": { "action": "button(Keys.KEY_LEFTALT)" }, "RPAD": { "action": "button(Keys.BTN_LEFT)" }, "START": { "action": "button(Keys.KEY_LEFTSHIFT)" }, "X": { "action": "button(Keys.KEY_SPACE)" }, "Y": { "action": "button(Keys.KEY_TAB)" } }, "cpad": { "action": "mouse()" }, "gyro": {}, "is_template": false, "menus": {}, "pad_left": { "action": "feedback(LEFT, 4096, 16, ball(XY(mouse(Rels.REL_HWHEEL, 1.0), mouse(Rels.REL_WHEEL, 1.0))))" }, "pad_right": { "action": "smooth(8, 0.78, 2.0, feedback(RIGHT, 256, ball(mouse())))" }, "stick": { "action": "dpad(button(Keys.KEY_UP), button(Keys.KEY_DOWN), button(Keys.KEY_LEFT), button(Keys.KEY_RIGHT))" }, "trigger_left": { "action": "button(Keys.BTN_RIGHT)" }, "trigger_right": { "action": "button(Keys.BTN_LEFT)" }, "version": 1.4 } C0rn3j-sc-controller-f3b142b/default_profiles/XBox Controller with High Precision Camera.sccprofile000066400000000000000000000031561522611447500332250ustar00rootroot00000000000000{ "_": "", "buttons": { "A": { "action": "button(Keys.BTN_GAMEPAD)" }, "B": { "action": "button(Keys.BTN_EAST)" }, "BACK": { "action": "button(Keys.BTN_SELECT)" }, "C": { "action": "hold(menu('Default.menu'), menu('Default.menu'))" }, "LB": { "action": "button(Keys.BTN_TL)" }, "LGRIP": { "action": "button(Keys.BTN_GAMEPAD)" }, "RB": { "action": "button(Keys.BTN_TR)" }, "RGRIP": { "action": "button(Keys.BTN_NORTH)" }, "RPAD": { "action": "button(Keys.BTN_THUMBR)" }, "START": { "action": "button(Keys.BTN_START)" }, "STICKPRESS": { "action": "button(Keys.BTN_THUMBL)" }, "X": { "action": "button(Keys.BTN_NORTH)" }, "Y": { "action": "button(Keys.BTN_WEST)" } }, "cpad": {}, "gyro": {}, "is_template": false, "menus": {}, "pad_left": { "action": "click(dpad(hatup(Axes.ABS_HAT0Y), hatdown(Axes.ABS_HAT0Y), hatleft(Axes.ABS_HAT0X), hatright(Axes.ABS_HAT0X)))" }, "pad_right": { "action": "smooth(8, 0.78, feedback(RIGHT, 256, ball(mouse())))" }, "stick": { "action": "sens(1.2, 1.2, XY(axis(Axes.ABS_X), raxis(Axes.ABS_Y)))" }, "trigger_left": { "action": "axis(Axes.ABS_Z)" }, "trigger_right": { "action": "axis(Axes.ABS_RZ)" }, "version": 1.4 }C0rn3j-sc-controller-f3b142b/default_profiles/XBox Controller.sccprofile000066400000000000000000000032021522611447500263340ustar00rootroot00000000000000{ "_": "", "buttons": { "A": { "action": "button(Keys.BTN_GAMEPAD)" }, "B": { "action": "button(Keys.BTN_EAST)" }, "BACK": { "action": "button(Keys.BTN_SELECT)" }, "C": { "action": "hold(menu('Default.menu'), menu('Default.menu'))" }, "LB": { "action": "button(Keys.BTN_TL)" }, "LGRIP": { "action": "button(Keys.BTN_GAMEPAD)" }, "RB": { "action": "button(Keys.BTN_TR)" }, "RGRIP": { "action": "button(Keys.BTN_NORTH)" }, "RPAD": { "action": "button(Keys.BTN_THUMBR)" }, "START": { "action": "button(Keys.BTN_START)" }, "STICKPRESS": { "action": "button(Keys.BTN_THUMBL)" }, "X": { "action": "button(Keys.BTN_NORTH)" }, "Y": { "action": "button(Keys.BTN_WEST)" } }, "cpad": {}, "gyro": { "action": "cemuhook" }, "is_template": false, "menus": {}, "pad_left": { "action": "click(dpad(hatup(Axes.ABS_HAT0Y), hatdown(Axes.ABS_HAT0Y), hatleft(Axes.ABS_HAT0X), hatright(Axes.ABS_HAT0X)))" }, "pad_right": { "action": "feedback(RIGHT, 256, XY(axis(Axes.ABS_RX), raxis(Axes.ABS_RY)))" }, "stick": { "action": "sens(1.2, 1.2, XY(axis(Axes.ABS_X), raxis(Axes.ABS_Y)))" }, "trigger_left": { "action": "axis(Axes.ABS_Z)" }, "trigger_right": { "action": "axis(Axes.ABS_RZ)" }, "version": 1.4 } C0rn3j-sc-controller-f3b142b/docs/000077500000000000000000000000001522611447500167015ustar00rootroot00000000000000C0rn3j-sc-controller-f3b142b/docs/actions.md000077500000000000000000000522461522611447500206770ustar00rootroot00000000000000### In this document - [Custom Action page](#examples1) - [List of all known actions](#actions) - [Macros and operators](#macros) - [Profile file examples](#examples2) # Custom Action page examples - To do two or more things at once, type `action() and action()` - To do two or more things in sequence, type `action() ; action()` - Typing second action on new line is same thing as using `and` #### Press button repeadedly, rapid fire mode `repeat(button(BTN_A))` (see [repeat](#repeat), [button](#button)) #### Press Alt+F4 `button(KEY_LEFTALT) and button(KEY_F4)` #### Press multiple buttons in sequence `button(BTN_A) ; button(BTN_X); button(BTN_B)` #### Press button and hold it for set delay `press(BTN_A) ; sleep(0.5); release(BTN_B)` (see [press](#press), [sleep](#sleep), [release](#release)) # Actions #### button(button1 [, button2 = None ]) - For button, simply maps real button to emulated - For stick or pad, 'button1' is pressed when stick or finger on pad is moved to up or left and 'button2' when to down or right. Using [dpad](#dpad) may be better for such situations. - For trigger, when trigger is pressed, but until it clicks, 'button2' is pressed. When trigger clicks 'button2' is released and replaced by 'button1'. If only 'button1' is set, trigger acts as big button. Note that 'button2' is always optional. #### mouse(axis) - For stick, lets cursor or mouse wheel to be controlled by stick tilt. - For pad, acts as trackpad - sliding finger over pad moves the mouse. If set to *REL_WHEEL* or *REL_HWHEEL*, emulates finger scroll. You can use `ball(mouse)` to emulate trackball. - For gyroscope, controls mouse with changes in controller pitch and roll/yaw. Axis parameter should be either YAW or ROLL (constants) and decides which gyroscope axis controls X mouse axis. - For button, pressing button maps to single movement over mouse axis or single step on scroll wheel. #### mouseabs(axis) - For stick, lets cursor or mouse wheel to be controlled by stick tilt. - For pad, distance from center of pad controls speed of mouse movement - For gyroscope, please, use gyroabs action. #### trackpad(axis) Merged with [mouse](#mouse), does same thing. #### axis(id [, min = -32767, max = 32767 ]) - For button, pressing button maps to moving axis full way to 'max'. eleasing button returns emulated axis back to 'min'. - For stick or pad, simply maps real axis to emulated - For trigger, maps trigger position to to emulated axis. Note that default trigger position is not in middle, but in minimal possible value. #### dpad([diagonal_range,] up, down, left, right) Emulates dpad. Touchpad is divided into 8 triangular parts. When the user touches the touchpad, action is executed depending on finger position. 'diagonal_range' is specified in degrees (1 to 89). If not set, all parts are sized equally, otherwise, diagonal parts are taking specified portion of pad and rest is assigned to up/left/right/down portions. Available only for pads and sticks. #### dpad8([diagonal_range,] up, down, left, right, upleft, upright, downleft, downright) Same as dpad, with more directions. #### ring([radius=0.5], inner, outer) Defines outer and inner ring bindings. When distance of finger from center of pad is smaller than 'radius', 'inner' action is activated, otherwise, 'outer' takes place. Unlike [dpad](#dpad), which executes actions as if they were bound to buttons, ring works more like defining two actions on same pad with non-overlapping deadzones. #### area(x1, y1, x2, y2), winarea(x1, y1, x2, y2) Creates 1:1 mapping between finger position on pad and mouse position in specified screen area. Coordinates are in pixels with (0,0) on top,left corner. Negative number can be used to count from other side of screen. `winarea` does same thing but with position relative to current window instead of entire screen. #### relarea(x1, y1, x2, y2), relwinarea(x1, y1, x2, y2) Creates 1:1 mapping between finger position on pad and mouse position in specified screen area. Coordinates are fractions of screen width and height, (0,0) is top,left and (1,1) bottom,right corner of screen. `relwinarea` does same thing but with position relative to current window instead of entire screen. #### trigger(press_level, [release_level, ] action) Maps action to be executed as by button press when trigger is pressed through 'press_level'. Level goes from 0 to 255, where 255 is level after physical trigger clicks. Then, optionally, if trigger is pressed through 'release_level', action is "released". If release_level is not set, action will be released only after trigger value moves back beyond press_level. It's possible to map multiple actions on different trigger levels using [and](#and). Examples: Hold right mouse button while trigger is being pressed, press left button when trigger clicks. Right button is released only when trigger is fully released. ``` trigger(64, 255, button(BTN_RIGHT)) and trigger(255, button(BTN_LEFT)) ``` Control left virtual trigger while trigger is being pressed and press left button just before trigger clicks. If trigger clicks, press enter key and play feedback. ``` trigger(64, 255, axis(ABS_Z)) and trigger(240, 254, button(BTN_LEFT)) and trigger(255, feedback(LEFT, button(KEY_ENTER))) ``` #### hipfire([partialpress_level, ][fullpress_level, ] partialpress_action, fullpress_action [, mode][, delay]) Maps two different actions to be executed when trigger is inside a defined range and meet predefined conditions. Basically, the "partialpress_action" will be activated if the trigger is pressed passed the "partialpress_level" and it stays inside the range between this level and the "fullpress_level" until the "delay" ends, otherwise, the "fullpress_action" will be activated ALONE if the "fullpress_level" is reached before the "delay" ends. The partial and full levels goes from 0 to 255, and the values 50 and 254 are used for "partialpress_level" and "fullpress_level", respectively, if none is passed. The "mode" can be defined as described below and the "NORMAL" one is used if none is passed. Modes available: - NORMAL - if trigger is pressed beyond the "partialpress_level" and the timeout is reached, the "partialpress_action" is executed. If the "partialpress_action" was pressed it will only be released after the trigger return back beyond the "partialpress_level". The "fullpress_action" will be executed every time the "fullpress_level" is reached, but if this level is reached before the timeout the "partialpres_action" will not be triggered until releasing the trigger. - EXCLUSIVE - Acts similar to the previous mode, but the "fullpress_action" is only triggered if the "partialpres_action" was not triggered. Meaning it will only activate if the "fullpress_level" is reached before the timeout ends. - SENSIBLE - Acts similar to NORMAL, but after the "partialpress_action" is activated, releasing the trigger a little, will deactivate the action allowing it to be activated again more faster without needing to release the trigger back beyond the "partialpress_level". The "delay" is time window used to determine if the "partialpress_action" should or not be activated. Examples: Hold right mouse button while trigger is being softly pressed and press left mouse button when trigger click, but will bypass the right mouse button and only press the left mouse button if the trigger is pressed very fast to the click. ``` hipfire(50, 254, button(BTN_RIGHT),button(BTN_LEFT), NORMAL, 0.20) ``` Press A if the trigger is pressed slowly and not reaches the click or press B if the trigger is pressed fast and reached the click, and will execute only one of this two actions. ``` hipfire(50, 254, button(KEY_A),button(KEY_B), EXCLUSIVE, 0.15) ``` #### gyro(axis1 [, axis2 [, axis3]]) Maps *changes* in gyroscope pitch, yaw and roll movement into movements of gamepad stick. Can be used to map gyroscope to camera when camera can be controlled only with analog stick. #### gyroabs(axis1 [, axis2 [, axis3]]) Maps absolute gyroscope pitch, yaw and roll movement into movements of mouse or gamepad stick. Can be used to map gyroscope to movement stick or to use controller as racing wheel. #### resetgyro() Resets gyroscope offsets so current orientation is treated as neutral. #### cemuhook() When set to gyro, outputs gyroscope data in way compatibile with Cemu, Citra and other applications using CemuHookUDP motion provider protocol. #### gyro(front_down, front_up, tilt_left, tilt_right) Maps tilting of gamepad into actions. When gamepad is tilt to one of for supported sides, assigned action is executed as if by button press and then "released" after gamepad is balanced again. #### trackball() Split to [ball](#ball) modifier and [mouse](#mouse) action. Typing `trackball` works as alias for `ball(mouse())` #### XY(xaction, yaction) Provides way to assign two different actions to two stick or pad axes. This is automatically handled by GUI, so user usually doesn't need to write it directly. #### relXY(xaction, yaction) Works same as [XY](#XY), but treats position where pad is touched as "center" of pad. #### press(button) Presses button and leaves it pressed. #### release(button) Releases pressed button. #### tap(button, number=1) Presses button for a short while, 'number' times. If 'number' is greater than 1 (when double-tap is performed), tapped button is kept press as long as physical button that started tap is pressed. For single tap, virtual button is released right away. If virtual button is already pressed before tapping, it is released first and restored after tap, resulting in sequence of "release - press - release - press" #### profile(name) Loads another profile #### shell(command) Executes command on background #### turnoff() Turns controller off #### restart() Restarts scc-daemon. Don't use unless you have good reason to. #### led(brightness) Sets brightness of controller led. 'Brightness' is percent in 0 to 100 range. #### osd([timeout=5, [size=3]], text) Displays message in OSD. 'timeout' sets for how many seconds should message stay visible. Value of 0 has special meaning and leaves message displayed indefinitely, until profile is changed or [clearosd](#clearosd) action is used. 'size' sets size of font on message. Only three options are supported right now, 3 for "default size", 2 for "smalller" and 1 for "small". #### clearosd() Clears all windows from OSD layer. Cancels all menus, clears all messages, hides on screen keyboard. Does _not_ clear OSD windows created using command line tools. #### menu(menu [, confirm_button=A [, cancel_button=B [, show_with_release=False]]]]) Displays OSD menu. 'confirm_button' and 'cancel_button' sets which gamepad button should be used to confirm/cancel menu. Additionaly, 'confirm_button' can be set to SAME (constant), in which case menu will be closed and selected item choosen when button used to display menu is released. If 'show_with_release' is set to true, menu is displayed only after button is released. 'menu' can be either id of menu defined in same profile file or filename relative to `~/.config/scc/menus` or `/usr/share/scc/default_menus/`, whichever exists, in that order. #### hmenu(menu [, confirm_button=A [, cancel_button=B [, show_with_release=False]]]]) Same as `menu`, but packed in one row. #### gridmenu(menu [, confirm_button=A [, cancel_button=B [, show_with_release=False]]]]) Same as `menu`, but displays items in grid. #### radialmenu(menu [, confirm_button=A [, cancel_button=B [, show_with_release=False]]]]) Same as `menu`, but displays items in radial menu. #### quickmenu(menu) Special kind of menu controled by buttons instead of stick. Every item has assigned button and user selects it by pressing that button. Fast to use, but is limited to 6 items at most. #### dialog([ confirm_button=A [, cancel_button=B ], ] text, action1, [action2... actionN]) Displays OSD dialog. Dialog works similary to horizontal menu and displays text message above list of options. #### keyboard() Displays on-screen keyboard # Modifiers: #### click(action) Creates action action that occurs only if pad or stick is pressed. For example, `click(dpad(...))` set to pad will create dpad that activates buttons only when pressed. #### pressed(action) Creates action that occurs for brief moment when button is pressed. For example, `pressed(button(A))` will press and instantly release virtual A button whenever physical button is pressed. #### released(action) Creates action that occurs for brief moment when button is released. #### pressed(action) Creates action that occurs for brief moment when finger touches pad. #### released(action) Creates action that occurs for brief moment when pad is released. #### mode(button1, action1, [button2, action2... buttonN, actionN] [, default] ) Defines mode shifting. If physical buttonX is pressed, actionX is executed. Optional default action is executed if none from specified buttons is pressed. #### gestures([precision=0,] gesture1, action1, [gesture2, action2... gestureN, actionN] ) If set to left or right pad, enables gesture recognition. If GestureX is drawn, actionX is executed. If 'precision' is set to 1.0, gesture has to be exact. Otherwise, gestures resembling input with given precision are compared and one that matches it most is used. At precision of 0.0, all gestures are considered. Gestures are encoded in string and it's recommended to use GUI to record them. Nevertheless, format is simple: - Each stroke in one of four directions is stored as single character. - Characters are uppercase `U`, `D`, `L`, `R` for up, down, left, right - Default stroke length is 1/3 of pad size. - For stroke with twice of that length, characters is repeated twice - Three times for stroke through entire pad, or even more for longer. - If string starts with lowercase `i`, stroke length is ignored. #### doubleclick(doubleclick_action [, normal_action [, timeout ]]) Executes action if user double-clicks button. Optional normal_action parameter specifies action that is executed when user click button only once. Optional time arguments modifies maximum delay in doubleclick and in effect sets delay before normal action is executed. #### hold(hold_action [, normal_action [, timeout ]]) Executes action if user holds button for longer time. Optional normal_action parameter specifies action that is executed when user click button shortly. Optional time arguments modifies how long "longer time" is. Hold and doubleclick can be combined together by writing `hold([time,] hold_action, doubleclick(doubleclick_action, normal_action))` #### sens(x_axis [, y_axis [, z_axis]], action) Modifies sensitivity of physical stick or pad. #### rotate(angle, action) Rotates input pad or stick input by given angle. #### feedback(side, [amplitude=256 [, frequency=4 [, period=100 [, count=1 ]]]], action) Enables haptic feedback for specified action, if action supports it. Side has to be one of LEFT, RIGHT or BOTH. All remaining numbers can be anything from 1 to 32767, but note that setting count to large number will start long running feedback that you may not be able to stop. 'frequency' is used only when emulating touchpad and describes how many pixels should mouse travel between two feedback ticks. #### ball([friction=10.0, [mass=80.0, ]] action) Enables trackball mode. Moving finger over pad will keep repeating same action with decreasing speed, based on set mass and friction, until virtual 'spinning ball' stops moving. #### circular(action) Designed to controls scroll wheel by scrolling finger around pad. Can be used with any axis. For example, `circular(axis(Axes.ABS_X))` turns touchpad into small raing wheel. #### circular(action) Works as to `circular`, but instead of counting with finger movements, translates exact position on dpad to axis value. #### deadzone([mode,] lower, [upper, ] action) Enables deadzone on trigger, pad or stick. Mode defaults to 'CUT' and can be one of: - CUT - if value is out of deadzone range, output value is zero - ROUND - for values bellow deadzone range, output value is zero. For values above range, output value is maximum allowed. - LINEAR - input value is scaled, so entire output range is covered by range of deadzone. - MINIMUM - any non-zero input value is scaled so entire input range is mapped to range of deadzone. Zero on input is mapped to zero on output, so there is area over which output "jumps" when stick is tilted. #### smooth([buffer=8, [multiplier=0.7, [filter=2, ]]] action) Enables input smoothing. Position is computed as weighed average of last X input positions with highest weight given to most recent position. If 'filter' is above zero, movements bellow that value are ignored. #### osd([timeout=5], action) Enables on screen display for action. In most cases just displays action description in OSD and executes it normally. Works only if executed by pressing physical button or with `dpad`. Otherwise just executes child action. #### position(x, y, action) Specifies menu position on screen. X is position from left, Y from top. To specify position from right or bottom, use negative values. #### name(name, action) Allow inline setting of action name # Shortcuts: #### raxis(id) Shortcut for `axis(id, 32767, -32767)`, that is call to axis with min/max values reversed. Effectively inverted axis mapping. #### hatup(id) Shortcut for `axis(id, 0, 32767)`, emulates moving hat up or pressing 'up' button on dpad. #### hatdown(id) Shortcut for `axis(id, 0, -32767)`, emulates moving hat down or pressing 'down' button on dpad. #### hatleft(id), hatright(id) Same thing as hatup/hatdown, as vertical hat movement and left/right dpad buttons are same events on another axis # Macros and operators #### and - executing actions at once It is possible to join two (or more) actions with `and` keyword (or newline) to have them executed together. - `button(KEY_LEFTALT) and button(KEY_F4)` presses Alt+F4 #### semicolon - sequence (macro) When `;` is placed between actions, they are executed as sequence. - `hatup(ABS_Y); hatup(ABS_Y); button(BTN_B); button(BTN_A)` presses 'UP UP B A' on gamepad, as fast as possible - `button(KEY_A); button(KEY_B); button(KEY_C)` types 'abc'. #### type('text') Special type of macro where keys to press are specified as string. Basically, writing `type("iddqd")` is same thing as `button(KEY_I) ; button(KEY_D) ; button(KEY_D); button(KEY_Q); button(KEY_D)`, just much shorter. #### sleep(x) To insert pause between macro actions, use sleep() action. - `button(KEY_A); button(KEY_B); sleep(1.0); button(KEY_C)` types 'ab', waits 1s and types 'c' #### repeat(action) Turbo / rapid fire mode. Repeats macro (or even single action) until physical button is released. Macro is always played to end, even if button is released before macro is finished. - `repeat(button(BTN_X))` deals with "mash X to not die" events in some games. #### cycle(action1, action2...) Executes different action every time when button is pressed (action1 upon first press, action2 with second, etc.) Works only on buttons. # Examples for profile file Emulate key presses based on stick position ``` "stick" : { "X" : { "action" : "pad(KEY_A, KEY_D)" }, "Y" : { "action" : "key(KEY_W, KEY_S)" }, ``` Emulate left/right stick movement with X and B buttons ``` "buttons" : { "B" : { "action" : "axis(ABS_X, 0, 32767)" }, "X" : { "action" : "axis(ABS_X, 0, -32767)" }, ``` Emulate dpad on left touchpad, but act only when dpad is pressed ``` "left_pad" : { "action" : "click( dpad('hatup(ABS_HAT0Y)', 'hatdown(ABS_HAT0Y)', 'hatleft(ABS_HAT0X)', 'hatright(ABS_HAT0X)' ) )" } ``` Emulate button A when left trigger is half-pressed and button B when it is pressed fully ``` "triggers" : { "LEFT" : { "action" : "pad(BTN_A, BTN_B)" }, ``` C0rn3j-sc-controller-f3b142b/docs/menu-file.md000066400000000000000000000044151522611447500211100ustar00rootroot00000000000000SC Controller menu file specification ---------------------------------------- Menu file contains json-encoded list with menu items (actions), submenus, separators and menu generators. ### Menu Items Every menu item is defined by action, in same way as action would be defined [in profile file](profile-file.md#Action_definition) with one additional `id` key. `id` specifies action ID and can be anything, but each menu item should have unique ID. `name` key is still optional, but highly recommended as used as menu item title displayed on screen. If `name` is not specified, title is auto-generated. Example: [{ "id": "item1", "action": "profile('Desktop')", "name": "Switch to Desktop profile", }, { "id": "item2", "action": "turnoff()", "name": "Turn controller OFF", }] specifies menu with two items. ### Submenus Submenu is reference to another menu file (submenu cannot be defined in same file or profile file). When selected, another menu is loaded and drawn over original menu. Submenu is dict with `submenu` key, value of key is filename relative to `~/.config/scc/menus` or `/usr/share/scc/default_menus/`, whichever exists, in that order. `name` key may be defined. Example: [{ "submenu": "profiles.menu", "name": "All Profiles" }] specifies menu with sumbmenu called "All Profiles" defined in *profiles.menu* ### Separators Separator is empty space that splits menu into two or more logical blocks. Name, if set, is displayed in different way from menu items. Separator is defined by dict with `separator` key set to True. ### Menu Generators Generator is something that generates menu items automatically. It is defined by dict with `generator` key, where value is type of generator to use. Example: [{ "generator": "profiles" }, { "id": "item2", "action": "turnoff()", "name": "Turn controller OFF", }] specifies menu with list of all profiles, followed by one normal menu item. ### Available generators #### `profiles` Generates menu item for each available profile. Selecting item will switch to represented profile. #### `recent` Generates menu item for *X* recently selected profiles. *X* is 5 by default and can be set with additional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Ǐ?F)҄҄҄Zh/P@LƍӁ8WX &&YeLs*w24@4W_iCVZ)W͛ɓ'+ʔ)caS(M(M(-yͦS шƨ1E(|D JӭSZ .$w={[u袛Л+ޯ( tNUW(HTs4C(M(}i6*QDM㈮yo(Lpq:z„ 1Ŋ(r/)MCidcqq`EJZj A9w^r[B@M(M(M(-YիQj4wC(M(}1_v_"-[ kƓK+X$k֬Yo‰+W.V#=g؁ÔP+uc1%J3 IּyseAIZ4Z544dQQBiPPy_7_ĦM6b ۔~zF!( 5n0uk| 1c?"o0Ѱۡ4=~M5k֜f5j,_|޼yU,XPy"&).^ ($S4zU PPPPX)z-W(M hҌ̖vB9ݩS`3jJy&&&!!&&sWWlX 90C#9#Jl"i ޗݗ4Fd~TKXm>RҤwyIHd)PJKY!ЗUbE,p WZ̪+( ٶ(i>u `j)J{7R&e?E3?%Be8$18Ș]ȴrEWddѣGqi ڴiC*/0;Yn8RD̸Fz(:ҥO(Mޯ"H$]>M [K["6w\fr@rJK"xw DAc}Dl"[A/|' {]}~>0 ܟq>~m=ki 5BThm~FRJj9 9SZD}ԔLʔu=I$}y>Z:p\.}7:RLi$IOi"3yx<^Q~uf)}<Oir^sYJnKQQ$IҘivugyf1Ք&IGZu9םz5mAw@mR033affffffff۫WґE۱c`4 8Q#Ӳe}fPٿm%ALS3mZ4MtfZvƍwVt٘M2-Unv8=,,LyXQ=U\AJ i /SMQF B#.P,j<ɡ *kJu#W?oac$  ~nTBZ4Mt\;w'ڵy+4lذ%A&7%g'OTL~f%4ED'ŋY7r5Zp> ȆrS:isӀa3X|䫲6W"`y)պa0rz `ڷo?iǞa4V.  dfzL5?S M E{M%g*jZ.H VaWNC\FQ߲Cf]up, X  ɥCqLk1Sx0jL,RY@׮]<7r^m3f  JBZCǏ%gϟ?7?S Ç_|_mIENDB`C0rn3j-sc-controller-f3b142b/docs/profile-file.md000066400000000000000000000211531522611447500216020ustar00rootroot00000000000000SC Controller profile file specification ---------------------------------------- Profile file contains json-encoded dictonary with specific keys. Missing keys are substituted with defaults, unknown keys are ignored. See [Desktop.sccprofile](../default_profiles/Desktop.sccprofile) for example. Root dictonary has to contain following keys: - `buttons` - contains subkey for controller buttons. See [buttons](#buttons). - `pad_left` - sets action executed when finger is moved on left touchpad. - `pad_right` - ... when finger is moved on right touchpad. - `stick` - ... when stick angle is changed. - `trigger_left` - ... when left trigger value is changed. - `trigger_right` - ... when right trigger value is changed. - `gyro` - ... when gyroscope reading changes. Gyroscope in is activated only if this key is set to something else than `NoAction` - `menus` - stores menus saved in profile. See [menus](#menus). - `version` - profile file version. Current version is _1_. See If not pressent, _0_ is assumed. If profile file version is lower than expected, automatic conversion may happen. This conversion is in-memory only, but changing and saving such profile in GUI will save converted data. See [actions.md](actions.md) file for list of possible actions. ## Action definition Action definition is dictionary containing `action` key and optional `name` key. Value assigned to `action` describes action to be executed. `action` key can describe entire action, but for better readability, it is also possible to specify additional properties using [additional keys](#Additional_keys). For example, { "trigger_left": { "action": "axis(Axes.ABS_Z)", "name": "Aim", }} assigns `axis` action with *Axes.ABS_Z* parameter to left trigger. ## Additional keys in action definition #### `X` and `Y` Turns action into `XYAction`, allowing to specify different action for each pad or stick axis. If either of keys is specified, `action` key is ignored. Example: "stick" : { "X": { "action": "axis(Axes.ABS_RX)" }, "Y": { "action": "raxis(Axes.ABS_RY)" } }, is same as `"stick" : { "action" : "XY(axis(Axes.ABS_RX), raxis(Axes.ABS_RY))" }` #### `levels` Turns action into `TriggerAction`, allowing to specify lower and upper trigger levels among which is action executed. Example: "trigger_left": { "action": "button(BTN_LEFT)", "levels": [127, 255] }, Sets action that presses left mouse button, but only if trigger is roughly half-pressed. #### `dpad` Turns action into `DPadAction`, allowing to assign different action for each side of pad or stick alignment. Example: "dpad" : [ { "action": "button(Keys.KEY_UP)" }, { "action": "button(Keys.KEY_DOWN)" }, { "action": "button(Keys.KEY_LEFT)" }, { "action": "button(Keys.KEY_RIGHT)" } ], #### `ring` Defines outer and inner ring bindings. Expects keys with 'inner' and 'outer' actions and 'radius' as float value, but all keys are optional. Example: "pad_left": { "ring": { "inner": { "action": "XY(axis(Axes.ABS_X), raxis(Axes.ABS_Y))" }, "outer": { "action": "XY(axis(Axes.ABS_RX), raxis(Axes.ABS_RY))" }, "radius": 0.4 } }, defines inner ring binding controlling left stick and outer ring right stick of emulated gamepad. #### `tilt` Turns action into `TiltAction`, allowing to assign different action for tilting dpad. Works pretty-much as `dpad` on gyro. Example: "tilt" : [ { "action": "button(Keys.KEY_UP)" }, { "action": "button(Keys.KEY_DOWN)" }, { "action": "button(Keys.KEY_LEFT)" }, { "action": "button(Keys.KEY_RIGHT)" } ], #### `deadzone` Specifies deadzone. Allows for `lower` and `upper` subkeys defaulting to *0* and *32767* and `mode` subkey defaulting to 'CUT'. See see [deadzone modifier](actions.md#deadzone) for list of modes. Example: "trigger_left": { "mode" : "linear", "action": "axis(Axes.ABS_Z)", "deadzone": { "lower": 100, "upper": 200 }}, #### `sensitivity` Specifies input sensitivity. Value is list with one or two values for sensitivity over X and Y axis (or one value for sensitivity of trigger.) Default sensitivity is 1.0 Example: "stick" : { "action": "trackball()", "sensitivity": [2.0, 0.5] }, doubles sensitivity over X and halves over Y axis. #### `rotate` Rotates input pad or stick input by given angle. Example: "stick" : { "action": "trackball()", "rotate": 15 }, #### `feedback` Enables haptic feedback for action. Value is list with one to three values specifying feedback position (*'LEFT'*, *'RIGHT'* or *'BOTH'*), amplitude and frequency. Example: "pad_left": { "action": "trackball()", "feedback": ["LEFT", 512.0, 5.0] }, specifies feedback with amplitude of 512 (default vlaue) and frequency of 5 generated by left motor. #### `smooth` Enables input smoothing (see [smooth modifier](actions.md#smooth)) Example: "pad_left": { "action": "trackball()", "smooth": [ 8, 0.7, 2.0 ] }, enables smoothing with buffer of 8 and modifier set to 0.7. #### `osd` If set to True, enables OSD for action. Example: "X": { "action": "button(Keys.BTN_EAST)", "osd": true }, enables OSD feedback for X button. #### `click` If set to True, enables 'click' modifier, making action executed only when pad or stick is pressed. Example: "pad_left": { "action": "mouse()", "click": True }, #### `ball` If set to value, enables trackball mode. Value is list with zero to two values specifying friction and mass of virtual 'spinning ball'. See [ball modifier](actions.md#ball) for more info. Example: "pad_left": { "action": "mouse()", "ball": [ 10.0 ] }, #### `circular` Designed to controls scroll wheel by scrolling finger around pad, but can be used with any axis. Example: "pad_left": { "action": "mouse(Rels.REL_WHEEL)", "circular": true }, #### `circularabs` Works as to `circular`, but instead of counting with finger movements, translates exact position on dpad to axis value. Example: "pad_left": { "action": "circularabs(Rels.REL_WHEEL)", "circular": true }, #### `modes` Defines mode shifting (see [mode modifier](actions.md#mode)). Value is dict with physical key names (A, B, X, Y...) as keys and actions for each mode as values. Action on same level as `mode` is used as default action. Example: "modes": { "A": { "action": "mouse()" }, "B": { "action": "XY( axis(Axes.ABS_X), raxis(Axes.ABS_Y) )" } }, defines pad or stick that controls mouse while button A is pressed and left virtual stick while button B is pressed. #### `gestures` Enables gesture cognition on pad (see [gestures modifier](actions.md#gestures)). Value is dict with encoded gestures (see [description in actions.md](actions.md#gesture_format)) and actions for each gesture as values. Example: "gestures": { "UD": { "action": "button(Key.R)" } }, enables gesture recognition with single gesture activated when user does short stroke up followed by short stroke down. #### `doubleclick` Defines action that is executed when user double-clicks with button. Optional `time` key can be used on same level as `doubleclick` to modify double-click time. Example: "buttons": { "A": { "action": "button(KEY_X)", "doubleclick": { "action": "button(KEY_Z)" }, "time": 5 } } defines button that emulates pressing X key when pressed normally and pressing Z key when doubleclicked. #### `hold` Defines action that is executed when user holds button for short time. Optional `time` key can be used on same level as `hold` to modify double-click time. Example: "buttons": { "A": { "action": "button(KEY_X)", "hold": { "action": "button(KEY_Z)" }, "time": 5 } } defines button that emulates pressing X key when pressed normally and pressing Z key when held for 5 seconds. ## Buttons `buttons` is dictionary with keys for each gamepad button. Possible keys are: - `X`, `Y`, `A` and `B` for colored buttons - `C` for Steam button in center - `SELECT` and `START` for small "( < )" and "( > )" buttons - `LB` and `RB` for left and right bumper - `LPAD`, `RPAD` and `STICK` for presing pads or stick. All keys are optional. Value for each key is [action definition](#Action_definition) Example: "buttons": { "A": { "action": "button(Keys.BTN_WEST)", }, "B": { "action": "osd('Hello world!')" }, "BACK": { "action": "button(Keys.KEY_LEFTCTRL) and button(Keys.KEY_A)" }, } ## Menus `menus` is dictionary with menus stored along with profile. Keys are IDs of menus; Menu ID can contain any characters but dots (".") and slashes ("/"). Value for each key is same as root list in [menu file](menu-file.md) C0rn3j-sc-controller-f3b142b/docs/protocol.md000077500000000000000000000240351522611447500210730ustar00rootroot00000000000000SCCDaemon Protocol specification -------------------------------- To control running daemon instance, unix socket in user directory is used. Controlling protocol uses case-sensitive messages terminated by newline. Message type and message arguments are delimited by `:`. When new connection is accepted, daemon sends some info: ``` SCCDaemon Version: 0.2.6 PID: 123456 Current profile: filename.sccprofile Ready. ``` Connection is then held until client side closes it. ### Messages sent by daemon: #### `Controller Count: n` Informs about total number of connected controllers. Always sent after `Controller:` messages #### `Controller: controller_id type flags config_file` Provides info about controller 'n'. - `controller_id` is unique string identifier of controller (should stay same at least until daemon exits) and doesn't contains spaces. - `type` is string identifier (without spaces) of driver. - `flags` describes controller features, such as having central touchpad. See ControllerFlags definition in scc/constants.py for more info. - `config_file` is None or file name of json-encoded file that can GUI use to get additional data about controller (background image, button images, etc) File name may be absolute path or just name of file in /usr/share/scc This message is repeated for every connected controller and followed by `Controller Count:` message. It is automatically sent to every client when number of connected controllers changes. It is also sent automatically to every new client. #### `Controller profile: controller_id filename.sccprofile` Sent to every client when profile file for any controller is loaded and used. Also sent automatically to every new client. #### `Current profile: filename.sccprofile` Similar to `Controller profile:`, sent to every client when profile file for first controller is loaded and used. Also sent automatically to every new client. Unlike `Controller profile:`, this message is sent even if there is no controller connected. #### `Event: source values` Sent to client that requested locking of source (that is button, pad or axis). List of possible events: - `Event: B 1` - Sent when button is pressed. *B* is button, is one of *SCButtons.\** constants. - `Event: B 0` - Sent when button is released. *B* is button one of *SCButtons.\** constants. - `Event: STICK x y` - Sent when stick position is changed. *x* and *y* are new values. - `Event: LEFT x y` - Sent when finger on left pad is moved. *x* and *y* is new position. - `Event: RIGHT x y` - Sent when finger on right pad is moved. *x* and *y* is new position. #### `Error: message` Sent to every client when error is detected. May be sent repeatedly to indicate multiple errors. After all error conditions are cleared, `Ready.` is sent to indicate that emulation works again. #### `Fail: text` Indicates error as response to client's request. #### `Gesture: side gesturestring` Sent to client that requested gesture to be detected. #### `OK.` Indicates sucess as response to client's request. ### `OSD: tool param1 param2...` Send to scc-osd-daemon when osd-related action is requested. *tool* can be *'message'*, *'menu'*, *'hmenu'*, *'gridmenu'*,*'radialmenu'* or *'gesture'* *params* are same as command-line arguments for scc-osd-* script with that name. #### `PID: xyz` Reports PID of *scc-daemon* instance. Automatically sent when connection is accepted. #### `Ready.` Automatically sent when connection is accepted to indicate that there is no error and daemon is working as expected. #### `Reconfigured.` Sent to all clients when daemon receives `Reconfigure.` message. #### `SCCDaemon` Just identification message, automatically sent when connection is accepted. Can be either ignored or used to check if remote side really is *scc-daemon*. #### `State: ....` Sent to client as response to `State.` message. String after colon describes current state of controller (such as pressed buttons and stick position...) and is device-specific. #### `Version: x.y.z` Identifies daemon version. Automatically sent when connection is accepted. ## Commands sent from client #### `Controller: controller_id` By default, all messages sent from client are related to first connected controller. This message changes which controller are following messages meant for. If controller with specified controller_id is known, daemon responds with `OK.` Otherwise, `Fail: no such controller` error message is sent. #### `Controller.` Restores default state after controller is chosen. Daemon responds with `OK.` #### `Gesture: side up_angle` Requests gesture to be detected on one of pads. 'side' can be LEFT or RIGHT. 'up_angle' is angle in radians and sets how much should be gesture input rotated. Daemon always responds with `OK.` unless request cannot be parsed. Then, when gesture detection is completed, daemon sends `Gesture: side detectedgesture` message. If gesture detection fails for any reason, sent gesture is empty. #### `Led: brightness` Sets brightness of controller led. 'Brightness' is percent in 0 to 100 range. Daemon responds with `OK.`, unless 'brightness' cannot be parsed, in which case `Fail: ...` with error message is sent. #### `Lock: button1 button2...` Locks physical button, axis or pad. Events from locked sources are not processed normally, but sent to client that initiated lock. Only one client can have one source locked at one time. Second attempt to lock already locked source will fail and `Fail: cannot lock