diff --git a/app/cert.pem b/app/cert.pem new file mode 100644 index 0000000..d792301 --- /dev/null +++ b/app/cert.pem @@ -0,0 +1,33 @@ +-----BEGIN CERTIFICATE----- +MIIFrTCCA5WgAwIBAgIUHsyQLF3lmVlsJSQ1m5siRIfpK40wDQYJKoZIhvcNAQEL +BQAwZjELMAkGA1UEBhMCREUxEDAOBgNVBAgMB0JhdmFyaWExEDAOBgNVBAcMB0tv +ZWRpdHoxHDAaBgNVBAoME2luZm9AbGFuZy1kaWV0ZXIuZGUxFTATBgNVBAMMDHJh +c3BpLUFGVVVTQjAeFw0yNjA4MDMxMjAxNTFaFw0yNzA4MDMxMjAxNTFaMGYxCzAJ +BgNVBAYTAkRFMRAwDgYDVQQIDAdCYXZhcmlhMRAwDgYDVQQHDAdLb2VkaXR6MRww +GgYDVQQKDBNpbmZvQGxhbmctZGlldGVyLmRlMRUwEwYDVQQDDAxyYXNwaS1BRlVV +U0IwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDFf9zqSYZdH+PWJJ2O +DUzrTYSZ8rnk8/CtGds4E//fxmOwQdycN5T/pf1XzqEdlDKC28bbCZxYfUdlIFm/ +1bqUpArj5FiSCPUJiCayVBt20NkXfU9wXrqsgy4LzcUWBc2oIDfy937BJ5Bcid6M +8GeOzjzOVNlSGOkD+XrdrI8+Cf37aCRdA84sIpYScUz0mQYzWsrFipIW0osLhgZW +aBqJ1gWxWmAH7lT6iHXOirsou1ScUmPiKhcUfP8JRliQpRSv1fkLHTMnvHUqXNjJ +jVOgIJrtGSVPLOzNsb9fUjm336573iBhc0Y0UsYXX9GHiXueQVU9+OBSBVueoSIq +ZmaWsZlOyKR6NRfZgvdubX9+WeoLstjKOXRCPc4ePuevpt0ygPbVR+Dgc1Mr5JXr +EnfpPJholrenujlGhxA+uRIz169OLDJGat18O9mVfOA4OK9qTHbLE8Ymhvziwtjw +9MY2SMwKPMs2dTqsOe0WZIxUn5Y0A7CLYzBJDRDJpYvLRFYmXpVVHq1xbVYHxYbl +R1ot3eyO7oYF5wNooWa7d8o/w7pvMYR9a6lAubZN6ahcAFfsVti5KBIsGPlaQjQl +SdR3I5vQ+ODRv3QxID4nQNBYJuae6isNyA0q5j4hto5u3CzMv797eCwNWOj1SMye +tcIrw/JUyx+BKG6dIOb/Ailg2QIDAQABo1MwUTAdBgNVHQ4EFgQU12eIgmzTNg9E +PgYvVPdkmgRYJvEwHwYDVR0jBBgwFoAU12eIgmzTNg9EPgYvVPdkmgRYJvEwDwYD +VR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAgEAdPRMgIVdS9uuk9WC+12K +eHtV4yCz7dN0+I+B3L2mbZdcgoUc5TeTkJJYdRUB/5jMLJwWQ7IALBqhkUEEKOpe +gi86/tGEsM9LPVlnw1mcTo9rFxiblwGMcMsSHImEgUaFeswg31olqsZSz3RLQ3XU +uCiijVqaL36xEJ0Qg/9kwqnslFCpmQa0yn3wk4Wb7ozKJS1LymSTfFRi/ifekbEM +QCpMeJjK7u5IJh77+OYdb1ldKuER6BKsqMhHpFQbHA/5Wj3nA20ohw32FuRCn4GY +Z8T/K9pPKpinFQGl62sw8iv+1o4HRQNRFgIxEkECTgRF7PpQMqz2J28BSQ6EMxxo +upheBd8Yl0CedJhtqkdcDW+s0yLBaWNndqwoIwwz/owQ9NqP/+/XNkK3N+fR8TEX +MRmQlqGgU7JSxA9dmMJh+lithJalzmAPEkQ6IvYCVL1TjOHJAvTV6Rx+Fvz0rtBv +v/JuxhBXCde+3UH6EGijFL8HmnJ1XaT3FOw0vNpvda2KOfwoEROQX7O5X3hIgdm5 +zLMcrYgh0GFDvyMJyC4+UjlOyXCjoOeC2CCsoiGIce+sjRNOlY8yoMaW7Knz09nh +X9DOXbvvDyQznzoucQswna+vvzG3lzlKQa7MtC+yexikHzxhJ2DU1DDIf33di5YI +J0HYcdOoOhgy9L52nIAypBw= +-----END CERTIFICATE----- diff --git a/app/config.json b/app/config.json new file mode 100644 index 0000000..7eba38f --- /dev/null +++ b/app/config.json @@ -0,0 +1,29 @@ +{ + "web_port": ":8080", + "ssl_cert": "cert.pem", + "ssl_key": "key.pem", + "i2c_bus": "1", + "ads1115_address_1": 72, + "ads1115_address_2": 73, + "name_adc1_ch0": "23cm", + "factor_adc1_ch0": 2.0, + "name_adc1_ch1": "13 cm", + "factor_adc1_ch1": 2.0, + "name_adc1_ch2": "9 cm", + "factor_adc1_ch2": 2.0, + "name_adc1_ch3": "6 cm", + "factor_adc1_ch3": 2.0, + "name_adc2_ch0": "3 cm", + "factor_adc2_ch0": 2.0, + "relais_pins": [ + {"id": 1, "name": "Relais 1 (230V Hauptschalter)", "gpio": "GPIO12"}, + {"id": 2, "name": "USB-Relais 1 (Reserve)", "gpio": "USB_CH1"}, + {"id": 3, "name": "USB-Relais 2 23 cm", "gpio": "USB_CH2"}, + {"id": 4, "name": "USB-Relais 3 13 cm", "gpio": "USB_CH3"}, + {"id": 5, "name": "USB-Relais 4 9 cm", "gpio": "USB_CH4"}, + {"id": 6, "name": "USB-Relais 5 6 cm", "gpio": "USB_CH5"}, + {"id": 7, "name": "USB-Relais 6 3 cm", "gpio": "USB_CH6"}, + {"id": 8, "name": "USB-Relais 7 (Reserve)", "gpio": "USB_CH7"}, + {"id": 9, "name": "USB-Relais 8 (Reserve)", "gpio": "USB_CH8"} + ] +} diff --git a/app/install.sh b/app/install.sh new file mode 100755 index 0000000..b31cfbc --- /dev/null +++ b/app/install.sh @@ -0,0 +1,36 @@ +#!/bin/bash +set -e + +echo "🚀 Starte automatische Einrichtung des Spannung-Monitors..." + +# Pfade und Benutzer auf dem aktuellen Pi ermitteln +PI_DIR=$(pwd) +PI_USER=$(whoami) + +# Architektur des Betriebssystems prüfen +ARCH=$(uname -m) +if [ "$ARCH" = "aarch64" ]; then + BINARY="spannung-arm64" + echo "🎯 64-Bit OS erkannt. Nutze: $BINARY" +else + BINARY="spannung-arm32_7" + echo "🎯 32-Bit OS erkannt. Nutze: $BINARY" +fi + +# Platzhalter in der Service-Datei direkt auf dem Pi ersetzen +sed -i "s|{{TARGET_DIR}}|$PI_DIR|g" spannung.service +sed -i "s|{{TARGET_USER}}|$PI_USER|g" spannung.service +sed -i "s|{{BINARY}}|$BINARY|g" spannung.service + +echo "📝 Service-Datei wurde erfolgreich für dieser Pi konfiguriert." + +# Service in das Systemverzeichnis kopieren und aktivieren +echo "⚙️ Kopiere Service-Datei nach /etc/systemd/system/..." +sudo cp spannung.service /etc/systemd/system/spannung.service +sudo systemctl daemon-reload +sudo systemctl enable spannung.service + +echo "▶️ Starte den Dienst..." +sudo systemctl restart spannung.service + +echo "✅ Fertig! Der Spannung-Monitor läuft und der Autostart ist aktiv." diff --git a/app/key.pem b/app/key.pem new file mode 100644 index 0000000..187827e --- /dev/null +++ b/app/key.pem @@ -0,0 +1,52 @@ +-----BEGIN PRIVATE KEY----- +MIIJQgIBADANBgkqhkiG9w0BAQEFAASCCSwwggkoAgEAAoICAQDFf9zqSYZdH+PW +JJ2ODUzrTYSZ8rnk8/CtGds4E//fxmOwQdycN5T/pf1XzqEdlDKC28bbCZxYfUdl +IFm/1bqUpArj5FiSCPUJiCayVBt20NkXfU9wXrqsgy4LzcUWBc2oIDfy937BJ5Bc +id6M8GeOzjzOVNlSGOkD+XrdrI8+Cf37aCRdA84sIpYScUz0mQYzWsrFipIW0osL +hgZWaBqJ1gWxWmAH7lT6iHXOirsou1ScUmPiKhcUfP8JRliQpRSv1fkLHTMnvHUq +XNjJjVOgIJrtGSVPLOzNsb9fUjm336573iBhc0Y0UsYXX9GHiXueQVU9+OBSBVue +oSIqZmaWsZlOyKR6NRfZgvdubX9+WeoLstjKOXRCPc4ePuevpt0ygPbVR+Dgc1Mr +5JXrEnfpPJholrenujlGhxA+uRIz169OLDJGat18O9mVfOA4OK9qTHbLE8Ymhvzi +wtjw9MY2SMwKPMs2dTqsOe0WZIxUn5Y0A7CLYzBJDRDJpYvLRFYmXpVVHq1xbVYH +xYblR1ot3eyO7oYF5wNooWa7d8o/w7pvMYR9a6lAubZN6ahcAFfsVti5KBIsGPla +QjQlSdR3I5vQ+ODRv3QxID4nQNBYJuae6isNyA0q5j4hto5u3CzMv797eCwNWOj1 +SMyetcIrw/JUyx+BKG6dIOb/Ailg2QIDAQABAoICAAfbm/8IWNu4qph5EXm25sIP +7gAwC5xj5kYE2teC2DHfk1TOcggXIAsB4DAPrRJftJjHRMSvP7S3m1EXNervhoJm +enZxveJlj9ZGv/9lYEhca97G4hO++R9nArx+feJv7axMR92XYkguGkzMQXoLEJu6 +cenlr1XYXuEFGpHaTUKzJBNOI/A9eAUChUULk/vBYOFHMf0lE8Xrr5OQTA1BDBlC +1iwlw99c6K2lI0bJ90NaHLYxgv7bHNr4VC9ayKhMoSOT2FpMWZ4xndnHIur2AAdF +dNSNJRJe37cZZNtWiqxZrngIMPKfowHu7ym76rrBShVUVR9nmQk6ZFhN4e2c8GTp +m/re2U10Hv4+sFGDQk4s0HbmOwp2I1LUDEfXQy47edIKaP3Q7uTgpGEr/KAk6WWE +DqfDAbu4XAJOiUYSMxyHqvJ/7IavB9Rcy49xeO1dEMELm3+SIlAWRzOLRp89FYn9 +iAZQJaotGriJ71mjCbx8n44Ke1/mR6hQvT4w81h1n1PW+S5abPBYnibzA2A0wsgO +yFKubY9tXo2pBokpceWWIo6WhClzywBGcdNrwGPdvq70ijgXtgoeVVcMXuH1bsYN +bFuodCVvcdY+8ZbPMSG9Hm182t+7vf2GhS6K84t3Tm8krIJq/BWNd/ng8z1ojBnc +/l2ureNLqusHsLNKANJnAoIBAQDkNfSixbZ5zC2RkqibTF5zqVKbXao5usKI+4I2 ++CKOzbzxBf/p0liDB5Gi5TCzfBkxJYssvVDG3P7BAOTQPAlJwLeZ286GKDZcU8ol +C5YT7c7bYzORfHGzUDWTwu6jGHJa1NWb9bZFnIs/pcGvwRP28akmWGXUe5JjHHlj +hyQB2xXaF3Fc+N5ZmsS/pZsP44WjGYd78FsZ+T5s2NyJqvzFsVAcf+KgudKOutbG +NNXsztC3f+eWvreB4MhyhajHQakPWUVvqUboUieQKz2OXNFcRrzWJrp7d90i0iwm +UIytLHVyG7Z2ugaPUZc0fRL9Sc0c2zpiWRNFjLwqxLGp25jHAoIBAQDdjIo5GJxr +L/MOJ1eoS6BnMkUTKr9GlNUiVHYUsmL1ynzBd/QnWc2kR7GWSnZg/gdfbGcka0WD +zrDef5uLWlc/SxrUmwkLY5lcj3EEDFEMizSdDl7x+ikDEPuuA6X2S+xfQxBJEJKE +2LorbYPkUyECkevpCSyDT8bfmmOUe/9538yZAkzYmfEHNsN5HAcyT3Pk+qXI3BNF +A/oKg710CBapZE6kbpdcZBvNNkmTfcWVnfN+ou4k+SXpqwOg23gDEOqhNCdpn20I +yNLZk5mOU9JdPM+LOA6Diobm8SHHmxAYuYKjbr6GxXl0XqKqBWLNFjM/owoCUbKb +Cz3T2N3kfdlfAoIBAEX91l3lzaVlXcR7+oJG1eEbWV6VR5QVF3zzxmgdilvJ9dzm +Pir0fHkTZTNUn68srH1KSnkaRx/2v5tqLsM+5opcNPNXWuwCgUmn2SOrfgf2s67N +qg9A345jV0tOSepzoP8Cr9D5d0G6VWrb55+D1B+01nAQRIr6q1cCcKh51i1LiFQv +RHGDUo6gzR8KJ5ij62Sue8MjYI2CyAaSLHF8o7HuQ+e5wUQSOeXUn/KCWeobNCBT +di/hpl6LFm8pVy5lkPhIJOeuPzUZnVC2MlbrWLq4Z0o27pLXnFcFpszJf5vNOugY +X8niHAjwuTM7+Qr+C46CHlHzh9mY5E0prmOuGhkCggEAalZqgb0uVsRNBR4dFMo3 +01BtlyWNaXNGWZPwmT6GATOPbc0Fg123NoKy2lAjQaqsH0EIwJI8a2dpvWHCZsCV +3+tMlX9UeAL2OVcgB7FhtYObXUboi3xm8vHT21Ik9nK6oX6u8mLh8KGVugJ2q8C6 +t2ESumeM1foUmn6gDUT2+qhQq6BPAifhaHUAncC2M4+vMNideisnlJi0CxfwdyDq +v6NFm+b4/3+NWJIV/pT/oTCPDtllNJnheKZ8t1if4djcxUMjJ689xlmd2pDdw1K4 +RchKVagyTzDOT0qtzADBWRyxd4BQMp/WC+TgbnrnUUi2kHTQ+Qv9ji13H5eX6XP+ +QQKCAQEAv/nXQ8ObmbsD1ME4k0tIbVjDl1eo1VedXp0LPJZoPLZsNR+z6OK+vyJr +oylPcOkQDDF+aC9DfFUoiCWAXTQcOSq9FdlbB3c5pY5GdB28+WDcjgZtXkZnBEg7 +sX1Vow/RMKUkF0y2aZcgpVEU4Zzty1SiawikWpAm8M+vCMEqrbI7JGd2mk+LWFkS +6luqb4CoHrZaAHd5jzymxV1nD02oUfKSWaBKDhG/U1NVCpMFFbjLLBHgI4pIbIRY +vbfGnFVr9ZCRxW0XjYo87RnjHDZ9jM6P9OYLYLHU8eFNUQREt8tQb5+01vnu+j7E +wMZJGy1YoqzobW46COzNkMTgm3Y2tQ== +-----END PRIVATE KEY----- diff --git a/app/spannung-arm32_7 b/app/spannung-arm32_7 new file mode 100755 index 0000000..c7812c4 Binary files /dev/null and b/app/spannung-arm32_7 differ diff --git a/app/spannung-arm64 b/app/spannung-arm64 new file mode 100755 index 0000000..b8668b0 Binary files /dev/null and b/app/spannung-arm64 differ diff --git a/app/spannung.service b/app/spannung.service new file mode 100644 index 0000000..8aa1b56 --- /dev/null +++ b/app/spannung.service @@ -0,0 +1,26 @@ +[Unit] +Description=Spannung Control Service +After=network-online.target i2c.service +Wants=network-online.target +StartLimitIntervalSec=60s +StartLimitBurst=3 + +[Service] +Type=simple +# Vorprüfung ALS ROOT ausführen +ExecStartPre=/bin/bash -c 'for i in {1..5}; do /usr/sbin/i2cdetect -y 1 | grep -q 48 && /usr/sbin/i2cdetect -y 1 | grep -q 49 && exit 0; sleep 2; done; exit 1' + +ExecStart={{TARGET_DIR}}/{{BINARY}} +WorkingDirectory={{TARGET_DIR}} +User={{TARGET_USER}} +Restart=on-failure +RestartSec=5s + +# KORREKTUR: Verhindert, dass STRG+C über SSH den Dienst beim Beenden des Logs killt +KillMode=process + +StandardOutput=append:{{TARGET_DIR}}/spannung.log +StandardError=append:{{TARGET_DIR}}/spannung.log + +[Install] +WantedBy=multi-user.target diff --git a/app/version.json b/app/version.json new file mode 100644 index 0000000..60983ec --- /dev/null +++ b/app/version.json @@ -0,0 +1,10 @@ +{ + "version": "0.2.2", + "build_date": "03.08.2026 um 14;01", + "description": "Messung von zwei Spannung und Steuerung von Relais", + "features": [ + "ADS1115-Abfrage über go-i2c", + "Weboberfläche mit Steuerbuttons für Reilais", + "Definiton der GPIO in der config.json" + ] +} diff --git a/app/web/server.go b/app/web/server.go new file mode 100644 index 0000000..294e0ce --- /dev/null +++ b/app/web/server.go @@ -0,0 +1,97 @@ +package web + +import ( + "encoding/json" + "html/template" + "net/http" + "strconv" +) + +type RelaisData struct { + ID int `json:"id"` + Name string `json:"name"` + State bool `json:"state"` +} + +type StatusResponse struct { + V1 float64 `json:"v1"` + V2 float64 `json:"v2"` + V3 float64 `json:"v3"` + V4 float64 `json:"v4"` + V5 float64 `json:"v5"` + Names []string `json:"names"` // Neu: Sendet die Namen als Array mit + Relais []RelaisData `json:"relais"` + Version string `json:"version"` + BuildDate string `json:"build_date"` +} + +type Server struct { + port string + readVoltFunc func(channel int) float64 + toggleFunc func(id int) + getRelais func() []RelaisData + versionFunc func() (string, string) + getNamesFunc func() []string // Neu hinzugefügt +} + +func NewServer(port string, readVolt func(int) float64, toggle func(int), getRelais func() []RelaisData, getVersion func() (string, string), getNames func() []string) *Server { + return &Server{ + port: port, + readVoltFunc: readVolt, + toggleFunc: toggle, + getRelais: getRelais, + versionFunc: getVersion, + getNamesFunc: getNames, // Neu hinzugefügt + } +} + +func (s *Server) Start(certFile, keyFile string) error { + http.HandleFunc("/", s.handleIndex) + http.HandleFunc("/api/status", s.handleAPIStatus) + http.HandleFunc("/api/toggle", s.handleAPIToggle) + return http.ListenAndServeTLS(s.port, certFile, keyFile, nil) +} + +func (s *Server) handleIndex(w http.ResponseWriter, r *http.Request) { + ver, date := s.versionFunc() + tmpl, err := template.ParseFiles("web/static/index.html") + if err != nil { + http.Error(w, "Template nicht gefunden: "+err.Error(), http.StatusInternalServerError) + return + } + + data := StatusResponse{ + Names: s.getNamesFunc(), // Namen für das erste Rendern bereitstellen + Relais: s.getRelais(), + Version: ver, + BuildDate: date, + } + tmpl.Execute(w, data) +} + +func (s *Server) handleAPIStatus(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json") + + ver, date := s.versionFunc() + resp := StatusResponse{ + V1: s.readVoltFunc(0), + V2: s.readVoltFunc(1), + V3: s.readVoltFunc(2), + V4: s.readVoltFunc(3), + V5: s.readVoltFunc(4), + Names: s.getNamesFunc(), + Relais: s.getRelais(), + Version: ver, + BuildDate: date, + } + json.NewEncoder(w).Encode(resp) +} + +func (s *Server) handleAPIToggle(w http.ResponseWriter, r *http.Request) { + idStr := r.URL.Query().Get("id") + id, err := strconv.Atoi(idStr) + if err == nil { + s.toggleFunc(id) + } + s.handleAPIStatus(w, r) +} diff --git a/app/web/static/index.html b/app/web/static/index.html new file mode 100644 index 0000000..d853e75 --- /dev/null +++ b/app/web/static/index.html @@ -0,0 +1,148 @@ + + + + Funkstation Steuerung + + + + +
+

Funkstations-Monitor

+ +
+ +
+
+

Relaissteuerung

+
+ {{range .Relais}} + + {{end}} +
+
+
+ + +
+
+

{{index .Names 0}}

+
--.-- V
+
+ +
+

{{index .Names 1}}

+
--.-- V
+
+ +
+

{{index .Names 2}}

+
--.-- V
+
+ +
+

{{index .Names 3}}

+
--.-- V
+
+ +
+

{{index .Names 4}}

+
--.-- V
+
+
+
+ + +
+ + + + diff --git a/build.sh b/build.sh index 20722b6..d821710 100755 --- a/build.sh +++ b/build.sh @@ -14,7 +14,7 @@ else DATE=$(date +'%Y-%m-%d') fi -echo "🔧 Baue Spannung-Monitor v$VERSION ($DATE) für Raspberry Pi 3 & 4" +echo "🔧 Baue Spannung-Monitor $VERSION ($DATE) für Raspberry Pi 3 & 4" # KORREKTUR: Einfache Anführungszeichen fangen die Leerzeichen für den Go-Linker ab LDFLAGS="-X 'main.Version=$VERSION' -X 'main.BuildDate=$DATE'" @@ -25,14 +25,22 @@ mkdir app # --- BUILD-PROZESS MIT CGO --- +# Definiere die Pfade zu den lokalen sysroots +SYSROOT_64="$USER_HOME/spannung/sysroot-arm64" +SYSROOT_32="$USER_HOME/spannung/sysroot-arm32" + # 1. Für 64-Bit Raspberry Pi (Standard bei Pi 4 und neueren Pi 3 OS) echo "📦 Kompiliere für ARM64 (64-Bit)..." -CGO_ENABLED=1 GOOS=linux GOARCH=arm64 CC=aarch64-linux-gnu-gcc go build -ldflags "$LDFLAGS" -o ./app/spannung-arm64 . +CGO_LDFLAGS="-L$SYSROOT_64/lib/aarch64-linux-gnu -L$SYSROOT_64/usr/lib/aarch64-linux-gnu -Wl,-rpath-link=$SYSROOT_64/lib/aarch64-linux-gnu -Wl,-rpath-link=$SYSROOT_64/usr/lib/aarch64-linux-gnu" \ +CGO_ENABLED=1 GOOS=linux GOARCH=arm64 CC=aarch64-linux-gnu-gcc \ +go build -ldflags "$LDFLAGS" -o ./app/spannung-arm64 . echo "✅ Fertig gebaut: ./app/spannung-arm64" # 2. Für 32-Bit Raspberry Pi (Klassisch für Pi 3 / ältere OS) echo "📦 Kompiliere für ARM32 v7 (32-Bit)..." -CGO_ENABLED=1 GOOS=linux GOARCH=arm GOARM=7 CC=arm-linux-gnueabihf-gcc go build -ldflags "$LDFLAGS" -o ./app/spannung-arm32_7 . +CGO_LDFLAGS="-L$SYSROOT_32/lib/arm-linux-gnueabihf -L$SYSROOT_32/usr/lib/arm-linux-gnueabihf -Wl,-rpath-link=$SYSROOT_32/lib/arm-linux-gnueabihf -Wl,-rpath-link=$SYSROOT_32/usr/lib/arm-linux-gnueabihf" \ +CGO_ENABLED=1 GOOS=linux GOARCH=arm GOARM=7 CC=arm-linux-gnueabihf-gcc \ +go build -ldflags "$LDFLAGS" -o ./app/spannung-arm32_7 . echo "✅ Fertig gebaut: ./app/spannung-arm32_7" # Dateiberechtigungen im Zielordner setzen @@ -43,43 +51,79 @@ cp config.json ./app/ cp version.json ./app/ cp web ./app/ -r -# 3. Die Service-Datei generieren -# Ein kleiner Bash-Wrapper in ExecStart sorgt dafür, dass automatisch das richtige Binary gestartet wird! +# 3. Die Service-Datei mit Platzhaltern generieren cat << 'EOF' > ./app/spannung.service -# ============================================================================== -# KURZANLEITUNG ZUR INSTALLATION UND VERWALTUNG -# ============================================================================== -# 1. Datei kopieren nach: /etc/systemd/system/spannung.service -# 2. Systemd neu laden: sudo systemctl daemon-reload -# 3. Autostart aktivieren: sudo systemctl enable spannung.service -# 4. Dienst starten: sudo systemctl start spannung.service -# ============================================================================== [Unit] Description=Spannung Control Service After=network-online.target i2c.service Wants=network-online.target -StartLimitIntervalSec=0 - -[Service] -Type=simple -ExecStartPre=/bin/bash -c 'for i in {1..10}; do i2cdetect -y 1 | grep -E "40:" | grep -q -E "\b48\b" && i2cdetect -y 1 | grep -E "40:" | grep -q -E "\b49\b" && exit 0; echo "warte auf ADS1115 Module..."; sleep 2; done; exit 1' - -# Direkt der Pfad zur nativ gebauten Binärdatei ohne Bash-Weiche -ExecStart=TARGET_DIR/spannung-aktiv -WorkingDirectory=TARGET_DIR -User=TARGET_USER -Restart=on-failure -RestartSec=5s StartLimitIntervalSec=60s StartLimitBurst=3 -StandardOutput=append:TARGET_DIR/spannung.log -StandardError=append:TARGET_DIR/spannung.log +[Service] +Type=simple +# Vorprüfung ALS ROOT ausführen +ExecStartPre=/bin/bash -c 'for i in {1..5}; do /usr/sbin/i2cdetect -y 1 | grep -q 48 && /usr/sbin/i2cdetect -y 1 | grep -q 49 && exit 0; sleep 2; done; exit 1' + +ExecStart={{TARGET_DIR}}/{{BINARY}} +WorkingDirectory={{TARGET_DIR}} +User={{TARGET_USER}} +Restart=on-failure +RestartSec=5s + +# KORREKTUR: Verhindert, dass STRG+C über SSH den Dienst beim Beenden des Logs killt +KillMode=process + +StandardOutput=append:{{TARGET_DIR}}/spannung.log +StandardError=append:{{TARGET_DIR}}/spannung.log [Install] WantedBy=multi-user.target EOF -echo "📝 Service-Datei mit automatischer Architektur-Erkennung generiert" + +# 4. Ein automatisches Installations-Skript für den Pi im app-Ordner erstellen +cat << 'EOF' > ./app/install.sh +#!/bin/bash +set -e + +echo "🚀 Starte automatische Einrichtung des Spannung-Monitors..." + +# Pfade und Benutzer auf dem aktuellen Pi ermitteln +PI_DIR=$(pwd) +PI_USER=$(whoami) + +# Architektur des Betriebssystems prüfen +ARCH=$(uname -m) +if [ "$ARCH" = "aarch64" ]; then + BINARY="spannung-arm64" + echo "🎯 64-Bit OS erkannt. Nutze: $BINARY" +else + BINARY="spannung-arm32_7" + echo "🎯 32-Bit OS erkannt. Nutze: $BINARY" +fi + +# Platzhalter in der Service-Datei direkt auf dem Pi ersetzen +sed -i "s|{{TARGET_DIR}}|$PI_DIR|g" spannung.service +sed -i "s|{{TARGET_USER}}|$PI_USER|g" spannung.service +sed -i "s|{{BINARY}}|$BINARY|g" spannung.service + +echo "📝 Service-Datei wurde erfolgreich für dieser Pi konfiguriert." + +# Service in das Systemverzeichnis kopieren und aktivieren +echo "⚙️ Kopiere Service-Datei nach /etc/systemd/system/..." +sudo cp spannung.service /etc/systemd/system/spannung.service +sudo systemctl daemon-reload +sudo systemctl enable spannung.service + +echo "▶️ Starte den Dienst..." +sudo systemctl restart spannung.service + +echo "✅ Fertig! Der Spannung-Monitor läuft und der Autostart ist aktiv." +EOF + +chmod +x ./app/install.sh + +echo "📝 Service-Datei und install.sh generiert." echo "📂 Inhalt des fertigen app-Verzeichnisses:" ls -la app diff --git a/config.json b/config.json index b0822d1..7eba38f 100644 --- a/config.json +++ b/config.json @@ -1,6 +1,8 @@ { "web_port": ":8080", - "i2c_bus": "1", + "ssl_cert": "cert.pem", + "ssl_key": "key.pem", + "i2c_bus": "1", "ads1115_address_1": 72, "ads1115_address_2": 73, "name_adc1_ch0": "23cm", diff --git a/deploy.sh b/deploy.sh index 88e4a41..7406c68 100755 --- a/deploy.sh +++ b/deploy.sh @@ -16,40 +16,37 @@ SERVICE_NAME="spannung.service" echo "🚀 Starte Deployment auf $PI_USER@$PI_HOST..." -# 1. Zielverzeichnis auf dem Pi erstellen -ssh "$PI_USER@$PI_HOST" "mkdir -p \"\$HOME/$TARGET_DIR\"" +# --- ZERTIFIKATE ERZEUGEN --- +# Prüfen, ob die Zertifikate bereits im lokalen app-Ordner existieren +if [ ! -f ./app/cert.pem ] || [ ! -f ./app/key.pem ]; then + echo "🔐 Generiere selbstsignierte SSL-Zertifikate für HTTPS..." + openssl req -x509 -newkey rsa:4096 -nodes \ + -keyout ./app/key.pem \ + -out ./app/cert.pem \ + -days 365 \ + -subj "/C=DE/ST=Bavaria/L=Koeditz/O=info@lang-dieter.de/CN=$PI_HOST" 2>/dev/null + echo "✅ SSL-Zertifikate lokal in ./app/ erstellt." +else + echo "🔒 Bestehende SSL-Zertifikate in ./app/ gefunden. Werden wiederverwendet." +fi -# 2. Quellcode, Webseiten und Service-Datei zum Pi kopieren -scp -r * "$PI_USER@$PI_HOST:$TARGET_DIR/" +# 1. Altes Zielverzeichnis auf dem Pi löschen und frisch erstellen +ssh "$PI_USER@$PI_HOST" "rm -rf \"\$HOME/$TARGET_DIR\" && mkdir -p \"\$HOME/$TARGET_DIR\"" -# 3. Build und Systemd-Setup direkt auf dem Pi ausführen +# 2. Den INHALT des lokal fertig gebauten 'app'-Ordners (inkl. Zertifikate) zum Pi kopieren +echo "📦 Übertrage vorkompilierte Anwendung, Webseiten und Zertifikate..." +scp -r ./app/* "$PI_USER@$PI_HOST:$TARGET_DIR/" + +# 3. Das Setup-Skript direkt auf dem Pi ausführen ssh -t "$PI_USER@$PI_HOST" " cd \${HOME}/${TARGET_DIR} - echo \"📦 Kompiliere Anwendung nativ auf dem Raspberry Pi...\" - # Korrigierter Go-Build für Modul-Projekte (.) - go build -o spannung-aktiv . - - REAL_PATH=\$(pwd) - REAL_USER=\$(whoami) - - echo \"🔧 Konfiguriere Systemd-Dienst...\" - - # Windows-Zeilenumbrüche entfernen + # Windows-Zeilenumbrüche zur Sicherheit entfernen + sed -i 's/\r//' ./install.sh sed -i 's/\r//' ./${SERVICE_NAME} - # Platzhalter durch reale Systemwerte ersetzen - sed -i \"s|TARGET_DIR|\$REAL_PATH|g\" ./${SERVICE_NAME} - sed -i \"s|TARGET_USER|\$REAL_USER|g\" ./${SERVICE_NAME} - - # ExecStart auf die neu gebaute Binärdatei umbiegen (Anführungszeichen korrigiert) - sed -i \"s|exec .*|exec \$REAL_PATH/spannung-aktiv'|g\" ./${SERVICE_NAME} - - # Service-Datei ins Systemverzeichnis kopieren und Dienst starten - sudo cp ./${SERVICE_NAME} /etc/systemd/system/ - sudo systemctl daemon-reload - sudo systemctl enable ${SERVICE_NAME} - sudo systemctl restart ${SERVICE_NAME} + # Das Installationsskript auf dem Pi ausführen + ./install.sh " echo "✅ Deployment erfolgreich abgeschlossen! Zeige Live-Logs (Beenden mit STRG+C)..." diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..a239eb7 --- /dev/null +++ b/install.sh @@ -0,0 +1,73 @@ +# 3. Die Service-Datei mit Platzhaltern generieren +cat << 'EOF' > ./app/spannung.service +[Unit] +Description=Spannung Control Service +After=network-online.target i2c.service +Wants=network-online.target +StartLimitIntervalSec=0 + +[Service] +Type=simple +ExecStartPre=/bin/bash -c 'for i in {1..10}; do i2cdetect -y 1 | grep -E "40:" | grep -q -E "\b48\b" && i2cdetect -y 1 | grep -E "40:" | grep -q -E "\b49\b" && exit 0; echo "warte auf ADS1115 Module..."; sleep 2; done; exit 1' + +# Diese Platzhalter werden beim Installieren auf dem Pi automatisch ersetzt: +ExecStart={{TARGET_DIR}}/{{BINARY}} +WorkingDirectory={{TARGET_DIR}} +User={{TARGET_USER}} +Restart=on-failure +RestartSec=5s +StartLimitIntervalSec=60s +StartLimitBurst=3 + +StandardOutput=append:{{TARGET_DIR}}/spannung.log +StandardError=append:{{TARGET_DIR}}/spannung.log + +[Install] +WantedBy=multi-user.target +EOF + +# 4. Ein automatisches Installations-Skript für den Pi im app-Ordner erstellen +cat << 'EOF' > ./app/install.sh +#!/bin/bash +set -e + +echo "🚀 Starte automatische Einrichtung des Spannung-Monitors..." + +# Pfade und Benutzer auf dem aktuellen Pi ermitteln +PI_DIR=$(pwd) +PI_USER=$(whoami) + +# Architektur des Betriebssystems prüfen +ARCH=$(uname -m) +if [ "$ARCH" = "aarch64" ]; then + BINARY="spannung-arm64" + echo "🎯 64-Bit OS erkannt. Nutze: $BINARY" +else + BINARY="spannung-arm32_7" + echo "🎯 32-Bit OS erkannt. Nutze: $BINARY" +fi + +# Platzhalter in der Service-Datei direkt auf dem Pi ersetzen +sed -i "s|{{TARGET_DIR}}|$PI_DIR|g" spannung.service +sed -i "s|{{TARGET_USER}}|$PI_USER|g" spannung.service +sed -i "s|{{BINARY}}|$BINARY|g" spannung.service + +echo "📝 Service-Datei wurde erfolgreich für diesen Pi konfiguriert." + +# Service in das Systemverzeichnis kopieren und aktivieren +echo "⚙️ Kopiere Service-Datei nach /etc/systemd/system/..." +sudo cp spannung.service /etc/systemd/system/spannung.service +sudo systemctl daemon-reload +sudo systemctl enable spannung.service + +echo "▶️ Starte den Dienst..." +sudo systemctl restart spannung.service + +echo "✅ Fertig! Der Spannung-Monitor läuft und der Autostart ist aktiv." +EOF + +chmod +x ./app/install.sh + +echo "📝 Service-Datei und install.sh generiert." +echo "📂 Inhalt des fertigen app-Verzeichnisses:" +ls -la app diff --git a/libudev1_255.4-1ubuntu8.5_arm64.deb.1 b/libudev1_255.4-1ubuntu8.5_arm64.deb.1 new file mode 100644 index 0000000..118a9ae Binary files /dev/null and b/libudev1_255.4-1ubuntu8.5_arm64.deb.1 differ diff --git a/main.go b/main.go index 10ba53e..aa95f69 100644 --- a/main.go +++ b/main.go @@ -23,6 +23,8 @@ import ( type Config struct { WebPort string `json:"web_port"` + SSLCert string `json:"ssl_cert"` + SSLKey string `json:"ssl_key"` I2CBus string `json:"i2c_bus"` ADS1115Address1 uint16 `json:"ads1115_address_1"` ADS1115Address2 uint16 `json:"ads1115_address_2"` @@ -136,10 +138,14 @@ func main() { }() // 9. Instanziierung des Webservers mit Übergabe der Callback-Funktionen - server := web.NewServer(config.WebPort, readVoltageCallback, toggleRelaisCallback, getRelaisStateCallback, callbackGetVersion, getVoltNamesCallback) + server := web.NewServer(config.WebPort, readVoltageCallback, + toggleRelaisCallback, getRelaisStateCallback, callbackGetVersion, + getVoltNamesCallback) - fmt.Printf("Webserver gestartet auf Port %s\n", config.WebPort) - log.Fatal(server.Start()) + fmt.Printf("Verschlüsselter HTTPS-Webserver gestartet auf Port %s...\n", config.WebPort) + + // ÜBERGABE DER ZERTIFIKATE AUS DER CONFIG AN DIE NEUE START-METHODE + log.Fatal(server.Start(config.SSLCert, config.SSLKey)) } // Hilfsfunktion zum Laden der version.json diff --git a/server.crt b/server.crt new file mode 100644 index 0000000..06e3fcb --- /dev/null +++ b/server.crt @@ -0,0 +1,23 @@ +-----BEGIN CERTIFICATE----- +MIID1TCCAr2gAwIBAgIUffKgdkPBvX0QynTQ84kpWQU05xUwDQYJKoZIhvcNAQEL +BQAwejELMAkGA1UEBhMCREUxEDAOBgNVBAgMB0JhdmFyaWExEjAQBgNVBAcMCUvD +g8K2ZGl0ejEhMB8GA1UECgwYSW50ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMSIwIAYJ +KoZIhvcNAQkBFhNpbmZvQGxhbmctZGlldGVyLmRlMB4XDTI2MDgwMzA4MDE1OVoX +DTI3MDgwMzA4MDE1OVowejELMAkGA1UEBhMCREUxEDAOBgNVBAgMB0JhdmFyaWEx +EjAQBgNVBAcMCUvDg8K2ZGl0ejEhMB8GA1UECgwYSW50ZXJuZXQgV2lkZ2l0cyBQ +dHkgTHRkMSIwIAYJKoZIhvcNAQkBFhNpbmZvQGxhbmctZGlldGVyLmRlMIIBIjAN +BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtf+D266GoYOYSJsQOal248PHrYey +3bfIun/Xx8MQPUw8aZJ4Zv8N3SZJh5/9Vx18TJfS8fQALxNushP7ofPmIqqjO4tk +13U9ITWGeOIreJ2HUAOAFVYk3TMCzsHK1Bb3f6WG0kx/q7Avp1jYVRUqIb0Et2+M +K8obYP+w05Vid32w3RrA+bF0sV233vfD/OkRuApg8ae2pHoVZtIm7PmrrndlynQU +s9Y2aCJR54kinR31HXUQVnJZFm2QEY0RpjQo9d+AF3Qzc6Kb9IcAMWw13t4yATBU +vDCnY6iXh7DhakOlPUBr3xm6ZZ3hW7Jq3E2+o65gfmu5IKv0ZK8TGvVzEQIDAQAB +o1MwUTAdBgNVHQ4EFgQUxxZZxiIHt7u9s7plRyOUUokpbgIwHwYDVR0jBBgwFoAU +xxZZxiIHt7u9s7plRyOUUokpbgIwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0B +AQsFAAOCAQEAoujOIzroc1afSY9QO+Fv8uj1dbmZgciK+3yatV9cHD0gkhbUcb89 +iNdLyGR9DARU3OwBSSxF71bnP/xJ1Hul6QQxivuFaLDy/fmJiV8U5GYzP8CB1aqZ +dGyx/oTrXIjGEgve2oDwo91EQhDoqGSGTFa2rRxZY7763Nx+tCS/2WVItvhKdfXw +Bqleyev6S8833ePpAO2jeRsQl4hulUrJQNeryEnkhX6wf/3sBUbZ5EQGjGDYjZ87 +LxiXPUJ6sLslrwJIStE/kiSxaUkcIQQMmTsH/LuGr8ubCwOmlf2d3fqtjAKerhoG +A2vBEpaqN9zJ5tMws/VQgWDjOUWH44UpzA== +-----END CERTIFICATE----- diff --git a/server.key b/server.key new file mode 100644 index 0000000..8c3f9e9 --- /dev/null +++ b/server.key @@ -0,0 +1,28 @@ +-----BEGIN PRIVATE KEY----- +MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC9CUywq5QuxlDG +5hBJEI9Bpo3Te3+iT7EzAoqRXCKA856YzGYfA3gmk02NhdPpdp+TzTYiOF/4Coa6 +E++PRnmwFn/BC0SmsYZ+3iwioDV9EeuSsp9eBrCF1Ve40A8v1qSClWjm3MiO2BMB +V2YMFtNrtY3v4grWBk1LI4qrkx6VJdWX09lSJJvsTYM8E18XCN+5T6aw8JjH/iFy +yyLKw/KJwPEtt4NqyIpEryH8QBT8UwVc7n8HbpaSlb93JWATnXz2T/dfeP/d4UrO +EsN/DzhH9UUZfqJH2h5wJx0q3m6blwRIgTzTIDuL24z4riH2CPN7VVAum1pvgNcf +NmkphwXVAgMBAAECggEABmOVEveJl5ceTcqizEViAh8F9hrbcnntDENOuaD6jY8u +Ug2+edfdLLiXy2u1gNOAizdJWBi9rZ11dj6MPzRrkncANF8UH+oqGImbxkPR6vs7 +Egc1ebESMEPIpjdp+/zuLHeuRvc5VBKbedUhXtE6rg5B0NS79wXZgOufmTLsuq+w +p6ivRn5uHlODDvQzvricRkwl3FvGfe/H/N50K6q+vQfAB/d3B7x97kfxvHpXw/LJ +BXwgchxJXWo371k/ks1z5mbdyjpol/Lu9KEVe4w6p3pR+0bdkvA4H8Y3FY1yDZ3c +olDsJTPBnBpGwJqvK+zzdHxt2uRmpRlVuea2QqIn1QKBgQD82fZ2YUp3i4vARzkw ++aER6PSPtAmlvMxe8s+dzkP7r/4sp8LbeqlgaF3RBfyt786SxRKjhFXRCrQOCrjH +tf+A/pnS6qrmeXZQtHlpwE8LXWNm/kdNs0leRcpTuEb+2zX+DBr0f8kbCxc+AtVy +y6DL+lI0zcgTTOtdOm1c7RUFpwKBgQC/Y+hfrx+l2c6pXEMoWE7XEhHL67ky3/AB +h3GiGPDzSzMZnqGsTnyWS/pmwchm5lBTlnRs4PmgdyvaJ/t0pZ4iWwSYmU3UsvLK +EjKXRh+AgubDOUiRgugAxeNVUitNpkTLgMGIr8/s22QqkVxZzORap0fzWhei9b4t +0VFoiobAIwKBgQCd3Ca3eb5YLFMv1Eesf+1DlUE6hpiPVPPzQ3zDdQeUlygFESfi +hw5AFmicGzTKEzHRCCC+3dwGCrynF6KNbN771fiLad8QzTxE3qf+kgXHfqKUpqQ1 +qn1f0gqjgiUw8AMhfMVHaJBRxfbYzEQey2q0bq/sL51+D0PSjKvCnHHHeQKBgFms +wy1KDacVBbre6uyVa+NjqQkGGtFWkcr1nm2YCBXGz1uasx/b6o41bU8GTxK/qTVx +En4Nb4kbLWXbQ/ukuhJY2S9y7T/S1OWPXzr39TyumNcyGOltD62FCv5oMLgCRsuf +OY8E6YSOS0GSuFWvJfO/23uPY/HL+N7Y667y8S5HAoGBAL62NT4KM4jYCp7Jys1+ +8OeoQMbSG2C02SnJT32iYqC2Au0lTVjKwOfiICvy37SAZtWqixj6TjpXoqNbel/i +FdaNV4wihIvmtUdh5UbEuEoPDgxsHKbQm3HXYf7RA356RV19KKmV524XYJV9/I5K +na9lXbV/90Jbmpjbm/tV9r+F +-----END PRIVATE KEY----- diff --git a/sysroot-arm32/index.html b/sysroot-arm32/index.html new file mode 100644 index 0000000..3026434 --- /dev/null +++ b/sysroot-arm32/index.html @@ -0,0 +1,511 @@ + + + + + Launchpad + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+ + + + +
+
+
+ + + +
+ +
+
+ + +
+ +
+ + +
+ + + + +
+ +
+ +
+
+ +
+
+
+ + +
+ +
+ 49,106 projects, + 2,108,367 bugs, + 1,009,234 branches, + 119,025 Git repositories, + 3,185,634 translations, + 822,311 answers, + 76,426 blueprints, + and counting... +
+
+
+ +
+
+
+

Launchpad

+

A software collaboration platform that provides

+
+
+
+
+

Bug tracking

+

One place to track bugs across project boundaries and tools

+
+
+

Code hosting using Git

+

Easy for anyone to get your project's code using Git

+
+
+

Code reviews

+

Full control of who can land code in your project remains with you

+
+
+

Ubuntu package building and hosting

+

Publishing your software is simple with Personal Package Archives

+
+
+
+
+

Crowd source translations

+

Build an open community to translate your software into almost any language

+
+
+

Mailing lists

+

Find and work with the right people by building a social network of individuals and teams around projects

+
+
+

Answer tracking and FAQs

+

Free software thrives on people helping each other when the unexpected happens

+
+
+

Specification tracking

+

Track ideas and chunks of work as “blueprints”

+
+
+
+
+
+ +
+
+
+

Get started

+
+
+ + Learn more about Launchpad in the + user guide. + + If you're ready, you can: + + +
+
+
+ +
+ +
+ +
+
+ + +
+
+ + + + + + + + + +
+ + + + + + + + + + + + + + + + + diff --git a/sysroot-arm32/index.html.1 b/sysroot-arm32/index.html.1 new file mode 100644 index 0000000..3026434 --- /dev/null +++ b/sysroot-arm32/index.html.1 @@ -0,0 +1,511 @@ + + + + + Launchpad + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+ + + + +
+
+
+ + + +
+ +
+
+ + +
+ +
+ + +
+ + + + +
+ +
+ +
+
+ +
+
+
+ + +
+ +
+ 49,106 projects, + 2,108,367 bugs, + 1,009,234 branches, + 119,025 Git repositories, + 3,185,634 translations, + 822,311 answers, + 76,426 blueprints, + and counting... +
+
+
+ +
+
+
+

Launchpad

+

A software collaboration platform that provides

+
+
+
+
+

Bug tracking

+

One place to track bugs across project boundaries and tools

+
+
+

Code hosting using Git

+

Easy for anyone to get your project's code using Git

+
+
+

Code reviews

+

Full control of who can land code in your project remains with you

+
+
+

Ubuntu package building and hosting

+

Publishing your software is simple with Personal Package Archives

+
+
+
+
+

Crowd source translations

+

Build an open community to translate your software into almost any language

+
+
+

Mailing lists

+

Find and work with the right people by building a social network of individuals and teams around projects

+
+
+

Answer tracking and FAQs

+

Free software thrives on people helping each other when the unexpected happens

+
+
+

Specification tracking

+

Track ideas and chunks of work as “blueprints”

+
+
+
+
+
+ +
+
+
+

Get started

+
+
+ + Learn more about Launchpad in the + user guide. + + If you're ready, you can: + + +
+
+
+ +
+ +
+ +
+
+ + +
+
+ + + + + + + + + +
+ + + + + + + + + + + + + + + + + diff --git a/sysroot-arm32/index.html.2 b/sysroot-arm32/index.html.2 new file mode 100644 index 0000000..d1fdfa4 --- /dev/null +++ b/sysroot-arm32/index.html.2 @@ -0,0 +1,511 @@ + + + + + Launchpad + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+ + + + +
+
+
+ + + +
+ +
+
+ + +
+ +
+ + +
+ + + + +
+ +
+ +
+
+ +
+
+
+ + +
+ +
+ 49,106 projects, + 2,108,367 bugs, + 1,009,234 branches, + 119,025 Git repositories, + 3,185,634 translations, + 822,311 answers, + 76,426 blueprints, + and counting... +
+
+
+ +
+
+
+

Launchpad

+

A software collaboration platform that provides

+
+
+
+
+

Bug tracking

+

One place to track bugs across project boundaries and tools

+
+
+

Code hosting using Git

+

Easy for anyone to get your project's code using Git

+
+
+

Code reviews

+

Full control of who can land code in your project remains with you

+
+
+

Ubuntu package building and hosting

+

Publishing your software is simple with Personal Package Archives

+
+
+
+
+

Crowd source translations

+

Build an open community to translate your software into almost any language

+
+
+

Mailing lists

+

Find and work with the right people by building a social network of individuals and teams around projects

+
+
+

Answer tracking and FAQs

+

Free software thrives on people helping each other when the unexpected happens

+
+
+

Specification tracking

+

Track ideas and chunks of work as “blueprints”

+
+
+
+
+
+ +
+
+
+

Get started

+
+
+ + Learn more about Launchpad in the + user guide. + + If you're ready, you can: + + +
+
+
+ +
+ +
+ +
+
+ + +
+
+ + + + + + + + + +
+ + + + + + + + + + + + + + + + + diff --git a/sysroot-arm32/libudev1_255.4-1ubuntu8_armhf.deb b/sysroot-arm32/libudev1_255.4-1ubuntu8_armhf.deb new file mode 100644 index 0000000..8baeea3 Binary files /dev/null and b/sysroot-arm32/libudev1_255.4-1ubuntu8_armhf.deb differ diff --git a/sysroot-arm32/libusb-1.0-0-dev_1.0.27-1_armhf.deb b/sysroot-arm32/libusb-1.0-0-dev_1.0.27-1_armhf.deb new file mode 100644 index 0000000..c3ca67d Binary files /dev/null and b/sysroot-arm32/libusb-1.0-0-dev_1.0.27-1_armhf.deb differ diff --git a/sysroot-arm32/libusb-1.0-0_1.0.27-1_armhf.deb b/sysroot-arm32/libusb-1.0-0_1.0.27-1_armhf.deb new file mode 100644 index 0000000..20f5f53 Binary files /dev/null and b/sysroot-arm32/libusb-1.0-0_1.0.27-1_armhf.deb differ diff --git a/sysroot-arm32/usr/include/libusb-1.0/libusb.h b/sysroot-arm32/usr/include/libusb-1.0/libusb.h new file mode 100644 index 0000000..f4e9203 --- /dev/null +++ b/sysroot-arm32/usr/include/libusb-1.0/libusb.h @@ -0,0 +1,2311 @@ +/* + * Public libusb header file + * Copyright © 2001 Johannes Erdfelt + * Copyright © 2007-2008 Daniel Drake + * Copyright © 2012 Pete Batard + * Copyright © 2012-2023 Nathan Hjelm + * Copyright © 2014-2020 Chris Dickens + * For more information, please visit: https://libusb.info + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef LIBUSB_H +#define LIBUSB_H + +#if defined(_MSC_VER) +#pragma warning(push) +/* Disable: warning C4200: nonstandard extension used : zero-sized array in struct/union */ +#pragma warning(disable:4200) +/* on MS environments, the inline keyword is available in C++ only */ +#if !defined(__cplusplus) +#define inline __inline +#endif +/* ssize_t is also not available */ +#ifndef _SSIZE_T_DEFINED +#define _SSIZE_T_DEFINED +#include +typedef SSIZE_T ssize_t; +#endif /* _SSIZE_T_DEFINED */ +#endif /* _MSC_VER */ + +#include +#include +#include +#if !defined(_MSC_VER) +#include +#endif +#include + +#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) +#define LIBUSB_FLEXIBLE_ARRAY /* [] - valid C99 code */ +#else +#define LIBUSB_FLEXIBLE_ARRAY 0 /* [0] - non-standard, but usually working code */ +#endif /* __STDC_VERSION__ */ + +/* 'interface' might be defined as a macro on Windows, so we need to + * undefine it so as not to break the current libusb API, because + * libusb_config_descriptor has an 'interface' member + * As this can be problematic if you include windows.h after libusb.h + * in your sources, we force windows.h to be included first. */ +#if defined(_WIN32) || defined(__CYGWIN__) +#include +#if defined(interface) +#undef interface +#endif +#if !defined(__CYGWIN__) +#include +#endif +#endif /* _WIN32 || __CYGWIN__ */ + +#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)) +#define LIBUSB_DEPRECATED_FOR(f) __attribute__ ((deprecated ("Use " #f " instead"))) +#elif defined(__GNUC__) && (__GNUC__ >= 3) +#define LIBUSB_DEPRECATED_FOR(f) __attribute__ ((deprecated)) +#elif defined(_MSC_VER) +#define LIBUSB_DEPRECATED_FOR(f) __declspec(deprecated("Use " #f " instead")) +#else +#define LIBUSB_DEPRECATED_FOR(f) +#endif /* __GNUC__ */ + +#if defined(__GNUC__) +#define LIBUSB_PACKED __attribute__ ((packed)) +#else +#define LIBUSB_PACKED +#endif /* __GNUC__ */ + +/** \def LIBUSB_CALL + * \ingroup libusb_misc + * libusb's Windows calling convention. + * + * Under Windows, the selection of available compilers and configurations + * means that, unlike other platforms, there is not one true calling + * convention (calling convention: the manner in which parameters are + * passed to functions in the generated assembly code). + * + * Matching the Windows API itself, libusb uses the WINAPI convention (which + * translates to the stdcall convention) and guarantees that the + * library is compiled in this way. The public header file also includes + * appropriate annotations so that your own software will use the right + * convention, even if another convention is being used by default within + * your codebase. + * + * The one consideration that you must apply in your software is to mark + * all functions which you use as libusb callbacks with this LIBUSB_CALL + * annotation, so that they too get compiled for the correct calling + * convention. + * + * On non-Windows operating systems, this macro is defined as nothing. This + * means that you can apply it to your code without worrying about + * cross-platform compatibility. + */ +/* LIBUSB_CALL must be defined on both definition and declaration of libusb + * functions. You'd think that declaration would be enough, but cygwin will + * complain about conflicting types unless both are marked this way. + * The placement of this macro is important too; it must appear after the + * return type, before the function name. See internal documentation for + * API_EXPORTED. + */ +#if defined(_WIN32) || defined(__CYGWIN__) +#define LIBUSB_CALL WINAPI +#define LIBUSB_CALLV WINAPIV +#else +#define LIBUSB_CALL +#define LIBUSB_CALLV +#endif /* _WIN32 || __CYGWIN__ */ + +/** \def LIBUSB_API_VERSION + * \ingroup libusb_misc + * libusb's API version. + * + * Since version 1.0.18, to help with feature detection, libusb defines + * a LIBUSB_API_VERSION macro that gets increased every time there is a + * significant change to the API, such as the introduction of a new call, + * the definition of a new macro/enum member, or any other element that + * libusb applications may want to detect at compilation time. + * + * Between versions 1.0.13 and 1.0.17 (inclusive) the older spelling of + * LIBUSBX_API_VERSION was used. + * + * The macro is typically used in an application as follows: + * \code + * #if defined(LIBUSB_API_VERSION) && (LIBUSB_API_VERSION >= 0x01001234) + * // Use one of the newer features from the libusb API + * #endif + * \endcode + * + * Internally, LIBUSB_API_VERSION is defined as follows: + * (libusb major << 24) | (libusb minor << 16) | (16 bit incremental) + * + * The incremental component has changed as follows: + *
    + *
  • libusbx version 1.0.13: LIBUSBX_API_VERSION = 0x01000100 + *
  • libusbx version 1.0.14: LIBUSBX_API_VERSION = 0x010000FF + *
  • libusbx version 1.0.15: LIBUSBX_API_VERSION = 0x01000101 + *
  • libusbx version 1.0.16: LIBUSBX_API_VERSION = 0x01000102 + *
  • libusbx version 1.0.17: LIBUSBX_API_VERSION = 0x01000102 + *
  • libusb version 1.0.18: LIBUSB_API_VERSION = 0x01000102 + *
  • libusb version 1.0.19: LIBUSB_API_VERSION = 0x01000103 + *
  • libusb version 1.0.20: LIBUSB_API_VERSION = 0x01000104 + *
  • libusb version 1.0.21: LIBUSB_API_VERSION = 0x01000105 + *
  • libusb version 1.0.22: LIBUSB_API_VERSION = 0x01000106 + *
  • libusb version 1.0.23: LIBUSB_API_VERSION = 0x01000107 + *
  • libusb version 1.0.24: LIBUSB_API_VERSION = 0x01000108 + *
  • libusb version 1.0.25: LIBUSB_API_VERSION = 0x01000109 + *
  • libusb version 1.0.26: LIBUSB_API_VERSION = 0x01000109 + *
  • libusb version 1.0.27: LIBUSB_API_VERSION = 0x0100010A + *
+ */ +#define LIBUSB_API_VERSION 0x0100010A + +/** \def LIBUSBX_API_VERSION + * \ingroup libusb_misc + * + * This is the older spelling, kept for backwards compatibility of code + * needing to test for older library versions where the newer spelling + * did not exist. */ +#define LIBUSBX_API_VERSION LIBUSB_API_VERSION + +#if defined(__cplusplus) +extern "C" { +#endif + +/** + * \ingroup libusb_misc + * Convert a 16-bit value from host-endian to little-endian format. On + * little endian systems, this function does nothing. On big endian systems, + * the bytes are swapped. + * \param x the host-endian value to convert + * \returns the value in little-endian byte order + */ +static inline uint16_t libusb_cpu_to_le16(const uint16_t x) +{ + union { + uint8_t b8[2]; + uint16_t b16; + } _tmp; + _tmp.b8[1] = (uint8_t) (x >> 8); + _tmp.b8[0] = (uint8_t) (x & 0xff); + return _tmp.b16; +} + +/** \def libusb_le16_to_cpu + * \ingroup libusb_misc + * Convert a 16-bit value from little-endian to host-endian format. On + * little endian systems, this function does nothing. On big endian systems, + * the bytes are swapped. + * \param x the little-endian value to convert + * \returns the value in host-endian byte order + */ +#define libusb_le16_to_cpu libusb_cpu_to_le16 + +/* standard USB stuff */ + +/** \ingroup libusb_desc + * Device and/or Interface Class codes */ +enum libusb_class_code { + /** In the context of a \ref libusb_device_descriptor "device descriptor", + * this bDeviceClass value indicates that each interface specifies its + * own class information and all interfaces operate independently. + */ + LIBUSB_CLASS_PER_INTERFACE = 0x00, + + /** Audio class */ + LIBUSB_CLASS_AUDIO = 0x01, + + /** Communications class */ + LIBUSB_CLASS_COMM = 0x02, + + /** Human Interface Device class */ + LIBUSB_CLASS_HID = 0x03, + + /** Physical */ + LIBUSB_CLASS_PHYSICAL = 0x05, + + /** Image class */ + LIBUSB_CLASS_IMAGE = 0x06, + LIBUSB_CLASS_PTP = 0x06, /* legacy name from libusb-0.1 usb.h */ + + /** Printer class */ + LIBUSB_CLASS_PRINTER = 0x07, + + /** Mass storage class */ + LIBUSB_CLASS_MASS_STORAGE = 0x08, + + /** Hub class */ + LIBUSB_CLASS_HUB = 0x09, + + /** Data class */ + LIBUSB_CLASS_DATA = 0x0a, + + /** Smart Card */ + LIBUSB_CLASS_SMART_CARD = 0x0b, + + /** Content Security */ + LIBUSB_CLASS_CONTENT_SECURITY = 0x0d, + + /** Video */ + LIBUSB_CLASS_VIDEO = 0x0e, + + /** Personal Healthcare */ + LIBUSB_CLASS_PERSONAL_HEALTHCARE = 0x0f, + + /** Diagnostic Device */ + LIBUSB_CLASS_DIAGNOSTIC_DEVICE = 0xdc, + + /** Wireless class */ + LIBUSB_CLASS_WIRELESS = 0xe0, + + /** Miscellaneous class */ + LIBUSB_CLASS_MISCELLANEOUS = 0xef, + + /** Application class */ + LIBUSB_CLASS_APPLICATION = 0xfe, + + /** Class is vendor-specific */ + LIBUSB_CLASS_VENDOR_SPEC = 0xff +}; + +/** \ingroup libusb_desc + * Descriptor types as defined by the USB specification. */ +enum libusb_descriptor_type { + /** Device descriptor. See libusb_device_descriptor. */ + LIBUSB_DT_DEVICE = 0x01, + + /** Configuration descriptor. See libusb_config_descriptor. */ + LIBUSB_DT_CONFIG = 0x02, + + /** String descriptor */ + LIBUSB_DT_STRING = 0x03, + + /** Interface descriptor. See libusb_interface_descriptor. */ + LIBUSB_DT_INTERFACE = 0x04, + + /** Endpoint descriptor. See libusb_endpoint_descriptor. */ + LIBUSB_DT_ENDPOINT = 0x05, + + /** Interface Association Descriptor. + * See libusb_interface_association_descriptor */ + LIBUSB_DT_INTERFACE_ASSOCIATION = 0x0b, + + /** BOS descriptor */ + LIBUSB_DT_BOS = 0x0f, + + /** Device Capability descriptor */ + LIBUSB_DT_DEVICE_CAPABILITY = 0x10, + + /** HID descriptor */ + LIBUSB_DT_HID = 0x21, + + /** HID report descriptor */ + LIBUSB_DT_REPORT = 0x22, + + /** Physical descriptor */ + LIBUSB_DT_PHYSICAL = 0x23, + + /** Hub descriptor */ + LIBUSB_DT_HUB = 0x29, + + /** SuperSpeed Hub descriptor */ + LIBUSB_DT_SUPERSPEED_HUB = 0x2a, + + /** SuperSpeed Endpoint Companion descriptor */ + LIBUSB_DT_SS_ENDPOINT_COMPANION = 0x30 +}; + +/* Descriptor sizes per descriptor type */ +#define LIBUSB_DT_DEVICE_SIZE 18 +#define LIBUSB_DT_CONFIG_SIZE 9 +#define LIBUSB_DT_INTERFACE_SIZE 9 +#define LIBUSB_DT_ENDPOINT_SIZE 7 +#define LIBUSB_DT_ENDPOINT_AUDIO_SIZE 9 /* Audio extension */ +#define LIBUSB_DT_HUB_NONVAR_SIZE 7 +#define LIBUSB_DT_SS_ENDPOINT_COMPANION_SIZE 6 +#define LIBUSB_DT_BOS_SIZE 5 +#define LIBUSB_DT_DEVICE_CAPABILITY_SIZE 3 + +/* BOS descriptor sizes */ +#define LIBUSB_BT_USB_2_0_EXTENSION_SIZE 7 +#define LIBUSB_BT_SS_USB_DEVICE_CAPABILITY_SIZE 10 +#define LIBUSB_BT_CONTAINER_ID_SIZE 20 +#define LIBUSB_BT_PLATFORM_DESCRIPTOR_MIN_SIZE 20 + +/* We unwrap the BOS => define its max size */ +#define LIBUSB_DT_BOS_MAX_SIZE \ + (LIBUSB_DT_BOS_SIZE + \ + LIBUSB_BT_USB_2_0_EXTENSION_SIZE + \ + LIBUSB_BT_SS_USB_DEVICE_CAPABILITY_SIZE + \ + LIBUSB_BT_CONTAINER_ID_SIZE) + +#define LIBUSB_ENDPOINT_ADDRESS_MASK 0x0f /* in bEndpointAddress */ +#define LIBUSB_ENDPOINT_DIR_MASK 0x80 + +/** \ingroup libusb_desc + * Endpoint direction. Values for bit 7 of the + * \ref libusb_endpoint_descriptor::bEndpointAddress "endpoint address" scheme. + */ +enum libusb_endpoint_direction { + /** Out: host-to-device */ + LIBUSB_ENDPOINT_OUT = 0x00, + + /** In: device-to-host */ + LIBUSB_ENDPOINT_IN = 0x80 +}; + +#define LIBUSB_TRANSFER_TYPE_MASK 0x03 /* in bmAttributes */ + +/** \ingroup libusb_desc + * Endpoint transfer type. Values for bits 0:1 of the + * \ref libusb_endpoint_descriptor::bmAttributes "endpoint attributes" field. + */ +enum libusb_endpoint_transfer_type { + /** Control endpoint */ + LIBUSB_ENDPOINT_TRANSFER_TYPE_CONTROL = 0x0, + + /** Isochronous endpoint */ + LIBUSB_ENDPOINT_TRANSFER_TYPE_ISOCHRONOUS = 0x1, + + /** Bulk endpoint */ + LIBUSB_ENDPOINT_TRANSFER_TYPE_BULK = 0x2, + + /** Interrupt endpoint */ + LIBUSB_ENDPOINT_TRANSFER_TYPE_INTERRUPT = 0x3 +}; + +/** \ingroup libusb_misc + * Standard requests, as defined in table 9-5 of the USB 3.0 specifications */ +enum libusb_standard_request { + /** Request status of the specific recipient */ + LIBUSB_REQUEST_GET_STATUS = 0x00, + + /** Clear or disable a specific feature */ + LIBUSB_REQUEST_CLEAR_FEATURE = 0x01, + + /* 0x02 is reserved */ + + /** Set or enable a specific feature */ + LIBUSB_REQUEST_SET_FEATURE = 0x03, + + /* 0x04 is reserved */ + + /** Set device address for all future accesses */ + LIBUSB_REQUEST_SET_ADDRESS = 0x05, + + /** Get the specified descriptor */ + LIBUSB_REQUEST_GET_DESCRIPTOR = 0x06, + + /** Used to update existing descriptors or add new descriptors */ + LIBUSB_REQUEST_SET_DESCRIPTOR = 0x07, + + /** Get the current device configuration value */ + LIBUSB_REQUEST_GET_CONFIGURATION = 0x08, + + /** Set device configuration */ + LIBUSB_REQUEST_SET_CONFIGURATION = 0x09, + + /** Return the selected alternate setting for the specified interface */ + LIBUSB_REQUEST_GET_INTERFACE = 0x0a, + + /** Select an alternate interface for the specified interface */ + LIBUSB_REQUEST_SET_INTERFACE = 0x0b, + + /** Set then report an endpoint's synchronization frame */ + LIBUSB_REQUEST_SYNCH_FRAME = 0x0c, + + /** Sets both the U1 and U2 Exit Latency */ + LIBUSB_REQUEST_SET_SEL = 0x30, + + /** Delay from the time a host transmits a packet to the time it is + * received by the device. */ + LIBUSB_SET_ISOCH_DELAY = 0x31 +}; + +/** \ingroup libusb_misc + * Request type bits of the + * \ref libusb_control_setup::bmRequestType "bmRequestType" field in control + * transfers. */ +enum libusb_request_type { + /** Standard */ + LIBUSB_REQUEST_TYPE_STANDARD = (0x00 << 5), + + /** Class */ + LIBUSB_REQUEST_TYPE_CLASS = (0x01 << 5), + + /** Vendor */ + LIBUSB_REQUEST_TYPE_VENDOR = (0x02 << 5), + + /** Reserved */ + LIBUSB_REQUEST_TYPE_RESERVED = (0x03 << 5) +}; + +/** \ingroup libusb_misc + * Recipient bits of the + * \ref libusb_control_setup::bmRequestType "bmRequestType" field in control + * transfers. Values 4 through 31 are reserved. */ +enum libusb_request_recipient { + /** Device */ + LIBUSB_RECIPIENT_DEVICE = 0x00, + + /** Interface */ + LIBUSB_RECIPIENT_INTERFACE = 0x01, + + /** Endpoint */ + LIBUSB_RECIPIENT_ENDPOINT = 0x02, + + /** Other */ + LIBUSB_RECIPIENT_OTHER = 0x03 +}; + +#define LIBUSB_ISO_SYNC_TYPE_MASK 0x0c + +/** \ingroup libusb_desc + * Synchronization type for isochronous endpoints. Values for bits 2:3 of the + * \ref libusb_endpoint_descriptor::bmAttributes "bmAttributes" field in + * libusb_endpoint_descriptor. + */ +enum libusb_iso_sync_type { + /** No synchronization */ + LIBUSB_ISO_SYNC_TYPE_NONE = 0x0, + + /** Asynchronous */ + LIBUSB_ISO_SYNC_TYPE_ASYNC = 0x1, + + /** Adaptive */ + LIBUSB_ISO_SYNC_TYPE_ADAPTIVE = 0x2, + + /** Synchronous */ + LIBUSB_ISO_SYNC_TYPE_SYNC = 0x3 +}; + +#define LIBUSB_ISO_USAGE_TYPE_MASK 0x30 + +/** \ingroup libusb_desc + * Usage type for isochronous endpoints. Values for bits 4:5 of the + * \ref libusb_endpoint_descriptor::bmAttributes "bmAttributes" field in + * libusb_endpoint_descriptor. + */ +enum libusb_iso_usage_type { + /** Data endpoint */ + LIBUSB_ISO_USAGE_TYPE_DATA = 0x0, + + /** Feedback endpoint */ + LIBUSB_ISO_USAGE_TYPE_FEEDBACK = 0x1, + + /** Implicit feedback Data endpoint */ + LIBUSB_ISO_USAGE_TYPE_IMPLICIT = 0x2 +}; + +/** \ingroup libusb_desc + * Supported speeds (wSpeedSupported) bitfield. Indicates what + * speeds the device supports. + */ +enum libusb_supported_speed { + /** Low speed operation supported (1.5MBit/s). */ + LIBUSB_LOW_SPEED_OPERATION = (1 << 0), + + /** Full speed operation supported (12MBit/s). */ + LIBUSB_FULL_SPEED_OPERATION = (1 << 1), + + /** High speed operation supported (480MBit/s). */ + LIBUSB_HIGH_SPEED_OPERATION = (1 << 2), + + /** Superspeed operation supported (5000MBit/s). */ + LIBUSB_SUPER_SPEED_OPERATION = (1 << 3) +}; + +/** \ingroup libusb_desc + * Masks for the bits of the + * \ref libusb_usb_2_0_extension_descriptor::bmAttributes "bmAttributes" field + * of the USB 2.0 Extension descriptor. + */ +enum libusb_usb_2_0_extension_attributes { + /** Supports Link Power Management (LPM) */ + LIBUSB_BM_LPM_SUPPORT = (1 << 1) +}; + +/** \ingroup libusb_desc + * Masks for the bits of the + * \ref libusb_ss_usb_device_capability_descriptor::bmAttributes "bmAttributes" field + * field of the SuperSpeed USB Device Capability descriptor. + */ +enum libusb_ss_usb_device_capability_attributes { + /** Supports Latency Tolerance Messages (LTM) */ + LIBUSB_BM_LTM_SUPPORT = (1 << 1) +}; + +/** \ingroup libusb_desc + * USB capability types + */ +enum libusb_bos_type { + /** Wireless USB device capability */ + LIBUSB_BT_WIRELESS_USB_DEVICE_CAPABILITY = 0x01, + + /** USB 2.0 extensions */ + LIBUSB_BT_USB_2_0_EXTENSION = 0x02, + + /** SuperSpeed USB device capability */ + LIBUSB_BT_SS_USB_DEVICE_CAPABILITY = 0x03, + + /** Container ID type */ + LIBUSB_BT_CONTAINER_ID = 0x04, + + /** Platform descriptor */ + LIBUSB_BT_PLATFORM_DESCRIPTOR = 0x05 +}; + +/** \ingroup libusb_desc + * A structure representing the standard USB device descriptor. This + * descriptor is documented in section 9.6.1 of the USB 3.0 specification. + * All multiple-byte fields are represented in host-endian format. + */ +struct libusb_device_descriptor { + /** Size of this descriptor (in bytes) */ + uint8_t bLength; + + /** Descriptor type. Will have value + * \ref libusb_descriptor_type::LIBUSB_DT_DEVICE LIBUSB_DT_DEVICE in this + * context. */ + uint8_t bDescriptorType; + + /** USB specification release number in binary-coded decimal. A value of + * 0x0200 indicates USB 2.0, 0x0110 indicates USB 1.1, etc. */ + uint16_t bcdUSB; + + /** USB-IF class code for the device. See \ref libusb_class_code. */ + uint8_t bDeviceClass; + + /** USB-IF subclass code for the device, qualified by the bDeviceClass + * value */ + uint8_t bDeviceSubClass; + + /** USB-IF protocol code for the device, qualified by the bDeviceClass and + * bDeviceSubClass values */ + uint8_t bDeviceProtocol; + + /** Maximum packet size for endpoint 0 */ + uint8_t bMaxPacketSize0; + + /** USB-IF vendor ID */ + uint16_t idVendor; + + /** USB-IF product ID */ + uint16_t idProduct; + + /** Device release number in binary-coded decimal */ + uint16_t bcdDevice; + + /** Index of string descriptor describing manufacturer */ + uint8_t iManufacturer; + + /** Index of string descriptor describing product */ + uint8_t iProduct; + + /** Index of string descriptor containing device serial number */ + uint8_t iSerialNumber; + + /** Number of possible configurations */ + uint8_t bNumConfigurations; +}; + +/** \ingroup libusb_desc + * A structure representing the standard USB endpoint descriptor. This + * descriptor is documented in section 9.6.6 of the USB 3.0 specification. + * All multiple-byte fields are represented in host-endian format. + */ +struct libusb_endpoint_descriptor { + /** Size of this descriptor (in bytes) */ + uint8_t bLength; + + /** Descriptor type. Will have value + * \ref libusb_descriptor_type::LIBUSB_DT_ENDPOINT LIBUSB_DT_ENDPOINT in + * this context. */ + uint8_t bDescriptorType; + + /** The address of the endpoint described by this descriptor. Bits 0:3 are + * the endpoint number. Bits 4:6 are reserved. Bit 7 indicates direction, + * see \ref libusb_endpoint_direction. */ + uint8_t bEndpointAddress; + + /** Attributes which apply to the endpoint when it is configured using + * the bConfigurationValue. Bits 0:1 determine the transfer type and + * correspond to \ref libusb_endpoint_transfer_type. Bits 2:3 are only used + * for isochronous endpoints and correspond to \ref libusb_iso_sync_type. + * Bits 4:5 are also only used for isochronous endpoints and correspond to + * \ref libusb_iso_usage_type. Bits 6:7 are reserved. */ + uint8_t bmAttributes; + + /** Maximum packet size this endpoint is capable of sending/receiving. */ + uint16_t wMaxPacketSize; + + /** Interval for polling endpoint for data transfers. */ + uint8_t bInterval; + + /** For audio devices only: the rate at which synchronization feedback + * is provided. */ + uint8_t bRefresh; + + /** For audio devices only: the address if the synch endpoint */ + uint8_t bSynchAddress; + + /** Extra descriptors. If libusb encounters unknown endpoint descriptors, + * it will store them here, should you wish to parse them. */ + const unsigned char *extra; + + /** Length of the extra descriptors, in bytes. Must be non-negative. */ + int extra_length; +}; + +/** \ingroup libusb_desc + * A structure representing the standard USB interface association descriptor. + * This descriptor is documented in section 9.6.4 of the USB 3.0 specification. + * All multiple-byte fields are represented in host-endian format. + */ +struct libusb_interface_association_descriptor { + /** Size of this descriptor (in bytes) */ + uint8_t bLength; + + /** Descriptor type. Will have value + * \ref libusb_descriptor_type::LIBUSB_DT_INTERFACE_ASSOCIATION + * LIBUSB_DT_INTERFACE_ASSOCIATION in this context. */ + uint8_t bDescriptorType; + + /** Interface number of the first interface that is associated + * with this function */ + uint8_t bFirstInterface; + + /** Number of contiguous interfaces that are associated with + * this function */ + uint8_t bInterfaceCount; + + /** USB-IF class code for this function. + * A value of zero is not allowed in this descriptor. + * If this field is 0xff, the function class is vendor-specific. + * All other values are reserved for assignment by the USB-IF. + */ + uint8_t bFunctionClass; + + /** USB-IF subclass code for this function. + * If this field is not set to 0xff, all values are reserved + * for assignment by the USB-IF + */ + uint8_t bFunctionSubClass; + + /** USB-IF protocol code for this function. + * These codes are qualified by the values of the bFunctionClass + * and bFunctionSubClass fields. + */ + uint8_t bFunctionProtocol; + + /** Index of string descriptor describing this function */ + uint8_t iFunction; +}; + +/** \ingroup libusb_desc + * Structure containing an array of 0 or more interface association + * descriptors + */ +struct libusb_interface_association_descriptor_array { + /** Array of interface association descriptors. The size of this array + * is determined by the length field. + */ + const struct libusb_interface_association_descriptor *iad; + + /** Number of interface association descriptors contained. Read-only. */ + int length; +}; + +/** \ingroup libusb_desc + * A structure representing the standard USB interface descriptor. This + * descriptor is documented in section 9.6.5 of the USB 3.0 specification. + * All multiple-byte fields are represented in host-endian format. + */ +struct libusb_interface_descriptor { + /** Size of this descriptor (in bytes) */ + uint8_t bLength; + + /** Descriptor type. Will have value + * \ref libusb_descriptor_type::LIBUSB_DT_INTERFACE LIBUSB_DT_INTERFACE + * in this context. */ + uint8_t bDescriptorType; + + /** Number of this interface */ + uint8_t bInterfaceNumber; + + /** Value used to select this alternate setting for this interface */ + uint8_t bAlternateSetting; + + /** Number of endpoints used by this interface (excluding the control + * endpoint). */ + uint8_t bNumEndpoints; + + /** USB-IF class code for this interface. See \ref libusb_class_code. */ + uint8_t bInterfaceClass; + + /** USB-IF subclass code for this interface, qualified by the + * bInterfaceClass value */ + uint8_t bInterfaceSubClass; + + /** USB-IF protocol code for this interface, qualified by the + * bInterfaceClass and bInterfaceSubClass values */ + uint8_t bInterfaceProtocol; + + /** Index of string descriptor describing this interface */ + uint8_t iInterface; + + /** Array of endpoint descriptors. This length of this array is determined + * by the bNumEndpoints field. */ + const struct libusb_endpoint_descriptor *endpoint; + + /** Extra descriptors. If libusb encounters unknown interface descriptors, + * it will store them here, should you wish to parse them. */ + const unsigned char *extra; + + /** Length of the extra descriptors, in bytes. Must be non-negative. */ + int extra_length; +}; + +/** \ingroup libusb_desc + * A collection of alternate settings for a particular USB interface. + */ +struct libusb_interface { + /** Array of interface descriptors. The length of this array is determined + * by the num_altsetting field. */ + const struct libusb_interface_descriptor *altsetting; + + /** The number of alternate settings that belong to this interface. + * Must be non-negative. */ + int num_altsetting; +}; + +/** \ingroup libusb_desc + * A structure representing the standard USB configuration descriptor. This + * descriptor is documented in section 9.6.3 of the USB 3.0 specification. + * All multiple-byte fields are represented in host-endian format. + */ +struct libusb_config_descriptor { + /** Size of this descriptor (in bytes) */ + uint8_t bLength; + + /** Descriptor type. Will have value + * \ref libusb_descriptor_type::LIBUSB_DT_CONFIG LIBUSB_DT_CONFIG + * in this context. */ + uint8_t bDescriptorType; + + /** Total length of data returned for this configuration */ + uint16_t wTotalLength; + + /** Number of interfaces supported by this configuration */ + uint8_t bNumInterfaces; + + /** Identifier value for this configuration */ + uint8_t bConfigurationValue; + + /** Index of string descriptor describing this configuration */ + uint8_t iConfiguration; + + /** Configuration characteristics */ + uint8_t bmAttributes; + + /** Maximum power consumption of the USB device from this bus in this + * configuration when the device is fully operation. Expressed in units + * of 2 mA when the device is operating in high-speed mode and in units + * of 8 mA when the device is operating in super-speed mode. */ + uint8_t MaxPower; + + /** Array of interfaces supported by this configuration. The length of + * this array is determined by the bNumInterfaces field. */ + const struct libusb_interface *interface; + + /** Extra descriptors. If libusb encounters unknown configuration + * descriptors, it will store them here, should you wish to parse them. */ + const unsigned char *extra; + + /** Length of the extra descriptors, in bytes. Must be non-negative. */ + int extra_length; +}; + +/** \ingroup libusb_desc + * A structure representing the superspeed endpoint companion + * descriptor. This descriptor is documented in section 9.6.7 of + * the USB 3.0 specification. All multiple-byte fields are represented in + * host-endian format. + */ +struct libusb_ss_endpoint_companion_descriptor { + /** Size of this descriptor (in bytes) */ + uint8_t bLength; + + /** Descriptor type. Will have value + * \ref libusb_descriptor_type::LIBUSB_DT_SS_ENDPOINT_COMPANION in + * this context. */ + uint8_t bDescriptorType; + + /** The maximum number of packets the endpoint can send or + * receive as part of a burst. */ + uint8_t bMaxBurst; + + /** In bulk EP: bits 4:0 represents the maximum number of + * streams the EP supports. In isochronous EP: bits 1:0 + * represents the Mult - a zero based value that determines + * the maximum number of packets within a service interval */ + uint8_t bmAttributes; + + /** The total number of bytes this EP will transfer every + * service interval. Valid only for periodic EPs. */ + uint16_t wBytesPerInterval; +}; + +/** \ingroup libusb_desc + * A generic representation of a BOS Device Capability descriptor. It is + * advised to check bDevCapabilityType and call the matching + * libusb_get_*_descriptor function to get a structure fully matching the type. + */ +struct libusb_bos_dev_capability_descriptor { + /** Size of this descriptor (in bytes) */ + uint8_t bLength; + + /** Descriptor type. Will have value + * \ref libusb_descriptor_type::LIBUSB_DT_DEVICE_CAPABILITY + * LIBUSB_DT_DEVICE_CAPABILITY in this context. */ + uint8_t bDescriptorType; + + /** Device Capability type */ + uint8_t bDevCapabilityType; + + /** Device Capability data (bLength - 3 bytes) */ + uint8_t dev_capability_data[LIBUSB_FLEXIBLE_ARRAY]; +}; + +/** \ingroup libusb_desc + * A structure representing the Binary Device Object Store (BOS) descriptor. + * This descriptor is documented in section 9.6.2 of the USB 3.0 specification. + * All multiple-byte fields are represented in host-endian format. + */ +struct libusb_bos_descriptor { + /** Size of this descriptor (in bytes) */ + uint8_t bLength; + + /** Descriptor type. Will have value + * \ref libusb_descriptor_type::LIBUSB_DT_BOS LIBUSB_DT_BOS + * in this context. */ + uint8_t bDescriptorType; + + /** Length of this descriptor and all of its sub descriptors */ + uint16_t wTotalLength; + + /** The number of separate device capability descriptors in + * the BOS */ + uint8_t bNumDeviceCaps; + + /** bNumDeviceCap Device Capability Descriptors */ + struct libusb_bos_dev_capability_descriptor *dev_capability[LIBUSB_FLEXIBLE_ARRAY]; +}; + +/** \ingroup libusb_desc + * A structure representing the USB 2.0 Extension descriptor + * This descriptor is documented in section 9.6.2.1 of the USB 3.0 specification. + * All multiple-byte fields are represented in host-endian format. + */ +struct libusb_usb_2_0_extension_descriptor { + /** Size of this descriptor (in bytes) */ + uint8_t bLength; + + /** Descriptor type. Will have value + * \ref libusb_descriptor_type::LIBUSB_DT_DEVICE_CAPABILITY + * LIBUSB_DT_DEVICE_CAPABILITY in this context. */ + uint8_t bDescriptorType; + + /** Capability type. Will have value + * \ref libusb_capability_type::LIBUSB_BT_USB_2_0_EXTENSION + * LIBUSB_BT_USB_2_0_EXTENSION in this context. */ + uint8_t bDevCapabilityType; + + /** Bitmap encoding of supported device level features. + * A value of one in a bit location indicates a feature is + * supported; a value of zero indicates it is not supported. + * See \ref libusb_usb_2_0_extension_attributes. */ + uint32_t bmAttributes; +}; + +/** \ingroup libusb_desc + * A structure representing the SuperSpeed USB Device Capability descriptor + * This descriptor is documented in section 9.6.2.2 of the USB 3.0 specification. + * All multiple-byte fields are represented in host-endian format. + */ +struct libusb_ss_usb_device_capability_descriptor { + /** Size of this descriptor (in bytes) */ + uint8_t bLength; + + /** Descriptor type. Will have value + * \ref libusb_descriptor_type::LIBUSB_DT_DEVICE_CAPABILITY + * LIBUSB_DT_DEVICE_CAPABILITY in this context. */ + uint8_t bDescriptorType; + + /** Capability type. Will have value + * \ref libusb_capability_type::LIBUSB_BT_SS_USB_DEVICE_CAPABILITY + * LIBUSB_BT_SS_USB_DEVICE_CAPABILITY in this context. */ + uint8_t bDevCapabilityType; + + /** Bitmap encoding of supported device level features. + * A value of one in a bit location indicates a feature is + * supported; a value of zero indicates it is not supported. + * See \ref libusb_ss_usb_device_capability_attributes. */ + uint8_t bmAttributes; + + /** Bitmap encoding of the speed supported by this device when + * operating in SuperSpeed mode. See \ref libusb_supported_speed. */ + uint16_t wSpeedSupported; + + /** The lowest speed at which all the functionality supported + * by the device is available to the user. For example if the + * device supports all its functionality when connected at + * full speed and above then it sets this value to 1. */ + uint8_t bFunctionalitySupport; + + /** U1 Device Exit Latency. */ + uint8_t bU1DevExitLat; + + /** U2 Device Exit Latency. */ + uint16_t bU2DevExitLat; +}; + +/** \ingroup libusb_desc + * A structure representing the Container ID descriptor. + * This descriptor is documented in section 9.6.2.3 of the USB 3.0 specification. + * All multiple-byte fields, except UUIDs, are represented in host-endian format. + */ +struct libusb_container_id_descriptor { + /** Size of this descriptor (in bytes) */ + uint8_t bLength; + + /** Descriptor type. Will have value + * \ref libusb_descriptor_type::LIBUSB_DT_DEVICE_CAPABILITY + * LIBUSB_DT_DEVICE_CAPABILITY in this context. */ + uint8_t bDescriptorType; + + /** Capability type. Will have value + * \ref libusb_capability_type::LIBUSB_BT_CONTAINER_ID + * LIBUSB_BT_CONTAINER_ID in this context. */ + uint8_t bDevCapabilityType; + + /** Reserved field */ + uint8_t bReserved; + + /** 128 bit UUID */ + uint8_t ContainerID[16]; +}; + +/** \ingroup libusb_desc + * A structure representing a Platform descriptor. + * This descriptor is documented in section 9.6.2.4 of the USB 3.2 specification. + */ +struct libusb_platform_descriptor { + /** Size of this descriptor (in bytes) */ + uint8_t bLength; + + /** Descriptor type. Will have value + * \ref libusb_descriptor_type::LIBUSB_DT_DEVICE_CAPABILITY + * LIBUSB_DT_DEVICE_CAPABILITY in this context. */ + uint8_t bDescriptorType; + + /** Capability type. Will have value + * \ref libusb_capability_type::LIBUSB_BT_PLATFORM_DESCRIPTOR + * LIBUSB_BT_CONTAINER_ID in this context. */ + uint8_t bDevCapabilityType; + + /** Reserved field */ + uint8_t bReserved; + + /** 128 bit UUID */ + uint8_t PlatformCapabilityUUID[16]; + + /** Capability data (bLength - 20) */ + uint8_t CapabilityData[LIBUSB_FLEXIBLE_ARRAY]; +}; + +/** \ingroup libusb_asyncio + * Setup packet for control transfers. */ +#if defined(_MSC_VER) || defined(__WATCOMC__) +#pragma pack(push, 1) +#endif +struct libusb_control_setup { + /** Request type. Bits 0:4 determine recipient, see + * \ref libusb_request_recipient. Bits 5:6 determine type, see + * \ref libusb_request_type. Bit 7 determines data transfer direction, see + * \ref libusb_endpoint_direction. + */ + uint8_t bmRequestType; + + /** Request. If the type bits of bmRequestType are equal to + * \ref libusb_request_type::LIBUSB_REQUEST_TYPE_STANDARD + * "LIBUSB_REQUEST_TYPE_STANDARD" then this field refers to + * \ref libusb_standard_request. For other cases, use of this field is + * application-specific. */ + uint8_t bRequest; + + /** Value. Varies according to request */ + uint16_t wValue; + + /** Index. Varies according to request, typically used to pass an index + * or offset */ + uint16_t wIndex; + + /** Number of bytes to transfer */ + uint16_t wLength; +} LIBUSB_PACKED; +#if defined(_MSC_VER) || defined(__WATCOMC__) +#pragma pack(pop) +#endif + +#define LIBUSB_CONTROL_SETUP_SIZE (sizeof(struct libusb_control_setup)) + +/* libusb */ + +struct libusb_context; +struct libusb_device; +struct libusb_device_handle; + +/** \ingroup libusb_lib + * Structure providing the version of the libusb runtime + */ +struct libusb_version { + /** Library major version. */ + const uint16_t major; + + /** Library minor version. */ + const uint16_t minor; + + /** Library micro version. */ + const uint16_t micro; + + /** Library nano version. */ + const uint16_t nano; + + /** Library release candidate suffix string, e.g. "-rc4". */ + const char *rc; + + /** For ABI compatibility only. */ + const char *describe; +}; + +/** \ingroup libusb_lib + * Structure representing a libusb session. The concept of individual libusb + * sessions allows for your program to use two libraries (or dynamically + * load two modules) which both independently use libusb. This will prevent + * interference between the individual libusb users - for example + * libusb_set_option() will not affect the other user of the library, and + * libusb_exit() will not destroy resources that the other user is still + * using. + * + * Sessions are created by libusb_init_context() and destroyed through libusb_exit(). + * If your application is guaranteed to only ever include a single libusb + * user (i.e. you), you do not have to worry about contexts: pass NULL in + * every function call where a context is required, and the default context + * will be used. Note that libusb_set_option(NULL, ...) is special, and adds + * an option to a list of default options for new contexts. + * + * For more information, see \ref libusb_contexts. + */ +typedef struct libusb_context libusb_context; + +/** \ingroup libusb_dev + * Structure representing a USB device detected on the system. This is an + * opaque type for which you are only ever provided with a pointer, usually + * originating from libusb_get_device_list() or libusb_hotplug_register_callback(). + * + * Certain operations can be performed on a device, but in order to do any + * I/O you will have to first obtain a device handle using libusb_open(). + * + * Devices are reference counted with libusb_ref_device() and + * libusb_unref_device(), and are freed when the reference count reaches 0. + * New devices presented by libusb_get_device_list() have a reference count of + * 1, and libusb_free_device_list() can optionally decrease the reference count + * on all devices in the list. libusb_open() adds another reference which is + * later destroyed by libusb_close(). + */ +typedef struct libusb_device libusb_device; + + +/** \ingroup libusb_dev + * Structure representing a handle on a USB device. This is an opaque type for + * which you are only ever provided with a pointer, usually originating from + * libusb_open(). + * + * A device handle is used to perform I/O and other operations. When finished + * with a device handle, you should call libusb_close(). + */ +typedef struct libusb_device_handle libusb_device_handle; + +/** \ingroup libusb_dev + * Speed codes. Indicates the speed at which the device is operating. + */ +enum libusb_speed { + /** The OS doesn't report or know the device speed. */ + LIBUSB_SPEED_UNKNOWN = 0, + + /** The device is operating at low speed (1.5MBit/s). */ + LIBUSB_SPEED_LOW = 1, + + /** The device is operating at full speed (12MBit/s). */ + LIBUSB_SPEED_FULL = 2, + + /** The device is operating at high speed (480MBit/s). */ + LIBUSB_SPEED_HIGH = 3, + + /** The device is operating at super speed (5000MBit/s). */ + LIBUSB_SPEED_SUPER = 4, + + /** The device is operating at super speed plus (10000MBit/s). */ + LIBUSB_SPEED_SUPER_PLUS = 5 +}; + +/** \ingroup libusb_misc + * Error codes. Most libusb functions return 0 on success or one of these + * codes on failure. + * You can call libusb_error_name() to retrieve a string representation of an + * error code or libusb_strerror() to get an end-user suitable description of + * an error code. + */ +enum libusb_error { + /** Success (no error) */ + LIBUSB_SUCCESS = 0, + + /** Input/output error */ + LIBUSB_ERROR_IO = -1, + + /** Invalid parameter */ + LIBUSB_ERROR_INVALID_PARAM = -2, + + /** Access denied (insufficient permissions) */ + LIBUSB_ERROR_ACCESS = -3, + + /** No such device (it may have been disconnected) */ + LIBUSB_ERROR_NO_DEVICE = -4, + + /** Entity not found */ + LIBUSB_ERROR_NOT_FOUND = -5, + + /** Resource busy */ + LIBUSB_ERROR_BUSY = -6, + + /** Operation timed out */ + LIBUSB_ERROR_TIMEOUT = -7, + + /** Overflow */ + LIBUSB_ERROR_OVERFLOW = -8, + + /** Pipe error */ + LIBUSB_ERROR_PIPE = -9, + + /** System call interrupted (perhaps due to signal) */ + LIBUSB_ERROR_INTERRUPTED = -10, + + /** Insufficient memory */ + LIBUSB_ERROR_NO_MEM = -11, + + /** Operation not supported or unimplemented on this platform */ + LIBUSB_ERROR_NOT_SUPPORTED = -12, + + /* NB: Remember to update LIBUSB_ERROR_COUNT below as well as the + message strings in strerror.c when adding new error codes here. */ + + /** Other error */ + LIBUSB_ERROR_OTHER = -99 +}; + +/* Total number of error codes in enum libusb_error */ +#define LIBUSB_ERROR_COUNT 14 + +/** \ingroup libusb_asyncio + * Transfer type */ +enum libusb_transfer_type { + /** Control transfer */ + LIBUSB_TRANSFER_TYPE_CONTROL = 0U, + + /** Isochronous transfer */ + LIBUSB_TRANSFER_TYPE_ISOCHRONOUS = 1U, + + /** Bulk transfer */ + LIBUSB_TRANSFER_TYPE_BULK = 2U, + + /** Interrupt transfer */ + LIBUSB_TRANSFER_TYPE_INTERRUPT = 3U, + + /** Bulk stream transfer */ + LIBUSB_TRANSFER_TYPE_BULK_STREAM = 4U +}; + +/** \ingroup libusb_asyncio + * Transfer status codes */ +enum libusb_transfer_status { + /** Transfer completed without error. Note that this does not indicate + * that the entire amount of requested data was transferred. */ + LIBUSB_TRANSFER_COMPLETED, + + /** Transfer failed */ + LIBUSB_TRANSFER_ERROR, + + /** Transfer timed out */ + LIBUSB_TRANSFER_TIMED_OUT, + + /** Transfer was cancelled */ + LIBUSB_TRANSFER_CANCELLED, + + /** For bulk/interrupt endpoints: halt condition detected (endpoint + * stalled). For control endpoints: control request not supported. */ + LIBUSB_TRANSFER_STALL, + + /** Device was disconnected */ + LIBUSB_TRANSFER_NO_DEVICE, + + /** Device sent more data than requested */ + LIBUSB_TRANSFER_OVERFLOW + + /* NB! Remember to update libusb_error_name() + when adding new status codes here. */ +}; + +/** \ingroup libusb_asyncio + * libusb_transfer.flags values */ +enum libusb_transfer_flags { + /** Report short frames as errors */ + LIBUSB_TRANSFER_SHORT_NOT_OK = (1U << 0), + + /** Automatically free() transfer buffer during libusb_free_transfer(). + * Note that buffers allocated with libusb_dev_mem_alloc() should not + * be attempted freed in this way, since free() is not an appropriate + * way to release such memory. */ + LIBUSB_TRANSFER_FREE_BUFFER = (1U << 1), + + /** Automatically call libusb_free_transfer() after callback returns. + * If this flag is set, it is illegal to call libusb_free_transfer() + * from your transfer callback, as this will result in a double-free + * when this flag is acted upon. */ + LIBUSB_TRANSFER_FREE_TRANSFER = (1U << 2), + + /** Terminate transfers that are a multiple of the endpoint's + * wMaxPacketSize with an extra zero length packet. This is useful + * when a device protocol mandates that each logical request is + * terminated by an incomplete packet (i.e. the logical requests are + * not separated by other means). + * + * This flag only affects host-to-device transfers to bulk and interrupt + * endpoints. In other situations, it is ignored. + * + * This flag only affects transfers with a length that is a multiple of + * the endpoint's wMaxPacketSize. On transfers of other lengths, this + * flag has no effect. Therefore, if you are working with a device that + * needs a ZLP whenever the end of the logical request falls on a packet + * boundary, then it is sensible to set this flag on every + * transfer (you do not have to worry about only setting it on transfers + * that end on the boundary). + * + * This flag is currently only supported on Linux. + * On other systems, libusb_submit_transfer() will return + * \ref LIBUSB_ERROR_NOT_SUPPORTED for every transfer where this + * flag is set. + * + * Available since libusb-1.0.9. + */ + LIBUSB_TRANSFER_ADD_ZERO_PACKET = (1U << 3) +}; + +/** \ingroup libusb_asyncio + * Isochronous packet descriptor. */ +struct libusb_iso_packet_descriptor { + /** Length of data to request in this packet */ + unsigned int length; + + /** Amount of data that was actually transferred */ + unsigned int actual_length; + + /** Status code for this packet */ + enum libusb_transfer_status status; +}; + +struct libusb_transfer; + +/** \ingroup libusb_asyncio + * Asynchronous transfer callback function type. When submitting asynchronous + * transfers, you pass a pointer to a callback function of this type via the + * \ref libusb_transfer::callback "callback" member of the libusb_transfer + * structure. libusb will call this function later, when the transfer has + * completed or failed. See \ref libusb_asyncio for more information. + * \param transfer The libusb_transfer struct the callback function is being + * notified about. + */ +typedef void (LIBUSB_CALL *libusb_transfer_cb_fn)(struct libusb_transfer *transfer); + +/** \ingroup libusb_asyncio + * The generic USB transfer structure. The user populates this structure and + * then submits it in order to request a transfer. After the transfer has + * completed, the library populates the transfer with the results and passes + * it back to the user. + */ +struct libusb_transfer { + /** Handle of the device that this transfer will be submitted to */ + libusb_device_handle *dev_handle; + + /** A bitwise OR combination of \ref libusb_transfer_flags. */ + uint8_t flags; + + /** Address of the endpoint where this transfer will be sent. */ + unsigned char endpoint; + + /** Type of the transfer from \ref libusb_transfer_type */ + unsigned char type; + + /** Timeout for this transfer in milliseconds. A value of 0 indicates no + * timeout. */ + unsigned int timeout; + + /** The status of the transfer. Read-only, and only for use within + * transfer callback function. + * + * If this is an isochronous transfer, this field may read COMPLETED even + * if there were errors in the frames. Use the + * \ref libusb_iso_packet_descriptor::status "status" field in each packet + * to determine if errors occurred. */ + enum libusb_transfer_status status; + + /** Length of the data buffer. Must be non-negative. */ + int length; + + /** Actual length of data that was transferred. Read-only, and only for + * use within transfer callback function. Not valid for isochronous + * endpoint transfers. */ + int actual_length; + + /** Callback function. This will be invoked when the transfer completes, + * fails, or is cancelled. */ + libusb_transfer_cb_fn callback; + + /** User context data. Useful for associating specific data to a transfer + * that can be accessed from within the callback function. + * + * This field may be set manually or is taken as the `user_data` parameter + * of the following functions: + * - libusb_fill_bulk_transfer() + * - libusb_fill_bulk_stream_transfer() + * - libusb_fill_control_transfer() + * - libusb_fill_interrupt_transfer() + * - libusb_fill_iso_transfer() */ + void *user_data; + + /** Data buffer */ + unsigned char *buffer; + + /** Number of isochronous packets. Only used for I/O with isochronous + * endpoints. Must be non-negative. */ + int num_iso_packets; + + /** Isochronous packet descriptors, for isochronous transfers only. */ + struct libusb_iso_packet_descriptor iso_packet_desc[LIBUSB_FLEXIBLE_ARRAY]; +}; + +/** \ingroup libusb_misc + * Capabilities supported by an instance of libusb on the current running + * platform. Test if the loaded library supports a given capability by calling + * \ref libusb_has_capability(). + */ +enum libusb_capability { + /** The libusb_has_capability() API is available. */ + LIBUSB_CAP_HAS_CAPABILITY = 0x0000U, + + /** Hotplug support is available on this platform. */ + LIBUSB_CAP_HAS_HOTPLUG = 0x0001U, + + /** The library can access HID devices without requiring user intervention. + * Note that before being able to actually access an HID device, you may + * still have to call additional libusb functions such as + * \ref libusb_detach_kernel_driver(). */ + LIBUSB_CAP_HAS_HID_ACCESS = 0x0100U, + + /** The library supports detaching of the default USB driver, using + * \ref libusb_detach_kernel_driver(), if one is set by the OS kernel */ + LIBUSB_CAP_SUPPORTS_DETACH_KERNEL_DRIVER = 0x0101U +}; + +/** \ingroup libusb_lib + * Log message levels. + */ +enum libusb_log_level { + /** (0) : No messages ever emitted by the library (default) */ + LIBUSB_LOG_LEVEL_NONE = 0, + + /** (1) : Error messages are emitted */ + LIBUSB_LOG_LEVEL_ERROR = 1, + + /** (2) : Warning and error messages are emitted */ + LIBUSB_LOG_LEVEL_WARNING = 2, + + /** (3) : Informational, warning and error messages are emitted */ + LIBUSB_LOG_LEVEL_INFO = 3, + + /** (4) : All messages are emitted */ + LIBUSB_LOG_LEVEL_DEBUG = 4 +}; + +/** \ingroup libusb_lib + * Log callback mode. + * + * Since version 1.0.23, \ref LIBUSB_API_VERSION >= 0x01000107 + * + * \see libusb_set_log_cb() + */ +enum libusb_log_cb_mode { + /** Callback function handling all log messages. */ + LIBUSB_LOG_CB_GLOBAL = (1 << 0), + + /** Callback function handling context related log messages. */ + LIBUSB_LOG_CB_CONTEXT = (1 << 1) +}; + +/** \ingroup libusb_lib + * Available option values for libusb_set_option() and libusb_init_context(). + */ +enum libusb_option { + /** Set the log message verbosity. + * + * This option must be provided an argument of type \ref libusb_log_level. + * The default level is LIBUSB_LOG_LEVEL_NONE, which means no messages are ever + * printed. If you choose to increase the message verbosity level, ensure + * that your application does not close the stderr file descriptor. + * + * You are advised to use level LIBUSB_LOG_LEVEL_WARNING. libusb is conservative + * with its message logging and most of the time, will only log messages that + * explain error conditions and other oddities. This will help you debug + * your software. + * + * If the LIBUSB_DEBUG environment variable was set when libusb was + * initialized, this option does nothing: the message verbosity is fixed + * to the value in the environment variable. + * + * If libusb was compiled without any message logging, this option does + * nothing: you'll never get any messages. + * + * If libusb was compiled with verbose debug message logging, this option + * does nothing: you'll always get messages from all levels. + */ + LIBUSB_OPTION_LOG_LEVEL = 0, + + /** Use the UsbDk backend for a specific context, if available. + * + * This option should be set at initialization with libusb_init_context() + * otherwise unspecified behavior may occur. + * + * Only valid on Windows. Ignored on all other platforms. + */ + LIBUSB_OPTION_USE_USBDK = 1, + + /** Do not scan for devices + * + * With this option set, libusb will skip scanning devices in + * libusb_init_context(). + * + * Hotplug functionality will also be deactivated. + * + * The option is useful in combination with libusb_wrap_sys_device(), + * which can access a device directly without prior device scanning. + * + * This is typically needed on Android, where access to USB devices + * is limited. + * + * This option should only be used with libusb_init_context() + * otherwise unspecified behavior may occur. + * + * Only valid on Linux. Ignored on all other platforms. + */ + LIBUSB_OPTION_NO_DEVICE_DISCOVERY = 2, + +#define LIBUSB_OPTION_WEAK_AUTHORITY LIBUSB_OPTION_NO_DEVICE_DISCOVERY + + /** Set the context log callback function. + * + * Set the log callback function either on a context or globally. This + * option must be provided an argument of type \ref libusb_log_cb. + * Using this option with a NULL context is equivalent to calling + * libusb_set_log_cb() with mode \ref LIBUSB_LOG_CB_GLOBAL. + * Using it with a non-NULL context is equivalent to calling + * libusb_set_log_cb() with mode \ref LIBUSB_LOG_CB_CONTEXT. + */ + LIBUSB_OPTION_LOG_CB = 3, + + LIBUSB_OPTION_MAX = 4 +}; + +/** \ingroup libusb_lib + * Callback function for handling log messages. + * \param ctx the context which is related to the log message, or NULL if it + * is a global log message + * \param level the log level, see \ref libusb_log_level for a description + * \param str the log message + * + * Since version 1.0.23, \ref LIBUSB_API_VERSION >= 0x01000107 + * + * \see libusb_set_log_cb() + */ +typedef void (LIBUSB_CALL *libusb_log_cb)(libusb_context *ctx, + enum libusb_log_level level, const char *str); + +/** \ingroup libusb_lib + * Structure used for setting options through \ref libusb_init_context. + * + */ +struct libusb_init_option { + /** Which option to set */ + enum libusb_option option; + /** An integer value used by the option (if applicable). */ + union { + int ival; + libusb_log_cb log_cbval; + } value; +}; + +int LIBUSB_CALL libusb_init(libusb_context **ctx); +int LIBUSB_CALL libusb_init_context(libusb_context **ctx, const struct libusb_init_option options[], int num_options); +void LIBUSB_CALL libusb_exit(libusb_context *ctx); +void LIBUSB_CALL libusb_set_debug(libusb_context *ctx, int level); +/* may be deprecated in the future in favor of lubusb_init_context()+libusb_set_option() */ +void LIBUSB_CALL libusb_set_log_cb(libusb_context *ctx, libusb_log_cb cb, int mode); +const struct libusb_version * LIBUSB_CALL libusb_get_version(void); +int LIBUSB_CALL libusb_has_capability(uint32_t capability); +const char * LIBUSB_CALL libusb_error_name(int errcode); +int LIBUSB_CALL libusb_setlocale(const char *locale); +const char * LIBUSB_CALL libusb_strerror(int errcode); + +ssize_t LIBUSB_CALL libusb_get_device_list(libusb_context *ctx, + libusb_device ***list); +void LIBUSB_CALL libusb_free_device_list(libusb_device **list, + int unref_devices); +libusb_device * LIBUSB_CALL libusb_ref_device(libusb_device *dev); +void LIBUSB_CALL libusb_unref_device(libusb_device *dev); + +int LIBUSB_CALL libusb_get_configuration(libusb_device_handle *dev, + int *config); +int LIBUSB_CALL libusb_get_device_descriptor(libusb_device *dev, + struct libusb_device_descriptor *desc); +int LIBUSB_CALL libusb_get_active_config_descriptor(libusb_device *dev, + struct libusb_config_descriptor **config); +int LIBUSB_CALL libusb_get_config_descriptor(libusb_device *dev, + uint8_t config_index, struct libusb_config_descriptor **config); +int LIBUSB_CALL libusb_get_config_descriptor_by_value(libusb_device *dev, + uint8_t bConfigurationValue, struct libusb_config_descriptor **config); +void LIBUSB_CALL libusb_free_config_descriptor( + struct libusb_config_descriptor *config); +int LIBUSB_CALL libusb_get_ss_endpoint_companion_descriptor( + libusb_context *ctx, + const struct libusb_endpoint_descriptor *endpoint, + struct libusb_ss_endpoint_companion_descriptor **ep_comp); +void LIBUSB_CALL libusb_free_ss_endpoint_companion_descriptor( + struct libusb_ss_endpoint_companion_descriptor *ep_comp); +int LIBUSB_CALL libusb_get_bos_descriptor(libusb_device_handle *dev_handle, + struct libusb_bos_descriptor **bos); +void LIBUSB_CALL libusb_free_bos_descriptor(struct libusb_bos_descriptor *bos); +int LIBUSB_CALL libusb_get_usb_2_0_extension_descriptor( + libusb_context *ctx, + struct libusb_bos_dev_capability_descriptor *dev_cap, + struct libusb_usb_2_0_extension_descriptor **usb_2_0_extension); +void LIBUSB_CALL libusb_free_usb_2_0_extension_descriptor( + struct libusb_usb_2_0_extension_descriptor *usb_2_0_extension); +int LIBUSB_CALL libusb_get_ss_usb_device_capability_descriptor( + libusb_context *ctx, + struct libusb_bos_dev_capability_descriptor *dev_cap, + struct libusb_ss_usb_device_capability_descriptor **ss_usb_device_cap); +void LIBUSB_CALL libusb_free_ss_usb_device_capability_descriptor( + struct libusb_ss_usb_device_capability_descriptor *ss_usb_device_cap); +int LIBUSB_CALL libusb_get_container_id_descriptor(libusb_context *ctx, + struct libusb_bos_dev_capability_descriptor *dev_cap, + struct libusb_container_id_descriptor **container_id); +void LIBUSB_CALL libusb_free_container_id_descriptor( + struct libusb_container_id_descriptor *container_id); +int LIBUSB_CALL libusb_get_platform_descriptor(libusb_context *ctx, + struct libusb_bos_dev_capability_descriptor *dev_cap, + struct libusb_platform_descriptor **platform_descriptor); +void LIBUSB_CALL libusb_free_platform_descriptor( + struct libusb_platform_descriptor *platform_descriptor); +uint8_t LIBUSB_CALL libusb_get_bus_number(libusb_device *dev); +uint8_t LIBUSB_CALL libusb_get_port_number(libusb_device *dev); +int LIBUSB_CALL libusb_get_port_numbers(libusb_device *dev, uint8_t *port_numbers, int port_numbers_len); +LIBUSB_DEPRECATED_FOR(libusb_get_port_numbers) +int LIBUSB_CALL libusb_get_port_path(libusb_context *ctx, libusb_device *dev, uint8_t *path, uint8_t path_length); +libusb_device * LIBUSB_CALL libusb_get_parent(libusb_device *dev); +uint8_t LIBUSB_CALL libusb_get_device_address(libusb_device *dev); +int LIBUSB_CALL libusb_get_device_speed(libusb_device *dev); +int LIBUSB_CALL libusb_get_max_packet_size(libusb_device *dev, + unsigned char endpoint); +int LIBUSB_CALL libusb_get_max_iso_packet_size(libusb_device *dev, + unsigned char endpoint); +int LIBUSB_CALL libusb_get_max_alt_packet_size(libusb_device *dev, + int interface_number, int alternate_setting, unsigned char endpoint); + +int LIBUSB_CALL libusb_get_interface_association_descriptors(libusb_device *dev, + uint8_t config_index, struct libusb_interface_association_descriptor_array **iad_array); +int LIBUSB_CALL libusb_get_active_interface_association_descriptors(libusb_device *dev, + struct libusb_interface_association_descriptor_array **iad_array); +void LIBUSB_CALL libusb_free_interface_association_descriptors( + struct libusb_interface_association_descriptor_array *iad_array); + +int LIBUSB_CALL libusb_wrap_sys_device(libusb_context *ctx, intptr_t sys_dev, libusb_device_handle **dev_handle); +int LIBUSB_CALL libusb_open(libusb_device *dev, libusb_device_handle **dev_handle); +void LIBUSB_CALL libusb_close(libusb_device_handle *dev_handle); +libusb_device * LIBUSB_CALL libusb_get_device(libusb_device_handle *dev_handle); + +int LIBUSB_CALL libusb_set_configuration(libusb_device_handle *dev_handle, + int configuration); +int LIBUSB_CALL libusb_claim_interface(libusb_device_handle *dev_handle, + int interface_number); +int LIBUSB_CALL libusb_release_interface(libusb_device_handle *dev_handle, + int interface_number); + +libusb_device_handle * LIBUSB_CALL libusb_open_device_with_vid_pid( + libusb_context *ctx, uint16_t vendor_id, uint16_t product_id); + +int LIBUSB_CALL libusb_set_interface_alt_setting(libusb_device_handle *dev_handle, + int interface_number, int alternate_setting); +int LIBUSB_CALL libusb_clear_halt(libusb_device_handle *dev_handle, + unsigned char endpoint); +int LIBUSB_CALL libusb_reset_device(libusb_device_handle *dev_handle); + +int LIBUSB_CALL libusb_alloc_streams(libusb_device_handle *dev_handle, + uint32_t num_streams, unsigned char *endpoints, int num_endpoints); +int LIBUSB_CALL libusb_free_streams(libusb_device_handle *dev_handle, + unsigned char *endpoints, int num_endpoints); + +unsigned char * LIBUSB_CALL libusb_dev_mem_alloc(libusb_device_handle *dev_handle, + size_t length); +int LIBUSB_CALL libusb_dev_mem_free(libusb_device_handle *dev_handle, + unsigned char *buffer, size_t length); + +int LIBUSB_CALL libusb_kernel_driver_active(libusb_device_handle *dev_handle, + int interface_number); +int LIBUSB_CALL libusb_detach_kernel_driver(libusb_device_handle *dev_handle, + int interface_number); +int LIBUSB_CALL libusb_attach_kernel_driver(libusb_device_handle *dev_handle, + int interface_number); +int LIBUSB_CALL libusb_set_auto_detach_kernel_driver( + libusb_device_handle *dev_handle, int enable); + +/* async I/O */ + +/** \ingroup libusb_asyncio + * Get the data section of a control transfer. This convenience function is here + * to remind you that the data does not start until 8 bytes into the actual + * buffer, as the setup packet comes first. + * + * Calling this function only makes sense from a transfer callback function, + * or situations where you have already allocated a suitably sized buffer at + * transfer->buffer. + * + * \param transfer a transfer + * \returns pointer to the first byte of the data section + */ +static inline unsigned char *libusb_control_transfer_get_data( + struct libusb_transfer *transfer) +{ + return transfer->buffer + LIBUSB_CONTROL_SETUP_SIZE; +} + +/** \ingroup libusb_asyncio + * Get the control setup packet of a control transfer. This convenience + * function is here to remind you that the control setup occupies the first + * 8 bytes of the transfer data buffer. + * + * Calling this function only makes sense from a transfer callback function, + * or situations where you have already allocated a suitably sized buffer at + * transfer->buffer. + * + * \param transfer a transfer + * \returns a casted pointer to the start of the transfer data buffer + */ +static inline struct libusb_control_setup *libusb_control_transfer_get_setup( + struct libusb_transfer *transfer) +{ + return (struct libusb_control_setup *)(void *)transfer->buffer; +} + +/** \ingroup libusb_asyncio + * Helper function to populate the setup packet (first 8 bytes of the data + * buffer) for a control transfer. The wIndex, wValue and wLength values should + * be given in host-endian byte order. + * + * \param buffer buffer to output the setup packet into + * This pointer must be aligned to at least 2 bytes boundary. + * \param bmRequestType see the + * \ref libusb_control_setup::bmRequestType "bmRequestType" field of + * \ref libusb_control_setup + * \param bRequest see the + * \ref libusb_control_setup::bRequest "bRequest" field of + * \ref libusb_control_setup + * \param wValue see the + * \ref libusb_control_setup::wValue "wValue" field of + * \ref libusb_control_setup + * \param wIndex see the + * \ref libusb_control_setup::wIndex "wIndex" field of + * \ref libusb_control_setup + * \param wLength see the + * \ref libusb_control_setup::wLength "wLength" field of + * \ref libusb_control_setup + */ +static inline void libusb_fill_control_setup(unsigned char *buffer, + uint8_t bmRequestType, uint8_t bRequest, uint16_t wValue, uint16_t wIndex, + uint16_t wLength) +{ + struct libusb_control_setup *setup = (struct libusb_control_setup *)(void *)buffer; + setup->bmRequestType = bmRequestType; + setup->bRequest = bRequest; + setup->wValue = libusb_cpu_to_le16(wValue); + setup->wIndex = libusb_cpu_to_le16(wIndex); + setup->wLength = libusb_cpu_to_le16(wLength); +} + +struct libusb_transfer * LIBUSB_CALL libusb_alloc_transfer(int iso_packets); +int LIBUSB_CALL libusb_submit_transfer(struct libusb_transfer *transfer); +int LIBUSB_CALL libusb_cancel_transfer(struct libusb_transfer *transfer); +void LIBUSB_CALL libusb_free_transfer(struct libusb_transfer *transfer); +void LIBUSB_CALL libusb_transfer_set_stream_id( + struct libusb_transfer *transfer, uint32_t stream_id); +uint32_t LIBUSB_CALL libusb_transfer_get_stream_id( + struct libusb_transfer *transfer); + +/** \ingroup libusb_asyncio + * Helper function to populate the required \ref libusb_transfer fields + * for a control transfer. + * + * If you pass a transfer buffer to this function, the first 8 bytes will + * be interpreted as a control setup packet, and the wLength field will be + * used to automatically populate the \ref libusb_transfer::length "length" + * field of the transfer. Therefore the recommended approach is: + * -# Allocate a suitably sized data buffer (including space for control setup) + * -# Call libusb_fill_control_setup() + * -# If this is a host-to-device transfer with a data stage, put the data + * in place after the setup packet + * -# Call this function + * -# Call libusb_submit_transfer() + * + * It is also legal to pass a NULL buffer to this function, in which case this + * function will not attempt to populate the length field. Remember that you + * must then populate the buffer and length fields later. + * + * \param transfer the transfer to populate + * \param dev_handle handle of the device that will handle the transfer + * \param buffer data buffer. If provided, this function will interpret the + * first 8 bytes as a setup packet and infer the transfer length from that. + * This pointer must be aligned to at least 2 bytes boundary. + * \param callback callback function to be invoked on transfer completion + * \param user_data user data to pass to callback function + * \param timeout timeout for the transfer in milliseconds + */ +static inline void libusb_fill_control_transfer( + struct libusb_transfer *transfer, libusb_device_handle *dev_handle, + unsigned char *buffer, libusb_transfer_cb_fn callback, void *user_data, + unsigned int timeout) +{ + struct libusb_control_setup *setup = (struct libusb_control_setup *)(void *)buffer; + transfer->dev_handle = dev_handle; + transfer->endpoint = 0; + transfer->type = LIBUSB_TRANSFER_TYPE_CONTROL; + transfer->timeout = timeout; + transfer->buffer = buffer; + if (setup) + transfer->length = (int) (LIBUSB_CONTROL_SETUP_SIZE + + libusb_le16_to_cpu(setup->wLength)); + transfer->user_data = user_data; + transfer->callback = callback; +} + +/** \ingroup libusb_asyncio + * Helper function to populate the required \ref libusb_transfer fields + * for a bulk transfer. + * + * \param transfer the transfer to populate + * \param dev_handle handle of the device that will handle the transfer + * \param endpoint address of the endpoint where this transfer will be sent + * \param buffer data buffer + * \param length length of data buffer + * \param callback callback function to be invoked on transfer completion + * \param user_data user data to pass to callback function + * \param timeout timeout for the transfer in milliseconds + */ +static inline void libusb_fill_bulk_transfer(struct libusb_transfer *transfer, + libusb_device_handle *dev_handle, unsigned char endpoint, + unsigned char *buffer, int length, libusb_transfer_cb_fn callback, + void *user_data, unsigned int timeout) +{ + transfer->dev_handle = dev_handle; + transfer->endpoint = endpoint; + transfer->type = LIBUSB_TRANSFER_TYPE_BULK; + transfer->timeout = timeout; + transfer->buffer = buffer; + transfer->length = length; + transfer->user_data = user_data; + transfer->callback = callback; +} + +/** \ingroup libusb_asyncio + * Helper function to populate the required \ref libusb_transfer fields + * for a bulk transfer using bulk streams. + * + * Since version 1.0.19, \ref LIBUSB_API_VERSION >= 0x01000103 + * + * \param transfer the transfer to populate + * \param dev_handle handle of the device that will handle the transfer + * \param endpoint address of the endpoint where this transfer will be sent + * \param stream_id bulk stream id for this transfer + * \param buffer data buffer + * \param length length of data buffer + * \param callback callback function to be invoked on transfer completion + * \param user_data user data to pass to callback function + * \param timeout timeout for the transfer in milliseconds + */ +static inline void libusb_fill_bulk_stream_transfer( + struct libusb_transfer *transfer, libusb_device_handle *dev_handle, + unsigned char endpoint, uint32_t stream_id, + unsigned char *buffer, int length, libusb_transfer_cb_fn callback, + void *user_data, unsigned int timeout) +{ + libusb_fill_bulk_transfer(transfer, dev_handle, endpoint, buffer, + length, callback, user_data, timeout); + transfer->type = LIBUSB_TRANSFER_TYPE_BULK_STREAM; + libusb_transfer_set_stream_id(transfer, stream_id); +} + +/** \ingroup libusb_asyncio + * Helper function to populate the required \ref libusb_transfer fields + * for an interrupt transfer. + * + * \param transfer the transfer to populate + * \param dev_handle handle of the device that will handle the transfer + * \param endpoint address of the endpoint where this transfer will be sent + * \param buffer data buffer + * \param length length of data buffer + * \param callback callback function to be invoked on transfer completion + * \param user_data user data to pass to callback function + * \param timeout timeout for the transfer in milliseconds + */ +static inline void libusb_fill_interrupt_transfer( + struct libusb_transfer *transfer, libusb_device_handle *dev_handle, + unsigned char endpoint, unsigned char *buffer, int length, + libusb_transfer_cb_fn callback, void *user_data, unsigned int timeout) +{ + transfer->dev_handle = dev_handle; + transfer->endpoint = endpoint; + transfer->type = LIBUSB_TRANSFER_TYPE_INTERRUPT; + transfer->timeout = timeout; + transfer->buffer = buffer; + transfer->length = length; + transfer->user_data = user_data; + transfer->callback = callback; +} + +/** \ingroup libusb_asyncio + * Helper function to populate the required \ref libusb_transfer fields + * for an isochronous transfer. + * + * \param transfer the transfer to populate + * \param dev_handle handle of the device that will handle the transfer + * \param endpoint address of the endpoint where this transfer will be sent + * \param buffer data buffer + * \param length length of data buffer + * \param num_iso_packets the number of isochronous packets + * \param callback callback function to be invoked on transfer completion + * \param user_data user data to pass to callback function + * \param timeout timeout for the transfer in milliseconds + */ +static inline void libusb_fill_iso_transfer(struct libusb_transfer *transfer, + libusb_device_handle *dev_handle, unsigned char endpoint, + unsigned char *buffer, int length, int num_iso_packets, + libusb_transfer_cb_fn callback, void *user_data, unsigned int timeout) +{ + transfer->dev_handle = dev_handle; + transfer->endpoint = endpoint; + transfer->type = LIBUSB_TRANSFER_TYPE_ISOCHRONOUS; + transfer->timeout = timeout; + transfer->buffer = buffer; + transfer->length = length; + transfer->num_iso_packets = num_iso_packets; + transfer->user_data = user_data; + transfer->callback = callback; +} + +/** \ingroup libusb_asyncio + * Convenience function to set the length of all packets in an isochronous + * transfer, based on the num_iso_packets field in the transfer structure. + * + * \param transfer a transfer + * \param length the length to set in each isochronous packet descriptor + * \see libusb_get_max_packet_size() + */ +static inline void libusb_set_iso_packet_lengths( + struct libusb_transfer *transfer, unsigned int length) +{ + int i; + + for (i = 0; i < transfer->num_iso_packets; i++) + transfer->iso_packet_desc[i].length = length; +} + +/** \ingroup libusb_asyncio + * Convenience function to locate the position of an isochronous packet + * within the buffer of an isochronous transfer. + * + * This is a thorough function which loops through all preceding packets, + * accumulating their lengths to find the position of the specified packet. + * Typically you will assign equal lengths to each packet in the transfer, + * and hence the above method is sub-optimal. You may wish to use + * libusb_get_iso_packet_buffer_simple() instead. + * + * \param transfer a transfer + * \param packet the packet to return the address of + * \returns the base address of the packet buffer inside the transfer buffer, + * or NULL if the packet does not exist. + * \see libusb_get_iso_packet_buffer_simple() + */ +static inline unsigned char *libusb_get_iso_packet_buffer( + struct libusb_transfer *transfer, unsigned int packet) +{ + int i; + size_t offset = 0; + int _packet; + + /* oops..slight bug in the API. packet is an unsigned int, but we use + * signed integers almost everywhere else. range-check and convert to + * signed to avoid compiler warnings. FIXME for libusb-2. */ + if (packet > INT_MAX) + return NULL; + _packet = (int) packet; + + if (_packet >= transfer->num_iso_packets) + return NULL; + + for (i = 0; i < _packet; i++) + offset += transfer->iso_packet_desc[i].length; + + return transfer->buffer + offset; +} + +/** \ingroup libusb_asyncio + * Convenience function to locate the position of an isochronous packet + * within the buffer of an isochronous transfer, for transfers where each + * packet is of identical size. + * + * This function relies on the assumption that every packet within the transfer + * is of identical size to the first packet. Calculating the location of + * the packet buffer is then just a simple calculation: + * buffer + (packet_size * packet) + * + * Do not use this function on transfers other than those that have identical + * packet lengths for each packet. + * + * \param transfer a transfer + * \param packet the packet to return the address of + * \returns the base address of the packet buffer inside the transfer buffer, + * or NULL if the packet does not exist. + * \see libusb_get_iso_packet_buffer() + */ +static inline unsigned char *libusb_get_iso_packet_buffer_simple( + struct libusb_transfer *transfer, unsigned int packet) +{ + int _packet; + + /* oops..slight bug in the API. packet is an unsigned int, but we use + * signed integers almost everywhere else. range-check and convert to + * signed to avoid compiler warnings. FIXME for libusb-2. */ + if (packet > INT_MAX) + return NULL; + _packet = (int) packet; + + if (_packet >= transfer->num_iso_packets) + return NULL; + + return transfer->buffer + ((int) transfer->iso_packet_desc[0].length * _packet); +} + +/* sync I/O */ + +int LIBUSB_CALL libusb_control_transfer(libusb_device_handle *dev_handle, + uint8_t request_type, uint8_t bRequest, uint16_t wValue, uint16_t wIndex, + unsigned char *data, uint16_t wLength, unsigned int timeout); + +int LIBUSB_CALL libusb_bulk_transfer(libusb_device_handle *dev_handle, + unsigned char endpoint, unsigned char *data, int length, + int *actual_length, unsigned int timeout); + +int LIBUSB_CALL libusb_interrupt_transfer(libusb_device_handle *dev_handle, + unsigned char endpoint, unsigned char *data, int length, + int *actual_length, unsigned int timeout); + +/** \ingroup libusb_desc + * Retrieve a descriptor from the default control pipe. + * This is a convenience function which formulates the appropriate control + * message to retrieve the descriptor. + * + * \param dev_handle a device handle + * \param desc_type the descriptor type, see \ref libusb_descriptor_type + * \param desc_index the index of the descriptor to retrieve + * \param data output buffer for descriptor + * \param length size of data buffer + * \returns number of bytes returned in data, or LIBUSB_ERROR code on failure + */ +static inline int libusb_get_descriptor(libusb_device_handle *dev_handle, + uint8_t desc_type, uint8_t desc_index, unsigned char *data, int length) +{ + return libusb_control_transfer(dev_handle, LIBUSB_ENDPOINT_IN, + LIBUSB_REQUEST_GET_DESCRIPTOR, (uint16_t) ((desc_type << 8) | desc_index), + 0, data, (uint16_t) length, 1000); +} + +/** \ingroup libusb_desc + * Retrieve a descriptor from a device. + * This is a convenience function which formulates the appropriate control + * message to retrieve the descriptor. The string returned is Unicode, as + * detailed in the USB specifications. + * + * \param dev_handle a device handle + * \param desc_index the index of the descriptor to retrieve + * \param langid the language ID for the string descriptor + * \param data output buffer for descriptor + * \param length size of data buffer + * \returns number of bytes returned in data, or LIBUSB_ERROR code on failure + * \see libusb_get_string_descriptor_ascii() + */ +static inline int libusb_get_string_descriptor(libusb_device_handle *dev_handle, + uint8_t desc_index, uint16_t langid, unsigned char *data, int length) +{ + return libusb_control_transfer(dev_handle, LIBUSB_ENDPOINT_IN, + LIBUSB_REQUEST_GET_DESCRIPTOR, (uint16_t)((LIBUSB_DT_STRING << 8) | desc_index), + langid, data, (uint16_t) length, 1000); +} + +int LIBUSB_CALL libusb_get_string_descriptor_ascii(libusb_device_handle *dev_handle, + uint8_t desc_index, unsigned char *data, int length); + +/* polling and timeouts */ + +int LIBUSB_CALL libusb_try_lock_events(libusb_context *ctx); +void LIBUSB_CALL libusb_lock_events(libusb_context *ctx); +void LIBUSB_CALL libusb_unlock_events(libusb_context *ctx); +int LIBUSB_CALL libusb_event_handling_ok(libusb_context *ctx); +int LIBUSB_CALL libusb_event_handler_active(libusb_context *ctx); +void LIBUSB_CALL libusb_interrupt_event_handler(libusb_context *ctx); +void LIBUSB_CALL libusb_lock_event_waiters(libusb_context *ctx); +void LIBUSB_CALL libusb_unlock_event_waiters(libusb_context *ctx); +int LIBUSB_CALL libusb_wait_for_event(libusb_context *ctx, struct timeval *tv); + +int LIBUSB_CALL libusb_handle_events_timeout(libusb_context *ctx, + struct timeval *tv); +int LIBUSB_CALL libusb_handle_events_timeout_completed(libusb_context *ctx, + struct timeval *tv, int *completed); +int LIBUSB_CALL libusb_handle_events(libusb_context *ctx); +int LIBUSB_CALL libusb_handle_events_completed(libusb_context *ctx, int *completed); +int LIBUSB_CALL libusb_handle_events_locked(libusb_context *ctx, + struct timeval *tv); +int LIBUSB_CALL libusb_pollfds_handle_timeouts(libusb_context *ctx); +int LIBUSB_CALL libusb_get_next_timeout(libusb_context *ctx, + struct timeval *tv); + +/** \ingroup libusb_poll + * File descriptor for polling + */ +struct libusb_pollfd { + /** Numeric file descriptor */ + int fd; + + /** Event flags to poll for from . POLLIN indicates that you + * should monitor this file descriptor for becoming ready to read from, + * and POLLOUT indicates that you should monitor this file descriptor for + * nonblocking write readiness. */ + short events; +}; + +/** \ingroup libusb_poll + * Callback function, invoked when a new file descriptor should be added + * to the set of file descriptors monitored for events. + * \param fd the new file descriptor + * \param events events to monitor for, see \ref libusb_pollfd for a + * description + * \param user_data User data pointer specified in + * libusb_set_pollfd_notifiers() call + * \see libusb_set_pollfd_notifiers() + */ +typedef void (LIBUSB_CALL *libusb_pollfd_added_cb)(int fd, short events, + void *user_data); + +/** \ingroup libusb_poll + * Callback function, invoked when a file descriptor should be removed from + * the set of file descriptors being monitored for events. After returning + * from this callback, do not use that file descriptor again. + * \param fd the file descriptor to stop monitoring + * \param user_data User data pointer specified in + * libusb_set_pollfd_notifiers() call + * \see libusb_set_pollfd_notifiers() + */ +typedef void (LIBUSB_CALL *libusb_pollfd_removed_cb)(int fd, void *user_data); + +const struct libusb_pollfd ** LIBUSB_CALL libusb_get_pollfds( + libusb_context *ctx); +void LIBUSB_CALL libusb_free_pollfds(const struct libusb_pollfd **pollfds); +void LIBUSB_CALL libusb_set_pollfd_notifiers(libusb_context *ctx, + libusb_pollfd_added_cb added_cb, libusb_pollfd_removed_cb removed_cb, + void *user_data); + +/** \ingroup libusb_hotplug + * Callback handle. + * + * Callbacks handles are generated by libusb_hotplug_register_callback() + * and can be used to deregister callbacks. Callback handles are unique + * per libusb_context and it is safe to call libusb_hotplug_deregister_callback() + * on an already deregistered callback. + * + * Since version 1.0.16, \ref LIBUSB_API_VERSION >= 0x01000102 + * + * For more information, see \ref libusb_hotplug. + */ +typedef int libusb_hotplug_callback_handle; + +/** \ingroup libusb_hotplug + * + * Since version 1.0.16, \ref LIBUSB_API_VERSION >= 0x01000102 + * + * Hotplug events */ +typedef enum { + /** A device has been plugged in and is ready to use */ + LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED = (1 << 0), + + /** A device has left and is no longer available. + * It is the user's responsibility to call libusb_close on any handle associated with a disconnected device. + * It is safe to call libusb_get_device_descriptor on a device that has left */ + LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT = (1 << 1) +} libusb_hotplug_event; + +/** \ingroup libusb_hotplug + * + * Since version 1.0.16, \ref LIBUSB_API_VERSION >= 0x01000102 + * + * Hotplug flags */ +typedef enum { + /** Arm the callback and fire it for all matching currently attached devices. */ + LIBUSB_HOTPLUG_ENUMERATE = (1 << 0) +} libusb_hotplug_flag; + +/** \ingroup libusb_hotplug + * Convenience macro when not using any flags */ +#define LIBUSB_HOTPLUG_NO_FLAGS 0 + +/** \ingroup libusb_hotplug + * Wildcard matching for hotplug events */ +#define LIBUSB_HOTPLUG_MATCH_ANY -1 + +/** \ingroup libusb_hotplug + * Hotplug callback function type. When requesting hotplug event notifications, + * you pass a pointer to a callback function of this type. + * + * This callback may be called by an internal event thread and as such it is + * recommended the callback do minimal processing before returning. + * + * libusb will call this function later, when a matching event had happened on + * a matching device. See \ref libusb_hotplug for more information. + * + * It is safe to call either libusb_hotplug_register_callback() or + * libusb_hotplug_deregister_callback() from within a callback function. + * + * Since version 1.0.16, \ref LIBUSB_API_VERSION >= 0x01000102 + * + * \param ctx context of this notification + * \param device libusb_device this event occurred on + * \param event event that occurred + * \param user_data user data provided when this callback was registered + * \returns bool whether this callback is finished processing events. + * returning 1 will cause this callback to be deregistered + */ +typedef int (LIBUSB_CALL *libusb_hotplug_callback_fn)(libusb_context *ctx, + libusb_device *device, libusb_hotplug_event event, void *user_data); + +/** \ingroup libusb_hotplug + * Register a hotplug callback function + * + * Register a callback with the libusb_context. The callback will fire + * when a matching event occurs on a matching device. The callback is + * armed until either it is deregistered with libusb_hotplug_deregister_callback() + * or the supplied callback returns 1 to indicate it is finished processing events. + * + * If the \ref LIBUSB_HOTPLUG_ENUMERATE is passed the callback will be + * called with a \ref LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED for all devices + * already plugged into the machine. Note that libusb modifies its internal + * device list from a separate thread, while calling hotplug callbacks from + * libusb_handle_events(), so it is possible for a device to already be present + * on, or removed from, its internal device list, while the hotplug callbacks + * still need to be dispatched. This means that when using \ref + * LIBUSB_HOTPLUG_ENUMERATE, your callback may be called twice for the arrival + * of the same device, once from libusb_hotplug_register_callback() and once + * from libusb_handle_events(); and/or your callback may be called for the + * removal of a device for which an arrived call was never made. + * + * Since version 1.0.16, \ref LIBUSB_API_VERSION >= 0x01000102 + * + * \param[in] ctx context to register this callback with + * \param[in] events bitwise or of hotplug events that will trigger this callback. + * See \ref libusb_hotplug_event + * \param[in] flags bitwise or of hotplug flags that affect registration. + * See \ref libusb_hotplug_flag + * \param[in] vendor_id the vendor id to match or \ref LIBUSB_HOTPLUG_MATCH_ANY + * \param[in] product_id the product id to match or \ref LIBUSB_HOTPLUG_MATCH_ANY + * \param[in] dev_class the device class to match or \ref LIBUSB_HOTPLUG_MATCH_ANY + * \param[in] cb_fn the function to be invoked on a matching event/device + * \param[in] user_data user data to pass to the callback function + * \param[out] callback_handle pointer to store the handle of the allocated callback (can be NULL) + * \returns \ref LIBUSB_SUCCESS on success LIBUSB_ERROR code on failure + */ +int LIBUSB_CALL libusb_hotplug_register_callback(libusb_context *ctx, + int events, int flags, + int vendor_id, int product_id, int dev_class, + libusb_hotplug_callback_fn cb_fn, void *user_data, + libusb_hotplug_callback_handle *callback_handle); + +/** \ingroup libusb_hotplug + * Deregisters a hotplug callback. + * + * Deregister a callback from a libusb_context. This function is safe to call from within + * a hotplug callback. + * + * Since version 1.0.16, \ref LIBUSB_API_VERSION >= 0x01000102 + * + * \param[in] ctx context this callback is registered with + * \param[in] callback_handle the handle of the callback to deregister + */ +void LIBUSB_CALL libusb_hotplug_deregister_callback(libusb_context *ctx, + libusb_hotplug_callback_handle callback_handle); + +/** \ingroup libusb_hotplug + * Gets the user_data associated with a hotplug callback. + * + * Since version v1.0.24 \ref LIBUSB_API_VERSION >= 0x01000108 + * + * \param[in] ctx context this callback is registered with + * \param[in] callback_handle the handle of the callback to get the user_data of + */ +void * LIBUSB_CALL libusb_hotplug_get_user_data(libusb_context *ctx, + libusb_hotplug_callback_handle callback_handle); + +int LIBUSB_CALLV libusb_set_option(libusb_context *ctx, enum libusb_option option, ...); + +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +#if defined(__cplusplus) +} +#endif + +#endif diff --git a/sysroot-arm32/usr/lib/arm-linux-gnueabihf/libudev.so b/sysroot-arm32/usr/lib/arm-linux-gnueabihf/libudev.so new file mode 120000 index 0000000..ed74ea1 --- /dev/null +++ b/sysroot-arm32/usr/lib/arm-linux-gnueabihf/libudev.so @@ -0,0 +1 @@ +../../../lib/arm-linux-gnueabihf/libudev.so.1 \ No newline at end of file diff --git a/sysroot-arm32/usr/lib/arm-linux-gnueabihf/libudev.so.1 b/sysroot-arm32/usr/lib/arm-linux-gnueabihf/libudev.so.1 new file mode 120000 index 0000000..b12b1bf --- /dev/null +++ b/sysroot-arm32/usr/lib/arm-linux-gnueabihf/libudev.so.1 @@ -0,0 +1 @@ +libudev.so.1.7.8 \ No newline at end of file diff --git a/sysroot-arm32/usr/lib/arm-linux-gnueabihf/libudev.so.1.7.8 b/sysroot-arm32/usr/lib/arm-linux-gnueabihf/libudev.so.1.7.8 new file mode 100644 index 0000000..dee3fd4 Binary files /dev/null and b/sysroot-arm32/usr/lib/arm-linux-gnueabihf/libudev.so.1.7.8 differ diff --git a/sysroot-arm32/usr/lib/arm-linux-gnueabihf/libusb-1.0.a b/sysroot-arm32/usr/lib/arm-linux-gnueabihf/libusb-1.0.a new file mode 100644 index 0000000..5405776 Binary files /dev/null and b/sysroot-arm32/usr/lib/arm-linux-gnueabihf/libusb-1.0.a differ diff --git a/sysroot-arm32/usr/lib/arm-linux-gnueabihf/libusb-1.0.so b/sysroot-arm32/usr/lib/arm-linux-gnueabihf/libusb-1.0.so new file mode 120000 index 0000000..1acf7c4 --- /dev/null +++ b/sysroot-arm32/usr/lib/arm-linux-gnueabihf/libusb-1.0.so @@ -0,0 +1 @@ +libusb-1.0.so.0.4.0 \ No newline at end of file diff --git a/sysroot-arm32/usr/lib/arm-linux-gnueabihf/libusb-1.0.so.0 b/sysroot-arm32/usr/lib/arm-linux-gnueabihf/libusb-1.0.so.0 new file mode 120000 index 0000000..1acf7c4 --- /dev/null +++ b/sysroot-arm32/usr/lib/arm-linux-gnueabihf/libusb-1.0.so.0 @@ -0,0 +1 @@ +libusb-1.0.so.0.4.0 \ No newline at end of file diff --git a/sysroot-arm32/usr/lib/arm-linux-gnueabihf/libusb-1.0.so.0.4.0 b/sysroot-arm32/usr/lib/arm-linux-gnueabihf/libusb-1.0.so.0.4.0 new file mode 100644 index 0000000..78dab3a Binary files /dev/null and b/sysroot-arm32/usr/lib/arm-linux-gnueabihf/libusb-1.0.so.0.4.0 differ diff --git a/sysroot-arm32/usr/lib/arm-linux-gnueabihf/pkgconfig/libusb-1.0.pc b/sysroot-arm32/usr/lib/arm-linux-gnueabihf/pkgconfig/libusb-1.0.pc new file mode 100644 index 0000000..84364c4 --- /dev/null +++ b/sysroot-arm32/usr/lib/arm-linux-gnueabihf/pkgconfig/libusb-1.0.pc @@ -0,0 +1,11 @@ +prefix=/usr +exec_prefix=${prefix} +libdir=${prefix}/lib/arm-linux-gnueabihf +includedir=${prefix}/include + +Name: libusb-1.0 +Description: C API for USB device access from Linux, Mac OS X, Windows, OpenBSD/NetBSD and Solaris userspace +Version: 1.0.27 +Libs: -L${libdir} -lusb-1.0 +Libs.private: -ludev +Cflags: -I${includedir}/libusb-1.0 diff --git a/sysroot-arm32/usr/share/doc/libudev1/NEWS.Debian.gz b/sysroot-arm32/usr/share/doc/libudev1/NEWS.Debian.gz new file mode 100644 index 0000000..5c1d261 Binary files /dev/null and b/sysroot-arm32/usr/share/doc/libudev1/NEWS.Debian.gz differ diff --git a/sysroot-arm32/usr/share/doc/libudev1/changelog.Debian.gz b/sysroot-arm32/usr/share/doc/libudev1/changelog.Debian.gz new file mode 100644 index 0000000..9a48911 Binary files /dev/null and b/sysroot-arm32/usr/share/doc/libudev1/changelog.Debian.gz differ diff --git a/sysroot-arm32/usr/share/doc/libudev1/copyright b/sysroot-arm32/usr/share/doc/libudev1/copyright new file mode 100644 index 0000000..62cf732 --- /dev/null +++ b/sysroot-arm32/usr/share/doc/libudev1/copyright @@ -0,0 +1,287 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: systemd +Upstream-Contact: systemd-devel@lists.freedesktop.org +Source: https://www.freedesktop.org/wiki/Software/systemd/ + +Files: * +Copyright: 2008-2015 Kay Sievers + 2010-2015 Lennart Poettering + 2012-2015 Zbigniew Jędrzejewski-Szmek + 2013-2015 Tom Gundersen + 2013-2015 Daniel Mack + 2010-2015 Harald Hoyer + 2013-2015 David Herrmann + 2013, 2014 Thomas H.P. Andersen + 2013, 2014 Daniel Buch + 2014 Susant Sahani + 2009-2015 Intel Corporation + 2000, 2005 Red Hat, Inc. + 2009 Alan Jenkins + 2010 ProFUSION embedded systems + 2010 Maarten Lankhorst + 1995-2004 Miquel van Smoorenburg + 1999 Tom Tromey + 2011 Michal Schmidt + 2012 B. Poettering + 2012 Holger Hans Peter Freyther + 2012 Dan Walsh + 2012 Roberto Sassu + 2013 David Strauss + 2013 Marius Vollmer + 2013 Jan Janssen + 2013 Simon Peeters +License: LGPL-2.1+ + +Files: src/basic/siphash24.h + src/basic/siphash24.c +Copyright: 2012 Jean-Philippe Aumasson + 2012 Daniel J. Bernstein +License: CC0-1.0 + +Files: src/shared/linux/* + src/basic/linux/* +Copyright: 2004-2009 Red Hat, Inc. + 2011-2014 PLUMgrid + 2001-2003 Sistina Software (UK) Limited. + 2008 Ian Kent + 1998 David S. Miller >davem@redhat.com> + 2001 Jeff Garzik + 2006-2010 Johannes Berg + 2008 Luis Carlos Cobo + 2008 Michael Buesch + 2008, 2009 Luis R. Rodriguez + 2008 Jouni Malinen + 2008 Colin McCabe + 2018-2019 Intel Corporation + 2007 Oracle. + 2009 Wolfgang Grandegger + 1999 Thomas Davis + 2015 Sabrina Dubroca + 1999-2000 Maxim Krasnyansky + 2015-2019 Jason A. Donenfeld +License: GPL-2 with Linux-syscall-note exception + +Files: src/basic/sparse-endian.h +Copyright: 2012 Josh Triplett +License: Expat + +Files: src/basic/MurmurHash2.c + src/basic/MurmurHash2.h + src/libsystemd/sd-journal/lookup3.c + src/libsystemd/sd-journal/lookup3.h +Copyright: none +License: public-domain + You can use this free for any purpose. It's in the public domain. It has no + warranty. + +Files: src/udev/ata_id/ata_id.c + src/udev/cdrom_id/cdrom_id.c + src/udev/dmi_memory_id/dmi_memory_id.c + src/udev/mtd_probe/mtd_probe.c + src/udev/mtd_probe/mtd_probe.h + src/udev/mtd_probe/probe_smartmedia.c + src/udev/scsi_id/scsi.h + src/udev/scsi_id/scsi_id.c + src/udev/scsi_id/scsi_id.h + src/udev/scsi_id/scsi_serial.c + src/udev/udevadm.c + src/udev/udevadm-control.c + src/udev/udevadm.h + src/udev/udevadm-info.c + src/udev/udevadm-monitor.c + src/udev/udevadm-settle.c + src/udev/udevadm-test-builtin.c + src/udev/udevadm-test.c + src/udev/udevadm-trigger.c + src/udev/udevadm-util.c + src/udev/udevadm-util.h + src/udev/udev-builtin-blkid.c + src/udev/udev-builtin.h + src/udev/udev-builtin-input_id.c + src/udev/udev-builtin-kmod.c + src/udev/udev-builtin-path_id.c + src/udev/udev-builtin-uaccess.c + src/udev/udev-builtin-usb_id.c + src/udev/udev-ctrl.h + src/udev/udevd.c + src/udev/udevd.h + src/udev/udev-event.c + src/udev/udev-event.h + src/udev/udev-node.c + src/udev/udev-node.h + src/udev/udev-rules.c + src/udev/udev-rules.h + src/udev/udev-watch.c + src/udev/udev-watch.h + src/udev/v4l_id/v4l_id.c +Copyright: 2003-2012 Kay Sievers + 2003-2004 Greg Kroah-Hartman + 2004 Chris Friesen + 2004, 2009, 2010 David Zeuthen + 2005, 2006 SUSE Linux Products GmbH + 2003 IBM Corp. + 2007 Hannes Reinecke + 2009 Canonical Ltd. + 2009 Scott James Remnant + 2009 Martin Pitt + 2009 Piter Punk + 2009, 2010 Lennart Poettering + 2009 Filippo Argiolas + 2010 Maxim Levitsky + 2011 ProFUSION embedded systems + 2011 Karel Zak + 2014 Zbigniew Jędrzejewski-Szmek + 2014 David Herrmann + 2014 Carlos Garnacho +License: GPL-2+ + +Files: debian/* +Copyright: 2010-2013 Tollef Fog Heen + 2011 Josh Triplett + 2013-2014 Michael Stapelberg + 2013-2020 Martin Pitt + 2013-2022 Michael Biebl + 2013 Daniel Schaal + 2013 Guido Günther + 2014-2015 Didier Roche + 2014-2015 Marco d'Itri + 2014-2017 Sjoerd Simons + 2014 Ansgar Burchardt + 2014 Jon Severinsson + 2015-2019 Felipe Sateler + 2015 Adam Conrad + 2015 Andreas Henriksson + 2015 Christian Seiler + 2015 Julian Wollrath + 2016-2018 Evgeny Vereshchagin + 2016,2018 Laurent Bigonville + 2016-2019 Dimitri John Ledkov + 2016,2019 Michael Prokop + 2016 Alexander Kurtz + 2016 Antonio Ospite + 2016 Iain Lane + 2016 Simon McVittie + 2017-2018 Nicolas Braud-Santoni + 2017-2019 Martin Pitt + 2017 Cyril Brulebois + 2017 Ondřej Nový + 2018-2019 Mert Dirik + 2018 Adam Borowski + 2018 Alf Gaida + 2018 Benjamin Drung + 2018 Gunnar Hjalmarsson + 2018 Manuel A. Fernandez Montecelo + 2019-2021 Balint Reczey + 2019-2021 Dan Streetman + 2019 Daniel Kahn Gillmor + 2020-2021 Helmut Grohne + 2020 Topi Miettinen + 2020 Youfu Zhang + 2020 Zbigniew Jędrzejewski-Szmek + 2020 наб + 2021-2022 Luca Boccassi + 2021-2022 Lukas Märdian + 2021 Frantisek Sumsal + 2021 Ioanna Alifieraki + 2021 Jan Kiszka + 2021 Matthias Klumpp + 2021 Salvatore Bonaccorso +License: LGPL-2.1+ + +License: Expat + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + . + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + . + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + IN THE SOFTWARE. + +License: GPL-2 with Linux-syscall-note exception + NOTE! This copyright does *not* cover user programs that use kernel services + by normal system calls - this is merely considered normal use of the kernel, + and does *not* fall under the heading of "derived work". Also note that the + GPL below is copyrighted by the Free Software Foundation, but the instance of + code that it refers to (the Linux kernel) is copyrighted by me and others who + actually wrote it. + . + Also note that the only valid version of the GPL as far as the kernel is + concerned is _this_ particular version of the license (ie v2, not v2.2 or v3.x + or whatever), unless explicitly otherwise stated. + . + Linus Torvalds + . + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + . + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + . + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. + . + On Debian and systems the full text of the GNU General Public + License version 2 can be found in the file + `/usr/share/common-licenses/GPL-2` + +License: GPL-2+ + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + . + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + . + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + . + On Debian systems, the complete text of the GNU General Public License + version 2 can be found in ‘/usr/share/common-licenses/GPL-2’. + +License: LGPL-2.1+ + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1, or (at your option) + any later version. + . + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + . + You should have received a copy of the GNU Lesser General Public License along + with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + . + On Debian systems, the complete text of the GNU Lesser General Public + License version 2.1 can be found in ‘/usr/share/common-licenses/LGPL-2.1’. + +License: CC0-1.0 + To the extent possible under law, the author(s) have dedicated all copyright + and related and neighboring rights to this software to the public domain + worldwide. This software is distributed without any warranty. + . + You should have received a copy of the CC0 Public Domain Dedication along with + this software. If not, see . + . + On Debian systems, the complete text of the CC0 1.0 Universal license can be + found in ‘/usr/share/common-licenses/CC0-1.0’. diff --git a/sysroot-arm32/usr/share/doc/libusb-1.0-0-dev/README b/sysroot-arm32/usr/share/doc/libusb-1.0-0-dev/README new file mode 120000 index 0000000..ecbd147 --- /dev/null +++ b/sysroot-arm32/usr/share/doc/libusb-1.0-0-dev/README @@ -0,0 +1 @@ +../libusb-1.0-0/README \ No newline at end of file diff --git a/sysroot-arm32/usr/share/doc/libusb-1.0-0-dev/changelog.Debian.gz b/sysroot-arm32/usr/share/doc/libusb-1.0-0-dev/changelog.Debian.gz new file mode 120000 index 0000000..8e3297c --- /dev/null +++ b/sysroot-arm32/usr/share/doc/libusb-1.0-0-dev/changelog.Debian.gz @@ -0,0 +1 @@ +../libusb-1.0-0/changelog.Debian.gz \ No newline at end of file diff --git a/sysroot-arm32/usr/share/doc/libusb-1.0-0-dev/copyright b/sysroot-arm32/usr/share/doc/libusb-1.0-0-dev/copyright new file mode 100644 index 0000000..5890798 --- /dev/null +++ b/sysroot-arm32/usr/share/doc/libusb-1.0-0-dev/copyright @@ -0,0 +1,121 @@ +This package was debianized by Christopher L Cheney on +Wed, 13 Jun 2001 12:21:44 -0500. + +It was downloaded from http://www.libusb.info + + +Authors: + Alan Ott + Alan Stern + Alex Vatchenko + Andrew Fernandes + Anthony Clay + Artem Egorkine + Aurelien Jarno + Bastien Nocera + Bei Zhang + Benjamin Dobell + Chris Dickens + Colin Walters + Dave Camarillo + David Engraf + David Moore + Davidlohr Bueso + Federico Manzan + Felipe Balbi + Florian Albrechtskirchinger + Francesco Montorsi + Francisco Facioni + Graeme Gill + Gustavo Zacarias + Hans Ulrich Niedermann + Hector Martin + Hoi-Ho Chan + Ilya Konstantinov + James Hanko + Joshua Blake + Karsten Koenig + Konrad Rzepecki + Kuangye Guo + Lars Wirzenius + Luca Longinotti + Martin Koegler + Matthias Bolte + Mike Frysinger + Mikhail Gusarov + Moritz Fischer + Nicholas Corgan + Omri Iluz + Orin Eman + Paul Fertser + Pekka Nikander + Rob Walker + Sean McBride + Sebastian Pipping + Simon Haggett + Thomas Röfer + Tim Roberts + Toby Peterson + Trygve Laugstøl + Uri Lublin + Vasily Khoruzhick + Vegard Storheil Eriksen + Vitali Lovich + Xiaofan Chen + Zoltán Kovács + Роман Донченко + xantares + + +Copyright: + Copyright (C) 2001 Johannes Erdfelt + Copyright (C) 2007-2009 Daniel Drake + Copyright (C) 2010-2012 Peter Stuge + Copyright (C) 2008-2013 Nathan Hjelm + Copyright (C) 2009-2013 Pete Batard + Copyright (C) 2009-2013 Ludovic Rousseau + Copyright (C) 2010-2012 Michael Plante + Copyright (C) 2011-2013 Hans de Goede + Copyright (C) 2012-2013 Martin Pieuchot + + +License of the libusb library and most examples except ezusb and fxload: + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. + +On Debian systems, the complete text of the LGPL license can be found +in the /usr/share/common-licenses/LGPL-2.1 file. + + +License of ezusb and fxload: + This source code is free software; you can redistribute it + and/or modify it in source code form under the terms of the GNU + General Public License as published by the Free Software + Foundation; either version 2 of the License, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 + USA. + +On Debian systems, the complete text of the GPL license can be found +in the /usr/share/common-licenses/GPL-2 file. + diff --git a/sysroot-arm32/usr/share/doc/libusb-1.0-0/README b/sysroot-arm32/usr/share/doc/libusb-1.0-0/README new file mode 100644 index 0000000..0f66085 --- /dev/null +++ b/sysroot-arm32/usr/share/doc/libusb-1.0-0/README @@ -0,0 +1,29 @@ +# libusb + +libusb is a library for USB device access from Linux, macOS, +Windows, OpenBSD/NetBSD, Haiku, Solaris userspace, and WebAssembly +via WebUSB. +It is written in C (Haiku backend in C++) and licensed under the GNU +Lesser General Public License version 2.1 or, at your option, any later +version (see COPYING). + +libusb is abstracted internally in such a way that it can hopefully +be ported to other operating systems. Please see the PORTING +file for more information. + +libusb homepage: +https://libusb.info/ + +Developers will wish to consult the API documentation: +http://api.libusb.info + +Use the mailing list for questions, comments, etc: +http://mailing-list.libusb.info + +- Hans de Goede +- Xiaofan Chen +- Ludovic Rousseau +- Nathan Hjelm +- Chris Dickens + +(Please use the mailing list rather than mailing developers directly) diff --git a/sysroot-arm32/usr/share/doc/libusb-1.0-0/changelog.Debian.gz b/sysroot-arm32/usr/share/doc/libusb-1.0-0/changelog.Debian.gz new file mode 100644 index 0000000..778afe2 Binary files /dev/null and b/sysroot-arm32/usr/share/doc/libusb-1.0-0/changelog.Debian.gz differ diff --git a/sysroot-arm32/usr/share/doc/libusb-1.0-0/copyright b/sysroot-arm32/usr/share/doc/libusb-1.0-0/copyright new file mode 100644 index 0000000..5890798 --- /dev/null +++ b/sysroot-arm32/usr/share/doc/libusb-1.0-0/copyright @@ -0,0 +1,121 @@ +This package was debianized by Christopher L Cheney on +Wed, 13 Jun 2001 12:21:44 -0500. + +It was downloaded from http://www.libusb.info + + +Authors: + Alan Ott + Alan Stern + Alex Vatchenko + Andrew Fernandes + Anthony Clay + Artem Egorkine + Aurelien Jarno + Bastien Nocera + Bei Zhang + Benjamin Dobell + Chris Dickens + Colin Walters + Dave Camarillo + David Engraf + David Moore + Davidlohr Bueso + Federico Manzan + Felipe Balbi + Florian Albrechtskirchinger + Francesco Montorsi + Francisco Facioni + Graeme Gill + Gustavo Zacarias + Hans Ulrich Niedermann + Hector Martin + Hoi-Ho Chan + Ilya Konstantinov + James Hanko + Joshua Blake + Karsten Koenig + Konrad Rzepecki + Kuangye Guo + Lars Wirzenius + Luca Longinotti + Martin Koegler + Matthias Bolte + Mike Frysinger + Mikhail Gusarov + Moritz Fischer + Nicholas Corgan + Omri Iluz + Orin Eman + Paul Fertser + Pekka Nikander + Rob Walker + Sean McBride + Sebastian Pipping + Simon Haggett + Thomas Röfer + Tim Roberts + Toby Peterson + Trygve Laugstøl + Uri Lublin + Vasily Khoruzhick + Vegard Storheil Eriksen + Vitali Lovich + Xiaofan Chen + Zoltán Kovács + Роман Донченко + xantares + + +Copyright: + Copyright (C) 2001 Johannes Erdfelt + Copyright (C) 2007-2009 Daniel Drake + Copyright (C) 2010-2012 Peter Stuge + Copyright (C) 2008-2013 Nathan Hjelm + Copyright (C) 2009-2013 Pete Batard + Copyright (C) 2009-2013 Ludovic Rousseau + Copyright (C) 2010-2012 Michael Plante + Copyright (C) 2011-2013 Hans de Goede + Copyright (C) 2012-2013 Martin Pieuchot + + +License of the libusb library and most examples except ezusb and fxload: + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. + +On Debian systems, the complete text of the LGPL license can be found +in the /usr/share/common-licenses/LGPL-2.1 file. + + +License of ezusb and fxload: + This source code is free software; you can redistribute it + and/or modify it in source code form under the terms of the GNU + General Public License as published by the Free Software + Foundation; either version 2 of the License, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 + USA. + +On Debian systems, the complete text of the GPL license can be found +in the /usr/share/common-licenses/GPL-2 file. + diff --git a/sysroot-arm64/index.html b/sysroot-arm64/index.html new file mode 100644 index 0000000..c4f143b --- /dev/null +++ b/sysroot-arm64/index.html @@ -0,0 +1,5038 @@ + + + + + + + + + Enterprise Open Source and Linux + | Ubuntu + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + +
+
+
+
+

Ubuntu 26.04 LTS Resolute Raccoon is available for download

+

+ Discover the latest and greatest features in our most recent long term supported release. +

+
+
+ +
+
+ + + + +
+
+
+ + + + + +
+ +
+ + +
+ +
+ + + +
+
+
+
+
+

Modern enterprise open source

+

+ Security, support, and managed services from +
+ the publisher of Ubuntu. +

+
+

+ Get Ubuntu Pro + Access a 30-day free trial › +

+
+
+
    +
  • + AWS +
  • +
  • + Microsoft Azure +
  • +
  • + AT&T +
  • +
  • + Google Cloud +
  • +
+
+
+
+ +
+
+
+ + + + + +
+ +
+ +

+ + + Latest news from + + our blog › +

+
+
+
+
+
Loading...
+
+
+ +
+
+ +
+ + + + + + + + + +
+ + +
+
+
+
+
+

Energize your engineers

+

Better security. More packages. Newer tools. All your open source, from cloud to edge.

+
+
+

+ Loved by developers and trusted by enterprises. Ubuntu is the first pick for organizations to support their software infrastructure and the OS chosen by 66% of experienced developers. (HackerEarth, Developer Survey, 2020) +

+
+
    +
  • Authentically open source
  • +
  • Secure by design
  • +
  • A release cadence you can depend on
  • +
  • Stability through long term support
  • +
+

That's why Ubuntu supports the fastest, biggest, and most successful digital operations.

+
+

+ Download our guide to adopting Linux securely in your enterprise › +

+

+ Build your AI models on Ubuntu › +

+
+
+
+ +
+
+
+
+ +
+
+
+
+
+

Open source security

+

+ Ubuntu Pro is more than Linux. +
+ Security and compliance for the full stack. +

+
+

+ Secure your open source apps. Patch the full stack, from kernel to library and applications, for CVE compliance. Governments and auditors certify Ubuntu for FedRAMP, FISMA, and HITECH. +

+
+
+
    +
  • + NIST +
  • +
  • + ASEC +
  • +
  • + DISA +
  • +
  • + CIS +
  • +
  • + CSEC +
  • +
+
+
+ +
    +
  • +

    Up to 15 years of security maintenance

    +
  • +
  • +

    + Kernel Livepatch for 24/7 patching with no downtime +

    +
  • +
  • +

    + Expanded security for infrastructure and applications +

    +
  • +
  • +

    + FIPS 140-2 cryptographic modules certified by NIST +

    +
  • +
+ + + +
+ +
+
+
+
+
+ +
+
+
+
+

Significant enterprise savings

+

Sustainable open source at the lowest cost, everywhere.

+
+
+

+ Rethink what's possible with Linux and open source. Companies engage Canonical to drive down open source operating costs. Automate everything: multi-cloud operations, bare metal provisioning, edge clusters, and IoT. +

+
+ +
+

+ Let's talk open source +

+
+
+
+ +
+
+
+
+

Public cloud optimization

+

Most public cloud instances are Ubuntu, for performance and security.

+
+
+
+ +
+
+ +
+
+ +
+
+
+
+
+
    +
  • +

    Optimized kernels for AWS, Azure, Google, Oracle, IBM

    +
  • +
  • +

    + FIPS, CIS hardening, and CVE fixes with Ubuntu Pro +

    +
  • +
  • +

    + Minimize rolling reboots with Kernel Livepatch +

    +
  • +
  • +

    Network & storage performance optimization

    +
  • +
+ +
    +
  • +

    Containerization and cloud-native migration service

    +
  • +
  • +

    Fully managed application service

    +
  • +
+ +
+
+ +
+
+ +
+
+
+
+

Multi-cloud Kubernetes and containers

+

+ AKS. EKS. GKE. Kubeadm. MicroK8s. Charmed Kubernetes. +

+

All on Ubuntu.

+
+
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+ + +
+
+
+ +
+
+
+
+
+ +
+
+ +
+
+
+
+

Carrier–grade private cloud

+

+ Operate private cloud the smart way – supported or fully managed. +

+
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+ + + + +
+
+ +
+
+ +
+
+
+
+
+ +
+
+
+
+

Ultra secure things

+

+ Ubuntu Core with transactional updates for a better embedded Linux. +

+
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
    +
  • OTA compressed updates for apps, kernel, and OS
  • +
  • Automatic rollback and data snapshots
  • +
  • + Managed private app stores for secure fleet management +
  • +
  • DevSecOps pipeline for edge app delivery
  • +
  • Built-in device recovery and remote disk repair
  • +
  • Up to 15 years of security maintenance for devices
  • +
  • Provable system and software integrity
  • +
  • Secure boot backed by root of trust
  • +
  • Full disk encryption with hardware keys
  • +
  • + Support for real-time compute +
  • +
  • FIPS-certifiable embedded Linux
  • +
+
+
+ +
+
+ +
+
+ +
+
+
+ +
+
+
+

Workstations and desktops

+

+ Optimized AI/ML and cloud devops. +
+ The professional developer's preference. +

+ +
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+ + +
    +
  • +

    Configuration lockdown

    +
  • +
  • +

    Local Kubernetes for offline development

    +
  • +
  • +

    + Instant Ubuntu on Windows and macOS with WSL and Multipass +

    +
  • +
  • +

    + Optimized images and certified workstations +

    +
  • +
+ +
+
+ +
+
+ +
+
+
+
+ +
+
+
+

Data center automation

+

+ Turn a rack into a bare metal cloud. +
+ Metal-as-a-Service provisions Windows, ESXi, and Linux. +

+
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+
    +
  • +

    + Bare metal cloud with on-demand servers +

    +
  • +
  • +

    Remote edge cluster operations

    +
  • +
  • +

    + Infrastructure monitoring and discovery +

    +
  • +
  • +

    + Ansible, Chef, Puppet, SALT, Juju integration +

    +
  • +
+
    +
  • +

    + Super fast install from scratch +

    +
  • +
  • +

    VMWare ESXi, Windows, CentOS, RHEL, Ubuntu

    +
  • +
  • +

    Custom images with pre-installed apps

    +
  • +
  • +

    + Disk and network configuration +

    +
  • +
+
    +
  • +

    API-driven DHCP, DNS, PXE, IPAM, provisioning

    +
  • +
  • +

    LDAP authentication and RBAC

    +
  • +
+
+
+ +
+
+ +
+
+
+ +
+
+
+

Smart robots of all shapes and sizes

+

+ From turtles to trucks, Ubuntu drives the robot revolution. +

+
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+ +
    +
  • +

    + Full support for ROS and ROS2 +

    +
  • +
  • +

    Security patches for long-term ROS

    +
  • +
  • +

    Fault tolerant over-the-air updates

    +
  • +
  • +

    + CIS certification +

    +
  • +
+
    +
  • +

    Trim time-to-market with SMART START consulting

    +
  • +
  • +

    Leading Robot-as-a-Platform ecosystem

    +
  • +
  • +

    Curated app stores

    +
  • +
+ +
+
+ +
+
+ +
+
+
+ +
+
+
+

Multi–cloud applications – beyond PAAS

+

+ Universal model-driven operators for classic and Kubernetes estate. +

+
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+ +
    +
  • +

    Operate smoothly across public and private cloud

    +
  • +
  • +

    Reusable integration code as open source packages

    +
  • +
  • +

    Python Operator Framework for rapid development

    +
  • +
  • +

    Bring the K8s operator pattern to classic workloads

    +
  • +
+
    +
  • +

    Lifecycle management and Day 2 operations

    +
  • +
  • +

    + Open collection of community-driven operators +

    +
  • +
+ + +
+ + + + + + + + + + + +
+ +
+ + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sysroot-arm64/index.html.1 b/sysroot-arm64/index.html.1 new file mode 100644 index 0000000..bb9002f --- /dev/null +++ b/sysroot-arm64/index.html.1 @@ -0,0 +1,5038 @@ + + + + + + + + + Enterprise Open Source and Linux + | Ubuntu + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + +
+
+
+
+

Ubuntu 26.04 LTS Resolute Raccoon is available for download

+

+ Discover the latest and greatest features in our most recent long term supported release. +

+
+
+ +
+
+ + + + +
+
+
+ + + + + +
+ +
+ + +
+ +
+ + + +
+
+
+
+
+

Modern enterprise open source

+

+ Security, support, and managed services from +
+ the publisher of Ubuntu. +

+
+

+ Get Ubuntu Pro + Access a 30-day free trial › +

+
+
+
    +
  • + AWS +
  • +
  • + Microsoft Azure +
  • +
  • + AT&T +
  • +
  • + Google Cloud +
  • +
+
+
+
+ +
+
+
+ + + + + +
+ +
+ +

+ + + Latest news from + + our blog › +

+
+
+
+
+
Loading...
+
+
+ +
+
+ +
+ + + + + + + + + +
+ + +
+
+
+
+
+

Energize your engineers

+

Better security. More packages. Newer tools. All your open source, from cloud to edge.

+
+
+

+ Loved by developers and trusted by enterprises. Ubuntu is the first pick for organizations to support their software infrastructure and the OS chosen by 66% of experienced developers. (HackerEarth, Developer Survey, 2020) +

+
+
    +
  • Authentically open source
  • +
  • Secure by design
  • +
  • A release cadence you can depend on
  • +
  • Stability through long term support
  • +
+

That's why Ubuntu supports the fastest, biggest, and most successful digital operations.

+
+

+ Download our guide to adopting Linux securely in your enterprise › +

+

+ Build your AI models on Ubuntu › +

+
+
+
+ +
+
+
+
+ +
+
+
+
+
+

Open source security

+

+ Ubuntu Pro is more than Linux. +
+ Security and compliance for the full stack. +

+
+

+ Secure your open source apps. Patch the full stack, from kernel to library and applications, for CVE compliance. Governments and auditors certify Ubuntu for FedRAMP, FISMA, and HITECH. +

+
+
+
    +
  • + NIST +
  • +
  • + ASEC +
  • +
  • + DISA +
  • +
  • + CIS +
  • +
  • + CSEC +
  • +
+
+
+ +
    +
  • +

    Up to 15 years of security maintenance

    +
  • +
  • +

    + Kernel Livepatch for 24/7 patching with no downtime +

    +
  • +
  • +

    + Expanded security for infrastructure and applications +

    +
  • +
  • +

    + FIPS 140-2 cryptographic modules certified by NIST +

    +
  • +
+ + + +
+ +
+
+
+
+
+ +
+
+
+
+

Significant enterprise savings

+

Sustainable open source at the lowest cost, everywhere.

+
+
+

+ Rethink what's possible with Linux and open source. Companies engage Canonical to drive down open source operating costs. Automate everything: multi-cloud operations, bare metal provisioning, edge clusters, and IoT. +

+
+ +
+

+ Let's talk open source +

+
+
+
+ +
+
+
+
+

Public cloud optimization

+

Most public cloud instances are Ubuntu, for performance and security.

+
+
+
+ +
+
+ +
+
+ +
+
+
+
+
+
    +
  • +

    Optimized kernels for AWS, Azure, Google, Oracle, IBM

    +
  • +
  • +

    + FIPS, CIS hardening, and CVE fixes with Ubuntu Pro +

    +
  • +
  • +

    + Minimize rolling reboots with Kernel Livepatch +

    +
  • +
  • +

    Network & storage performance optimization

    +
  • +
+ +
    +
  • +

    Containerization and cloud-native migration service

    +
  • +
  • +

    Fully managed application service

    +
  • +
+ +
+
+ +
+
+ +
+
+
+
+

Multi-cloud Kubernetes and containers

+

+ AKS. EKS. GKE. Kubeadm. MicroK8s. Charmed Kubernetes. +

+

All on Ubuntu.

+
+
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+ + +
+
+
+ +
+
+
+
+
+ +
+
+ +
+
+
+
+

Carrier–grade private cloud

+

+ Operate private cloud the smart way – supported or fully managed. +

+
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+ + + + +
+
+ +
+
+ +
+
+
+
+
+ +
+
+
+
+

Ultra secure things

+

+ Ubuntu Core with transactional updates for a better embedded Linux. +

+
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
    +
  • OTA compressed updates for apps, kernel, and OS
  • +
  • Automatic rollback and data snapshots
  • +
  • + Managed private app stores for secure fleet management +
  • +
  • DevSecOps pipeline for edge app delivery
  • +
  • Built-in device recovery and remote disk repair
  • +
  • Up to 15 years of security maintenance for devices
  • +
  • Provable system and software integrity
  • +
  • Secure boot backed by root of trust
  • +
  • Full disk encryption with hardware keys
  • +
  • + Support for real-time compute +
  • +
  • FIPS-certifiable embedded Linux
  • +
+
+
+ +
+
+ +
+
+ +
+
+
+ +
+
+
+

Workstations and desktops

+

+ Optimized AI/ML and cloud devops. +
+ The professional developer's preference. +

+ +
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+ + +
    +
  • +

    Configuration lockdown

    +
  • +
  • +

    Local Kubernetes for offline development

    +
  • +
  • +

    + Instant Ubuntu on Windows and macOS with WSL and Multipass +

    +
  • +
  • +

    + Optimized images and certified workstations +

    +
  • +
+ +
+
+ +
+
+ +
+
+
+
+ +
+
+
+

Data center automation

+

+ Turn a rack into a bare metal cloud. +
+ Metal-as-a-Service provisions Windows, ESXi, and Linux. +

+
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+
    +
  • +

    + Bare metal cloud with on-demand servers +

    +
  • +
  • +

    Remote edge cluster operations

    +
  • +
  • +

    + Infrastructure monitoring and discovery +

    +
  • +
  • +

    + Ansible, Chef, Puppet, SALT, Juju integration +

    +
  • +
+
    +
  • +

    + Super fast install from scratch +

    +
  • +
  • +

    VMWare ESXi, Windows, CentOS, RHEL, Ubuntu

    +
  • +
  • +

    Custom images with pre-installed apps

    +
  • +
  • +

    + Disk and network configuration +

    +
  • +
+
    +
  • +

    API-driven DHCP, DNS, PXE, IPAM, provisioning

    +
  • +
  • +

    LDAP authentication and RBAC

    +
  • +
+
+
+ +
+
+ +
+
+
+ +
+
+
+

Smart robots of all shapes and sizes

+

+ From turtles to trucks, Ubuntu drives the robot revolution. +

+
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+ +
    +
  • +

    + Full support for ROS and ROS2 +

    +
  • +
  • +

    Security patches for long-term ROS

    +
  • +
  • +

    Fault tolerant over-the-air updates

    +
  • +
  • +

    + CIS certification +

    +
  • +
+
    +
  • +

    Trim time-to-market with SMART START consulting

    +
  • +
  • +

    Leading Robot-as-a-Platform ecosystem

    +
  • +
  • +

    Curated app stores

    +
  • +
+ +
+
+ +
+
+ +
+
+
+ +
+
+
+

Multi–cloud applications – beyond PAAS

+

+ Universal model-driven operators for classic and Kubernetes estate. +

+
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+ +
    +
  • +

    Operate smoothly across public and private cloud

    +
  • +
  • +

    Reusable integration code as open source packages

    +
  • +
  • +

    Python Operator Framework for rapid development

    +
  • +
  • +

    Bring the K8s operator pattern to classic workloads

    +
  • +
+
    +
  • +

    Lifecycle management and Day 2 operations

    +
  • +
  • +

    + Open collection of community-driven operators +

    +
  • +
+ + +
+ + + + + + + + + + + +
+ +
+ + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sysroot-arm64/index.html.2 b/sysroot-arm64/index.html.2 new file mode 100644 index 0000000..52d8f6f --- /dev/null +++ b/sysroot-arm64/index.html.2 @@ -0,0 +1,511 @@ + + + + + Launchpad + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+
+
+ + + +
+ +
+
+ + +
+ +
+ + +
+ + + + +
+ +
+ +
+
+ +
+
+
+ + +
+ +
+ 49,106 projects, + 2,108,367 bugs, + 1,009,234 branches, + 119,025 Git repositories, + 3,185,634 translations, + 822,311 answers, + 76,426 blueprints, + and counting... +
+
+
+ +
+
+
+

Launchpad

+

A software collaboration platform that provides

+
+
+
+
+

Bug tracking

+

One place to track bugs across project boundaries and tools

+
+
+

Code hosting using Git

+

Easy for anyone to get your project's code using Git

+
+
+

Code reviews

+

Full control of who can land code in your project remains with you

+
+
+

Ubuntu package building and hosting

+

Publishing your software is simple with Personal Package Archives

+
+
+
+
+

Crowd source translations

+

Build an open community to translate your software into almost any language

+
+
+

Mailing lists

+

Find and work with the right people by building a social network of individuals and teams around projects

+
+
+

Answer tracking and FAQs

+

Free software thrives on people helping each other when the unexpected happens

+
+
+

Specification tracking

+

Track ideas and chunks of work as “blueprints”

+
+
+
+
+
+ +
+
+
+

Get started

+
+
+ + Learn more about Launchpad in the + user guide. + + If you're ready, you can: + + +
+
+
+ +
+ +
+ +
+
+ + +
+
+ + + + + + + + + +
+ + + + + + + + + + + + + + + + + diff --git a/sysroot-arm64/libudev1_255.4-1ubuntu8.16_arm64.deb b/sysroot-arm64/libudev1_255.4-1ubuntu8.16_arm64.deb new file mode 100644 index 0000000..460184c Binary files /dev/null and b/sysroot-arm64/libudev1_255.4-1ubuntu8.16_arm64.deb differ diff --git a/sysroot-arm64/libudev1_255.4-1ubuntu8.5_arm64.deb b/sysroot-arm64/libudev1_255.4-1ubuntu8.5_arm64.deb new file mode 100644 index 0000000..118a9ae Binary files /dev/null and b/sysroot-arm64/libudev1_255.4-1ubuntu8.5_arm64.deb differ diff --git a/sysroot-arm64/libusb-1.0-0-dev_1.0.27-1_arm64.deb b/sysroot-arm64/libusb-1.0-0-dev_1.0.27-1_arm64.deb new file mode 100644 index 0000000..9d38b0d Binary files /dev/null and b/sysroot-arm64/libusb-1.0-0-dev_1.0.27-1_arm64.deb differ diff --git a/sysroot-arm64/libusb-1.0-0_1.0.27-1_arm64.deb b/sysroot-arm64/libusb-1.0-0_1.0.27-1_arm64.deb new file mode 100644 index 0000000..a287d70 Binary files /dev/null and b/sysroot-arm64/libusb-1.0-0_1.0.27-1_arm64.deb differ diff --git a/sysroot-arm64/usr/include/libusb-1.0/libusb.h b/sysroot-arm64/usr/include/libusb-1.0/libusb.h new file mode 100644 index 0000000..f4e9203 --- /dev/null +++ b/sysroot-arm64/usr/include/libusb-1.0/libusb.h @@ -0,0 +1,2311 @@ +/* + * Public libusb header file + * Copyright © 2001 Johannes Erdfelt + * Copyright © 2007-2008 Daniel Drake + * Copyright © 2012 Pete Batard + * Copyright © 2012-2023 Nathan Hjelm + * Copyright © 2014-2020 Chris Dickens + * For more information, please visit: https://libusb.info + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef LIBUSB_H +#define LIBUSB_H + +#if defined(_MSC_VER) +#pragma warning(push) +/* Disable: warning C4200: nonstandard extension used : zero-sized array in struct/union */ +#pragma warning(disable:4200) +/* on MS environments, the inline keyword is available in C++ only */ +#if !defined(__cplusplus) +#define inline __inline +#endif +/* ssize_t is also not available */ +#ifndef _SSIZE_T_DEFINED +#define _SSIZE_T_DEFINED +#include +typedef SSIZE_T ssize_t; +#endif /* _SSIZE_T_DEFINED */ +#endif /* _MSC_VER */ + +#include +#include +#include +#if !defined(_MSC_VER) +#include +#endif +#include + +#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) +#define LIBUSB_FLEXIBLE_ARRAY /* [] - valid C99 code */ +#else +#define LIBUSB_FLEXIBLE_ARRAY 0 /* [0] - non-standard, but usually working code */ +#endif /* __STDC_VERSION__ */ + +/* 'interface' might be defined as a macro on Windows, so we need to + * undefine it so as not to break the current libusb API, because + * libusb_config_descriptor has an 'interface' member + * As this can be problematic if you include windows.h after libusb.h + * in your sources, we force windows.h to be included first. */ +#if defined(_WIN32) || defined(__CYGWIN__) +#include +#if defined(interface) +#undef interface +#endif +#if !defined(__CYGWIN__) +#include +#endif +#endif /* _WIN32 || __CYGWIN__ */ + +#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)) +#define LIBUSB_DEPRECATED_FOR(f) __attribute__ ((deprecated ("Use " #f " instead"))) +#elif defined(__GNUC__) && (__GNUC__ >= 3) +#define LIBUSB_DEPRECATED_FOR(f) __attribute__ ((deprecated)) +#elif defined(_MSC_VER) +#define LIBUSB_DEPRECATED_FOR(f) __declspec(deprecated("Use " #f " instead")) +#else +#define LIBUSB_DEPRECATED_FOR(f) +#endif /* __GNUC__ */ + +#if defined(__GNUC__) +#define LIBUSB_PACKED __attribute__ ((packed)) +#else +#define LIBUSB_PACKED +#endif /* __GNUC__ */ + +/** \def LIBUSB_CALL + * \ingroup libusb_misc + * libusb's Windows calling convention. + * + * Under Windows, the selection of available compilers and configurations + * means that, unlike other platforms, there is not one true calling + * convention (calling convention: the manner in which parameters are + * passed to functions in the generated assembly code). + * + * Matching the Windows API itself, libusb uses the WINAPI convention (which + * translates to the stdcall convention) and guarantees that the + * library is compiled in this way. The public header file also includes + * appropriate annotations so that your own software will use the right + * convention, even if another convention is being used by default within + * your codebase. + * + * The one consideration that you must apply in your software is to mark + * all functions which you use as libusb callbacks with this LIBUSB_CALL + * annotation, so that they too get compiled for the correct calling + * convention. + * + * On non-Windows operating systems, this macro is defined as nothing. This + * means that you can apply it to your code without worrying about + * cross-platform compatibility. + */ +/* LIBUSB_CALL must be defined on both definition and declaration of libusb + * functions. You'd think that declaration would be enough, but cygwin will + * complain about conflicting types unless both are marked this way. + * The placement of this macro is important too; it must appear after the + * return type, before the function name. See internal documentation for + * API_EXPORTED. + */ +#if defined(_WIN32) || defined(__CYGWIN__) +#define LIBUSB_CALL WINAPI +#define LIBUSB_CALLV WINAPIV +#else +#define LIBUSB_CALL +#define LIBUSB_CALLV +#endif /* _WIN32 || __CYGWIN__ */ + +/** \def LIBUSB_API_VERSION + * \ingroup libusb_misc + * libusb's API version. + * + * Since version 1.0.18, to help with feature detection, libusb defines + * a LIBUSB_API_VERSION macro that gets increased every time there is a + * significant change to the API, such as the introduction of a new call, + * the definition of a new macro/enum member, or any other element that + * libusb applications may want to detect at compilation time. + * + * Between versions 1.0.13 and 1.0.17 (inclusive) the older spelling of + * LIBUSBX_API_VERSION was used. + * + * The macro is typically used in an application as follows: + * \code + * #if defined(LIBUSB_API_VERSION) && (LIBUSB_API_VERSION >= 0x01001234) + * // Use one of the newer features from the libusb API + * #endif + * \endcode + * + * Internally, LIBUSB_API_VERSION is defined as follows: + * (libusb major << 24) | (libusb minor << 16) | (16 bit incremental) + * + * The incremental component has changed as follows: + *
    + *
  • libusbx version 1.0.13: LIBUSBX_API_VERSION = 0x01000100 + *
  • libusbx version 1.0.14: LIBUSBX_API_VERSION = 0x010000FF + *
  • libusbx version 1.0.15: LIBUSBX_API_VERSION = 0x01000101 + *
  • libusbx version 1.0.16: LIBUSBX_API_VERSION = 0x01000102 + *
  • libusbx version 1.0.17: LIBUSBX_API_VERSION = 0x01000102 + *
  • libusb version 1.0.18: LIBUSB_API_VERSION = 0x01000102 + *
  • libusb version 1.0.19: LIBUSB_API_VERSION = 0x01000103 + *
  • libusb version 1.0.20: LIBUSB_API_VERSION = 0x01000104 + *
  • libusb version 1.0.21: LIBUSB_API_VERSION = 0x01000105 + *
  • libusb version 1.0.22: LIBUSB_API_VERSION = 0x01000106 + *
  • libusb version 1.0.23: LIBUSB_API_VERSION = 0x01000107 + *
  • libusb version 1.0.24: LIBUSB_API_VERSION = 0x01000108 + *
  • libusb version 1.0.25: LIBUSB_API_VERSION = 0x01000109 + *
  • libusb version 1.0.26: LIBUSB_API_VERSION = 0x01000109 + *
  • libusb version 1.0.27: LIBUSB_API_VERSION = 0x0100010A + *
+ */ +#define LIBUSB_API_VERSION 0x0100010A + +/** \def LIBUSBX_API_VERSION + * \ingroup libusb_misc + * + * This is the older spelling, kept for backwards compatibility of code + * needing to test for older library versions where the newer spelling + * did not exist. */ +#define LIBUSBX_API_VERSION LIBUSB_API_VERSION + +#if defined(__cplusplus) +extern "C" { +#endif + +/** + * \ingroup libusb_misc + * Convert a 16-bit value from host-endian to little-endian format. On + * little endian systems, this function does nothing. On big endian systems, + * the bytes are swapped. + * \param x the host-endian value to convert + * \returns the value in little-endian byte order + */ +static inline uint16_t libusb_cpu_to_le16(const uint16_t x) +{ + union { + uint8_t b8[2]; + uint16_t b16; + } _tmp; + _tmp.b8[1] = (uint8_t) (x >> 8); + _tmp.b8[0] = (uint8_t) (x & 0xff); + return _tmp.b16; +} + +/** \def libusb_le16_to_cpu + * \ingroup libusb_misc + * Convert a 16-bit value from little-endian to host-endian format. On + * little endian systems, this function does nothing. On big endian systems, + * the bytes are swapped. + * \param x the little-endian value to convert + * \returns the value in host-endian byte order + */ +#define libusb_le16_to_cpu libusb_cpu_to_le16 + +/* standard USB stuff */ + +/** \ingroup libusb_desc + * Device and/or Interface Class codes */ +enum libusb_class_code { + /** In the context of a \ref libusb_device_descriptor "device descriptor", + * this bDeviceClass value indicates that each interface specifies its + * own class information and all interfaces operate independently. + */ + LIBUSB_CLASS_PER_INTERFACE = 0x00, + + /** Audio class */ + LIBUSB_CLASS_AUDIO = 0x01, + + /** Communications class */ + LIBUSB_CLASS_COMM = 0x02, + + /** Human Interface Device class */ + LIBUSB_CLASS_HID = 0x03, + + /** Physical */ + LIBUSB_CLASS_PHYSICAL = 0x05, + + /** Image class */ + LIBUSB_CLASS_IMAGE = 0x06, + LIBUSB_CLASS_PTP = 0x06, /* legacy name from libusb-0.1 usb.h */ + + /** Printer class */ + LIBUSB_CLASS_PRINTER = 0x07, + + /** Mass storage class */ + LIBUSB_CLASS_MASS_STORAGE = 0x08, + + /** Hub class */ + LIBUSB_CLASS_HUB = 0x09, + + /** Data class */ + LIBUSB_CLASS_DATA = 0x0a, + + /** Smart Card */ + LIBUSB_CLASS_SMART_CARD = 0x0b, + + /** Content Security */ + LIBUSB_CLASS_CONTENT_SECURITY = 0x0d, + + /** Video */ + LIBUSB_CLASS_VIDEO = 0x0e, + + /** Personal Healthcare */ + LIBUSB_CLASS_PERSONAL_HEALTHCARE = 0x0f, + + /** Diagnostic Device */ + LIBUSB_CLASS_DIAGNOSTIC_DEVICE = 0xdc, + + /** Wireless class */ + LIBUSB_CLASS_WIRELESS = 0xe0, + + /** Miscellaneous class */ + LIBUSB_CLASS_MISCELLANEOUS = 0xef, + + /** Application class */ + LIBUSB_CLASS_APPLICATION = 0xfe, + + /** Class is vendor-specific */ + LIBUSB_CLASS_VENDOR_SPEC = 0xff +}; + +/** \ingroup libusb_desc + * Descriptor types as defined by the USB specification. */ +enum libusb_descriptor_type { + /** Device descriptor. See libusb_device_descriptor. */ + LIBUSB_DT_DEVICE = 0x01, + + /** Configuration descriptor. See libusb_config_descriptor. */ + LIBUSB_DT_CONFIG = 0x02, + + /** String descriptor */ + LIBUSB_DT_STRING = 0x03, + + /** Interface descriptor. See libusb_interface_descriptor. */ + LIBUSB_DT_INTERFACE = 0x04, + + /** Endpoint descriptor. See libusb_endpoint_descriptor. */ + LIBUSB_DT_ENDPOINT = 0x05, + + /** Interface Association Descriptor. + * See libusb_interface_association_descriptor */ + LIBUSB_DT_INTERFACE_ASSOCIATION = 0x0b, + + /** BOS descriptor */ + LIBUSB_DT_BOS = 0x0f, + + /** Device Capability descriptor */ + LIBUSB_DT_DEVICE_CAPABILITY = 0x10, + + /** HID descriptor */ + LIBUSB_DT_HID = 0x21, + + /** HID report descriptor */ + LIBUSB_DT_REPORT = 0x22, + + /** Physical descriptor */ + LIBUSB_DT_PHYSICAL = 0x23, + + /** Hub descriptor */ + LIBUSB_DT_HUB = 0x29, + + /** SuperSpeed Hub descriptor */ + LIBUSB_DT_SUPERSPEED_HUB = 0x2a, + + /** SuperSpeed Endpoint Companion descriptor */ + LIBUSB_DT_SS_ENDPOINT_COMPANION = 0x30 +}; + +/* Descriptor sizes per descriptor type */ +#define LIBUSB_DT_DEVICE_SIZE 18 +#define LIBUSB_DT_CONFIG_SIZE 9 +#define LIBUSB_DT_INTERFACE_SIZE 9 +#define LIBUSB_DT_ENDPOINT_SIZE 7 +#define LIBUSB_DT_ENDPOINT_AUDIO_SIZE 9 /* Audio extension */ +#define LIBUSB_DT_HUB_NONVAR_SIZE 7 +#define LIBUSB_DT_SS_ENDPOINT_COMPANION_SIZE 6 +#define LIBUSB_DT_BOS_SIZE 5 +#define LIBUSB_DT_DEVICE_CAPABILITY_SIZE 3 + +/* BOS descriptor sizes */ +#define LIBUSB_BT_USB_2_0_EXTENSION_SIZE 7 +#define LIBUSB_BT_SS_USB_DEVICE_CAPABILITY_SIZE 10 +#define LIBUSB_BT_CONTAINER_ID_SIZE 20 +#define LIBUSB_BT_PLATFORM_DESCRIPTOR_MIN_SIZE 20 + +/* We unwrap the BOS => define its max size */ +#define LIBUSB_DT_BOS_MAX_SIZE \ + (LIBUSB_DT_BOS_SIZE + \ + LIBUSB_BT_USB_2_0_EXTENSION_SIZE + \ + LIBUSB_BT_SS_USB_DEVICE_CAPABILITY_SIZE + \ + LIBUSB_BT_CONTAINER_ID_SIZE) + +#define LIBUSB_ENDPOINT_ADDRESS_MASK 0x0f /* in bEndpointAddress */ +#define LIBUSB_ENDPOINT_DIR_MASK 0x80 + +/** \ingroup libusb_desc + * Endpoint direction. Values for bit 7 of the + * \ref libusb_endpoint_descriptor::bEndpointAddress "endpoint address" scheme. + */ +enum libusb_endpoint_direction { + /** Out: host-to-device */ + LIBUSB_ENDPOINT_OUT = 0x00, + + /** In: device-to-host */ + LIBUSB_ENDPOINT_IN = 0x80 +}; + +#define LIBUSB_TRANSFER_TYPE_MASK 0x03 /* in bmAttributes */ + +/** \ingroup libusb_desc + * Endpoint transfer type. Values for bits 0:1 of the + * \ref libusb_endpoint_descriptor::bmAttributes "endpoint attributes" field. + */ +enum libusb_endpoint_transfer_type { + /** Control endpoint */ + LIBUSB_ENDPOINT_TRANSFER_TYPE_CONTROL = 0x0, + + /** Isochronous endpoint */ + LIBUSB_ENDPOINT_TRANSFER_TYPE_ISOCHRONOUS = 0x1, + + /** Bulk endpoint */ + LIBUSB_ENDPOINT_TRANSFER_TYPE_BULK = 0x2, + + /** Interrupt endpoint */ + LIBUSB_ENDPOINT_TRANSFER_TYPE_INTERRUPT = 0x3 +}; + +/** \ingroup libusb_misc + * Standard requests, as defined in table 9-5 of the USB 3.0 specifications */ +enum libusb_standard_request { + /** Request status of the specific recipient */ + LIBUSB_REQUEST_GET_STATUS = 0x00, + + /** Clear or disable a specific feature */ + LIBUSB_REQUEST_CLEAR_FEATURE = 0x01, + + /* 0x02 is reserved */ + + /** Set or enable a specific feature */ + LIBUSB_REQUEST_SET_FEATURE = 0x03, + + /* 0x04 is reserved */ + + /** Set device address for all future accesses */ + LIBUSB_REQUEST_SET_ADDRESS = 0x05, + + /** Get the specified descriptor */ + LIBUSB_REQUEST_GET_DESCRIPTOR = 0x06, + + /** Used to update existing descriptors or add new descriptors */ + LIBUSB_REQUEST_SET_DESCRIPTOR = 0x07, + + /** Get the current device configuration value */ + LIBUSB_REQUEST_GET_CONFIGURATION = 0x08, + + /** Set device configuration */ + LIBUSB_REQUEST_SET_CONFIGURATION = 0x09, + + /** Return the selected alternate setting for the specified interface */ + LIBUSB_REQUEST_GET_INTERFACE = 0x0a, + + /** Select an alternate interface for the specified interface */ + LIBUSB_REQUEST_SET_INTERFACE = 0x0b, + + /** Set then report an endpoint's synchronization frame */ + LIBUSB_REQUEST_SYNCH_FRAME = 0x0c, + + /** Sets both the U1 and U2 Exit Latency */ + LIBUSB_REQUEST_SET_SEL = 0x30, + + /** Delay from the time a host transmits a packet to the time it is + * received by the device. */ + LIBUSB_SET_ISOCH_DELAY = 0x31 +}; + +/** \ingroup libusb_misc + * Request type bits of the + * \ref libusb_control_setup::bmRequestType "bmRequestType" field in control + * transfers. */ +enum libusb_request_type { + /** Standard */ + LIBUSB_REQUEST_TYPE_STANDARD = (0x00 << 5), + + /** Class */ + LIBUSB_REQUEST_TYPE_CLASS = (0x01 << 5), + + /** Vendor */ + LIBUSB_REQUEST_TYPE_VENDOR = (0x02 << 5), + + /** Reserved */ + LIBUSB_REQUEST_TYPE_RESERVED = (0x03 << 5) +}; + +/** \ingroup libusb_misc + * Recipient bits of the + * \ref libusb_control_setup::bmRequestType "bmRequestType" field in control + * transfers. Values 4 through 31 are reserved. */ +enum libusb_request_recipient { + /** Device */ + LIBUSB_RECIPIENT_DEVICE = 0x00, + + /** Interface */ + LIBUSB_RECIPIENT_INTERFACE = 0x01, + + /** Endpoint */ + LIBUSB_RECIPIENT_ENDPOINT = 0x02, + + /** Other */ + LIBUSB_RECIPIENT_OTHER = 0x03 +}; + +#define LIBUSB_ISO_SYNC_TYPE_MASK 0x0c + +/** \ingroup libusb_desc + * Synchronization type for isochronous endpoints. Values for bits 2:3 of the + * \ref libusb_endpoint_descriptor::bmAttributes "bmAttributes" field in + * libusb_endpoint_descriptor. + */ +enum libusb_iso_sync_type { + /** No synchronization */ + LIBUSB_ISO_SYNC_TYPE_NONE = 0x0, + + /** Asynchronous */ + LIBUSB_ISO_SYNC_TYPE_ASYNC = 0x1, + + /** Adaptive */ + LIBUSB_ISO_SYNC_TYPE_ADAPTIVE = 0x2, + + /** Synchronous */ + LIBUSB_ISO_SYNC_TYPE_SYNC = 0x3 +}; + +#define LIBUSB_ISO_USAGE_TYPE_MASK 0x30 + +/** \ingroup libusb_desc + * Usage type for isochronous endpoints. Values for bits 4:5 of the + * \ref libusb_endpoint_descriptor::bmAttributes "bmAttributes" field in + * libusb_endpoint_descriptor. + */ +enum libusb_iso_usage_type { + /** Data endpoint */ + LIBUSB_ISO_USAGE_TYPE_DATA = 0x0, + + /** Feedback endpoint */ + LIBUSB_ISO_USAGE_TYPE_FEEDBACK = 0x1, + + /** Implicit feedback Data endpoint */ + LIBUSB_ISO_USAGE_TYPE_IMPLICIT = 0x2 +}; + +/** \ingroup libusb_desc + * Supported speeds (wSpeedSupported) bitfield. Indicates what + * speeds the device supports. + */ +enum libusb_supported_speed { + /** Low speed operation supported (1.5MBit/s). */ + LIBUSB_LOW_SPEED_OPERATION = (1 << 0), + + /** Full speed operation supported (12MBit/s). */ + LIBUSB_FULL_SPEED_OPERATION = (1 << 1), + + /** High speed operation supported (480MBit/s). */ + LIBUSB_HIGH_SPEED_OPERATION = (1 << 2), + + /** Superspeed operation supported (5000MBit/s). */ + LIBUSB_SUPER_SPEED_OPERATION = (1 << 3) +}; + +/** \ingroup libusb_desc + * Masks for the bits of the + * \ref libusb_usb_2_0_extension_descriptor::bmAttributes "bmAttributes" field + * of the USB 2.0 Extension descriptor. + */ +enum libusb_usb_2_0_extension_attributes { + /** Supports Link Power Management (LPM) */ + LIBUSB_BM_LPM_SUPPORT = (1 << 1) +}; + +/** \ingroup libusb_desc + * Masks for the bits of the + * \ref libusb_ss_usb_device_capability_descriptor::bmAttributes "bmAttributes" field + * field of the SuperSpeed USB Device Capability descriptor. + */ +enum libusb_ss_usb_device_capability_attributes { + /** Supports Latency Tolerance Messages (LTM) */ + LIBUSB_BM_LTM_SUPPORT = (1 << 1) +}; + +/** \ingroup libusb_desc + * USB capability types + */ +enum libusb_bos_type { + /** Wireless USB device capability */ + LIBUSB_BT_WIRELESS_USB_DEVICE_CAPABILITY = 0x01, + + /** USB 2.0 extensions */ + LIBUSB_BT_USB_2_0_EXTENSION = 0x02, + + /** SuperSpeed USB device capability */ + LIBUSB_BT_SS_USB_DEVICE_CAPABILITY = 0x03, + + /** Container ID type */ + LIBUSB_BT_CONTAINER_ID = 0x04, + + /** Platform descriptor */ + LIBUSB_BT_PLATFORM_DESCRIPTOR = 0x05 +}; + +/** \ingroup libusb_desc + * A structure representing the standard USB device descriptor. This + * descriptor is documented in section 9.6.1 of the USB 3.0 specification. + * All multiple-byte fields are represented in host-endian format. + */ +struct libusb_device_descriptor { + /** Size of this descriptor (in bytes) */ + uint8_t bLength; + + /** Descriptor type. Will have value + * \ref libusb_descriptor_type::LIBUSB_DT_DEVICE LIBUSB_DT_DEVICE in this + * context. */ + uint8_t bDescriptorType; + + /** USB specification release number in binary-coded decimal. A value of + * 0x0200 indicates USB 2.0, 0x0110 indicates USB 1.1, etc. */ + uint16_t bcdUSB; + + /** USB-IF class code for the device. See \ref libusb_class_code. */ + uint8_t bDeviceClass; + + /** USB-IF subclass code for the device, qualified by the bDeviceClass + * value */ + uint8_t bDeviceSubClass; + + /** USB-IF protocol code for the device, qualified by the bDeviceClass and + * bDeviceSubClass values */ + uint8_t bDeviceProtocol; + + /** Maximum packet size for endpoint 0 */ + uint8_t bMaxPacketSize0; + + /** USB-IF vendor ID */ + uint16_t idVendor; + + /** USB-IF product ID */ + uint16_t idProduct; + + /** Device release number in binary-coded decimal */ + uint16_t bcdDevice; + + /** Index of string descriptor describing manufacturer */ + uint8_t iManufacturer; + + /** Index of string descriptor describing product */ + uint8_t iProduct; + + /** Index of string descriptor containing device serial number */ + uint8_t iSerialNumber; + + /** Number of possible configurations */ + uint8_t bNumConfigurations; +}; + +/** \ingroup libusb_desc + * A structure representing the standard USB endpoint descriptor. This + * descriptor is documented in section 9.6.6 of the USB 3.0 specification. + * All multiple-byte fields are represented in host-endian format. + */ +struct libusb_endpoint_descriptor { + /** Size of this descriptor (in bytes) */ + uint8_t bLength; + + /** Descriptor type. Will have value + * \ref libusb_descriptor_type::LIBUSB_DT_ENDPOINT LIBUSB_DT_ENDPOINT in + * this context. */ + uint8_t bDescriptorType; + + /** The address of the endpoint described by this descriptor. Bits 0:3 are + * the endpoint number. Bits 4:6 are reserved. Bit 7 indicates direction, + * see \ref libusb_endpoint_direction. */ + uint8_t bEndpointAddress; + + /** Attributes which apply to the endpoint when it is configured using + * the bConfigurationValue. Bits 0:1 determine the transfer type and + * correspond to \ref libusb_endpoint_transfer_type. Bits 2:3 are only used + * for isochronous endpoints and correspond to \ref libusb_iso_sync_type. + * Bits 4:5 are also only used for isochronous endpoints and correspond to + * \ref libusb_iso_usage_type. Bits 6:7 are reserved. */ + uint8_t bmAttributes; + + /** Maximum packet size this endpoint is capable of sending/receiving. */ + uint16_t wMaxPacketSize; + + /** Interval for polling endpoint for data transfers. */ + uint8_t bInterval; + + /** For audio devices only: the rate at which synchronization feedback + * is provided. */ + uint8_t bRefresh; + + /** For audio devices only: the address if the synch endpoint */ + uint8_t bSynchAddress; + + /** Extra descriptors. If libusb encounters unknown endpoint descriptors, + * it will store them here, should you wish to parse them. */ + const unsigned char *extra; + + /** Length of the extra descriptors, in bytes. Must be non-negative. */ + int extra_length; +}; + +/** \ingroup libusb_desc + * A structure representing the standard USB interface association descriptor. + * This descriptor is documented in section 9.6.4 of the USB 3.0 specification. + * All multiple-byte fields are represented in host-endian format. + */ +struct libusb_interface_association_descriptor { + /** Size of this descriptor (in bytes) */ + uint8_t bLength; + + /** Descriptor type. Will have value + * \ref libusb_descriptor_type::LIBUSB_DT_INTERFACE_ASSOCIATION + * LIBUSB_DT_INTERFACE_ASSOCIATION in this context. */ + uint8_t bDescriptorType; + + /** Interface number of the first interface that is associated + * with this function */ + uint8_t bFirstInterface; + + /** Number of contiguous interfaces that are associated with + * this function */ + uint8_t bInterfaceCount; + + /** USB-IF class code for this function. + * A value of zero is not allowed in this descriptor. + * If this field is 0xff, the function class is vendor-specific. + * All other values are reserved for assignment by the USB-IF. + */ + uint8_t bFunctionClass; + + /** USB-IF subclass code for this function. + * If this field is not set to 0xff, all values are reserved + * for assignment by the USB-IF + */ + uint8_t bFunctionSubClass; + + /** USB-IF protocol code for this function. + * These codes are qualified by the values of the bFunctionClass + * and bFunctionSubClass fields. + */ + uint8_t bFunctionProtocol; + + /** Index of string descriptor describing this function */ + uint8_t iFunction; +}; + +/** \ingroup libusb_desc + * Structure containing an array of 0 or more interface association + * descriptors + */ +struct libusb_interface_association_descriptor_array { + /** Array of interface association descriptors. The size of this array + * is determined by the length field. + */ + const struct libusb_interface_association_descriptor *iad; + + /** Number of interface association descriptors contained. Read-only. */ + int length; +}; + +/** \ingroup libusb_desc + * A structure representing the standard USB interface descriptor. This + * descriptor is documented in section 9.6.5 of the USB 3.0 specification. + * All multiple-byte fields are represented in host-endian format. + */ +struct libusb_interface_descriptor { + /** Size of this descriptor (in bytes) */ + uint8_t bLength; + + /** Descriptor type. Will have value + * \ref libusb_descriptor_type::LIBUSB_DT_INTERFACE LIBUSB_DT_INTERFACE + * in this context. */ + uint8_t bDescriptorType; + + /** Number of this interface */ + uint8_t bInterfaceNumber; + + /** Value used to select this alternate setting for this interface */ + uint8_t bAlternateSetting; + + /** Number of endpoints used by this interface (excluding the control + * endpoint). */ + uint8_t bNumEndpoints; + + /** USB-IF class code for this interface. See \ref libusb_class_code. */ + uint8_t bInterfaceClass; + + /** USB-IF subclass code for this interface, qualified by the + * bInterfaceClass value */ + uint8_t bInterfaceSubClass; + + /** USB-IF protocol code for this interface, qualified by the + * bInterfaceClass and bInterfaceSubClass values */ + uint8_t bInterfaceProtocol; + + /** Index of string descriptor describing this interface */ + uint8_t iInterface; + + /** Array of endpoint descriptors. This length of this array is determined + * by the bNumEndpoints field. */ + const struct libusb_endpoint_descriptor *endpoint; + + /** Extra descriptors. If libusb encounters unknown interface descriptors, + * it will store them here, should you wish to parse them. */ + const unsigned char *extra; + + /** Length of the extra descriptors, in bytes. Must be non-negative. */ + int extra_length; +}; + +/** \ingroup libusb_desc + * A collection of alternate settings for a particular USB interface. + */ +struct libusb_interface { + /** Array of interface descriptors. The length of this array is determined + * by the num_altsetting field. */ + const struct libusb_interface_descriptor *altsetting; + + /** The number of alternate settings that belong to this interface. + * Must be non-negative. */ + int num_altsetting; +}; + +/** \ingroup libusb_desc + * A structure representing the standard USB configuration descriptor. This + * descriptor is documented in section 9.6.3 of the USB 3.0 specification. + * All multiple-byte fields are represented in host-endian format. + */ +struct libusb_config_descriptor { + /** Size of this descriptor (in bytes) */ + uint8_t bLength; + + /** Descriptor type. Will have value + * \ref libusb_descriptor_type::LIBUSB_DT_CONFIG LIBUSB_DT_CONFIG + * in this context. */ + uint8_t bDescriptorType; + + /** Total length of data returned for this configuration */ + uint16_t wTotalLength; + + /** Number of interfaces supported by this configuration */ + uint8_t bNumInterfaces; + + /** Identifier value for this configuration */ + uint8_t bConfigurationValue; + + /** Index of string descriptor describing this configuration */ + uint8_t iConfiguration; + + /** Configuration characteristics */ + uint8_t bmAttributes; + + /** Maximum power consumption of the USB device from this bus in this + * configuration when the device is fully operation. Expressed in units + * of 2 mA when the device is operating in high-speed mode and in units + * of 8 mA when the device is operating in super-speed mode. */ + uint8_t MaxPower; + + /** Array of interfaces supported by this configuration. The length of + * this array is determined by the bNumInterfaces field. */ + const struct libusb_interface *interface; + + /** Extra descriptors. If libusb encounters unknown configuration + * descriptors, it will store them here, should you wish to parse them. */ + const unsigned char *extra; + + /** Length of the extra descriptors, in bytes. Must be non-negative. */ + int extra_length; +}; + +/** \ingroup libusb_desc + * A structure representing the superspeed endpoint companion + * descriptor. This descriptor is documented in section 9.6.7 of + * the USB 3.0 specification. All multiple-byte fields are represented in + * host-endian format. + */ +struct libusb_ss_endpoint_companion_descriptor { + /** Size of this descriptor (in bytes) */ + uint8_t bLength; + + /** Descriptor type. Will have value + * \ref libusb_descriptor_type::LIBUSB_DT_SS_ENDPOINT_COMPANION in + * this context. */ + uint8_t bDescriptorType; + + /** The maximum number of packets the endpoint can send or + * receive as part of a burst. */ + uint8_t bMaxBurst; + + /** In bulk EP: bits 4:0 represents the maximum number of + * streams the EP supports. In isochronous EP: bits 1:0 + * represents the Mult - a zero based value that determines + * the maximum number of packets within a service interval */ + uint8_t bmAttributes; + + /** The total number of bytes this EP will transfer every + * service interval. Valid only for periodic EPs. */ + uint16_t wBytesPerInterval; +}; + +/** \ingroup libusb_desc + * A generic representation of a BOS Device Capability descriptor. It is + * advised to check bDevCapabilityType and call the matching + * libusb_get_*_descriptor function to get a structure fully matching the type. + */ +struct libusb_bos_dev_capability_descriptor { + /** Size of this descriptor (in bytes) */ + uint8_t bLength; + + /** Descriptor type. Will have value + * \ref libusb_descriptor_type::LIBUSB_DT_DEVICE_CAPABILITY + * LIBUSB_DT_DEVICE_CAPABILITY in this context. */ + uint8_t bDescriptorType; + + /** Device Capability type */ + uint8_t bDevCapabilityType; + + /** Device Capability data (bLength - 3 bytes) */ + uint8_t dev_capability_data[LIBUSB_FLEXIBLE_ARRAY]; +}; + +/** \ingroup libusb_desc + * A structure representing the Binary Device Object Store (BOS) descriptor. + * This descriptor is documented in section 9.6.2 of the USB 3.0 specification. + * All multiple-byte fields are represented in host-endian format. + */ +struct libusb_bos_descriptor { + /** Size of this descriptor (in bytes) */ + uint8_t bLength; + + /** Descriptor type. Will have value + * \ref libusb_descriptor_type::LIBUSB_DT_BOS LIBUSB_DT_BOS + * in this context. */ + uint8_t bDescriptorType; + + /** Length of this descriptor and all of its sub descriptors */ + uint16_t wTotalLength; + + /** The number of separate device capability descriptors in + * the BOS */ + uint8_t bNumDeviceCaps; + + /** bNumDeviceCap Device Capability Descriptors */ + struct libusb_bos_dev_capability_descriptor *dev_capability[LIBUSB_FLEXIBLE_ARRAY]; +}; + +/** \ingroup libusb_desc + * A structure representing the USB 2.0 Extension descriptor + * This descriptor is documented in section 9.6.2.1 of the USB 3.0 specification. + * All multiple-byte fields are represented in host-endian format. + */ +struct libusb_usb_2_0_extension_descriptor { + /** Size of this descriptor (in bytes) */ + uint8_t bLength; + + /** Descriptor type. Will have value + * \ref libusb_descriptor_type::LIBUSB_DT_DEVICE_CAPABILITY + * LIBUSB_DT_DEVICE_CAPABILITY in this context. */ + uint8_t bDescriptorType; + + /** Capability type. Will have value + * \ref libusb_capability_type::LIBUSB_BT_USB_2_0_EXTENSION + * LIBUSB_BT_USB_2_0_EXTENSION in this context. */ + uint8_t bDevCapabilityType; + + /** Bitmap encoding of supported device level features. + * A value of one in a bit location indicates a feature is + * supported; a value of zero indicates it is not supported. + * See \ref libusb_usb_2_0_extension_attributes. */ + uint32_t bmAttributes; +}; + +/** \ingroup libusb_desc + * A structure representing the SuperSpeed USB Device Capability descriptor + * This descriptor is documented in section 9.6.2.2 of the USB 3.0 specification. + * All multiple-byte fields are represented in host-endian format. + */ +struct libusb_ss_usb_device_capability_descriptor { + /** Size of this descriptor (in bytes) */ + uint8_t bLength; + + /** Descriptor type. Will have value + * \ref libusb_descriptor_type::LIBUSB_DT_DEVICE_CAPABILITY + * LIBUSB_DT_DEVICE_CAPABILITY in this context. */ + uint8_t bDescriptorType; + + /** Capability type. Will have value + * \ref libusb_capability_type::LIBUSB_BT_SS_USB_DEVICE_CAPABILITY + * LIBUSB_BT_SS_USB_DEVICE_CAPABILITY in this context. */ + uint8_t bDevCapabilityType; + + /** Bitmap encoding of supported device level features. + * A value of one in a bit location indicates a feature is + * supported; a value of zero indicates it is not supported. + * See \ref libusb_ss_usb_device_capability_attributes. */ + uint8_t bmAttributes; + + /** Bitmap encoding of the speed supported by this device when + * operating in SuperSpeed mode. See \ref libusb_supported_speed. */ + uint16_t wSpeedSupported; + + /** The lowest speed at which all the functionality supported + * by the device is available to the user. For example if the + * device supports all its functionality when connected at + * full speed and above then it sets this value to 1. */ + uint8_t bFunctionalitySupport; + + /** U1 Device Exit Latency. */ + uint8_t bU1DevExitLat; + + /** U2 Device Exit Latency. */ + uint16_t bU2DevExitLat; +}; + +/** \ingroup libusb_desc + * A structure representing the Container ID descriptor. + * This descriptor is documented in section 9.6.2.3 of the USB 3.0 specification. + * All multiple-byte fields, except UUIDs, are represented in host-endian format. + */ +struct libusb_container_id_descriptor { + /** Size of this descriptor (in bytes) */ + uint8_t bLength; + + /** Descriptor type. Will have value + * \ref libusb_descriptor_type::LIBUSB_DT_DEVICE_CAPABILITY + * LIBUSB_DT_DEVICE_CAPABILITY in this context. */ + uint8_t bDescriptorType; + + /** Capability type. Will have value + * \ref libusb_capability_type::LIBUSB_BT_CONTAINER_ID + * LIBUSB_BT_CONTAINER_ID in this context. */ + uint8_t bDevCapabilityType; + + /** Reserved field */ + uint8_t bReserved; + + /** 128 bit UUID */ + uint8_t ContainerID[16]; +}; + +/** \ingroup libusb_desc + * A structure representing a Platform descriptor. + * This descriptor is documented in section 9.6.2.4 of the USB 3.2 specification. + */ +struct libusb_platform_descriptor { + /** Size of this descriptor (in bytes) */ + uint8_t bLength; + + /** Descriptor type. Will have value + * \ref libusb_descriptor_type::LIBUSB_DT_DEVICE_CAPABILITY + * LIBUSB_DT_DEVICE_CAPABILITY in this context. */ + uint8_t bDescriptorType; + + /** Capability type. Will have value + * \ref libusb_capability_type::LIBUSB_BT_PLATFORM_DESCRIPTOR + * LIBUSB_BT_CONTAINER_ID in this context. */ + uint8_t bDevCapabilityType; + + /** Reserved field */ + uint8_t bReserved; + + /** 128 bit UUID */ + uint8_t PlatformCapabilityUUID[16]; + + /** Capability data (bLength - 20) */ + uint8_t CapabilityData[LIBUSB_FLEXIBLE_ARRAY]; +}; + +/** \ingroup libusb_asyncio + * Setup packet for control transfers. */ +#if defined(_MSC_VER) || defined(__WATCOMC__) +#pragma pack(push, 1) +#endif +struct libusb_control_setup { + /** Request type. Bits 0:4 determine recipient, see + * \ref libusb_request_recipient. Bits 5:6 determine type, see + * \ref libusb_request_type. Bit 7 determines data transfer direction, see + * \ref libusb_endpoint_direction. + */ + uint8_t bmRequestType; + + /** Request. If the type bits of bmRequestType are equal to + * \ref libusb_request_type::LIBUSB_REQUEST_TYPE_STANDARD + * "LIBUSB_REQUEST_TYPE_STANDARD" then this field refers to + * \ref libusb_standard_request. For other cases, use of this field is + * application-specific. */ + uint8_t bRequest; + + /** Value. Varies according to request */ + uint16_t wValue; + + /** Index. Varies according to request, typically used to pass an index + * or offset */ + uint16_t wIndex; + + /** Number of bytes to transfer */ + uint16_t wLength; +} LIBUSB_PACKED; +#if defined(_MSC_VER) || defined(__WATCOMC__) +#pragma pack(pop) +#endif + +#define LIBUSB_CONTROL_SETUP_SIZE (sizeof(struct libusb_control_setup)) + +/* libusb */ + +struct libusb_context; +struct libusb_device; +struct libusb_device_handle; + +/** \ingroup libusb_lib + * Structure providing the version of the libusb runtime + */ +struct libusb_version { + /** Library major version. */ + const uint16_t major; + + /** Library minor version. */ + const uint16_t minor; + + /** Library micro version. */ + const uint16_t micro; + + /** Library nano version. */ + const uint16_t nano; + + /** Library release candidate suffix string, e.g. "-rc4". */ + const char *rc; + + /** For ABI compatibility only. */ + const char *describe; +}; + +/** \ingroup libusb_lib + * Structure representing a libusb session. The concept of individual libusb + * sessions allows for your program to use two libraries (or dynamically + * load two modules) which both independently use libusb. This will prevent + * interference between the individual libusb users - for example + * libusb_set_option() will not affect the other user of the library, and + * libusb_exit() will not destroy resources that the other user is still + * using. + * + * Sessions are created by libusb_init_context() and destroyed through libusb_exit(). + * If your application is guaranteed to only ever include a single libusb + * user (i.e. you), you do not have to worry about contexts: pass NULL in + * every function call where a context is required, and the default context + * will be used. Note that libusb_set_option(NULL, ...) is special, and adds + * an option to a list of default options for new contexts. + * + * For more information, see \ref libusb_contexts. + */ +typedef struct libusb_context libusb_context; + +/** \ingroup libusb_dev + * Structure representing a USB device detected on the system. This is an + * opaque type for which you are only ever provided with a pointer, usually + * originating from libusb_get_device_list() or libusb_hotplug_register_callback(). + * + * Certain operations can be performed on a device, but in order to do any + * I/O you will have to first obtain a device handle using libusb_open(). + * + * Devices are reference counted with libusb_ref_device() and + * libusb_unref_device(), and are freed when the reference count reaches 0. + * New devices presented by libusb_get_device_list() have a reference count of + * 1, and libusb_free_device_list() can optionally decrease the reference count + * on all devices in the list. libusb_open() adds another reference which is + * later destroyed by libusb_close(). + */ +typedef struct libusb_device libusb_device; + + +/** \ingroup libusb_dev + * Structure representing a handle on a USB device. This is an opaque type for + * which you are only ever provided with a pointer, usually originating from + * libusb_open(). + * + * A device handle is used to perform I/O and other operations. When finished + * with a device handle, you should call libusb_close(). + */ +typedef struct libusb_device_handle libusb_device_handle; + +/** \ingroup libusb_dev + * Speed codes. Indicates the speed at which the device is operating. + */ +enum libusb_speed { + /** The OS doesn't report or know the device speed. */ + LIBUSB_SPEED_UNKNOWN = 0, + + /** The device is operating at low speed (1.5MBit/s). */ + LIBUSB_SPEED_LOW = 1, + + /** The device is operating at full speed (12MBit/s). */ + LIBUSB_SPEED_FULL = 2, + + /** The device is operating at high speed (480MBit/s). */ + LIBUSB_SPEED_HIGH = 3, + + /** The device is operating at super speed (5000MBit/s). */ + LIBUSB_SPEED_SUPER = 4, + + /** The device is operating at super speed plus (10000MBit/s). */ + LIBUSB_SPEED_SUPER_PLUS = 5 +}; + +/** \ingroup libusb_misc + * Error codes. Most libusb functions return 0 on success or one of these + * codes on failure. + * You can call libusb_error_name() to retrieve a string representation of an + * error code or libusb_strerror() to get an end-user suitable description of + * an error code. + */ +enum libusb_error { + /** Success (no error) */ + LIBUSB_SUCCESS = 0, + + /** Input/output error */ + LIBUSB_ERROR_IO = -1, + + /** Invalid parameter */ + LIBUSB_ERROR_INVALID_PARAM = -2, + + /** Access denied (insufficient permissions) */ + LIBUSB_ERROR_ACCESS = -3, + + /** No such device (it may have been disconnected) */ + LIBUSB_ERROR_NO_DEVICE = -4, + + /** Entity not found */ + LIBUSB_ERROR_NOT_FOUND = -5, + + /** Resource busy */ + LIBUSB_ERROR_BUSY = -6, + + /** Operation timed out */ + LIBUSB_ERROR_TIMEOUT = -7, + + /** Overflow */ + LIBUSB_ERROR_OVERFLOW = -8, + + /** Pipe error */ + LIBUSB_ERROR_PIPE = -9, + + /** System call interrupted (perhaps due to signal) */ + LIBUSB_ERROR_INTERRUPTED = -10, + + /** Insufficient memory */ + LIBUSB_ERROR_NO_MEM = -11, + + /** Operation not supported or unimplemented on this platform */ + LIBUSB_ERROR_NOT_SUPPORTED = -12, + + /* NB: Remember to update LIBUSB_ERROR_COUNT below as well as the + message strings in strerror.c when adding new error codes here. */ + + /** Other error */ + LIBUSB_ERROR_OTHER = -99 +}; + +/* Total number of error codes in enum libusb_error */ +#define LIBUSB_ERROR_COUNT 14 + +/** \ingroup libusb_asyncio + * Transfer type */ +enum libusb_transfer_type { + /** Control transfer */ + LIBUSB_TRANSFER_TYPE_CONTROL = 0U, + + /** Isochronous transfer */ + LIBUSB_TRANSFER_TYPE_ISOCHRONOUS = 1U, + + /** Bulk transfer */ + LIBUSB_TRANSFER_TYPE_BULK = 2U, + + /** Interrupt transfer */ + LIBUSB_TRANSFER_TYPE_INTERRUPT = 3U, + + /** Bulk stream transfer */ + LIBUSB_TRANSFER_TYPE_BULK_STREAM = 4U +}; + +/** \ingroup libusb_asyncio + * Transfer status codes */ +enum libusb_transfer_status { + /** Transfer completed without error. Note that this does not indicate + * that the entire amount of requested data was transferred. */ + LIBUSB_TRANSFER_COMPLETED, + + /** Transfer failed */ + LIBUSB_TRANSFER_ERROR, + + /** Transfer timed out */ + LIBUSB_TRANSFER_TIMED_OUT, + + /** Transfer was cancelled */ + LIBUSB_TRANSFER_CANCELLED, + + /** For bulk/interrupt endpoints: halt condition detected (endpoint + * stalled). For control endpoints: control request not supported. */ + LIBUSB_TRANSFER_STALL, + + /** Device was disconnected */ + LIBUSB_TRANSFER_NO_DEVICE, + + /** Device sent more data than requested */ + LIBUSB_TRANSFER_OVERFLOW + + /* NB! Remember to update libusb_error_name() + when adding new status codes here. */ +}; + +/** \ingroup libusb_asyncio + * libusb_transfer.flags values */ +enum libusb_transfer_flags { + /** Report short frames as errors */ + LIBUSB_TRANSFER_SHORT_NOT_OK = (1U << 0), + + /** Automatically free() transfer buffer during libusb_free_transfer(). + * Note that buffers allocated with libusb_dev_mem_alloc() should not + * be attempted freed in this way, since free() is not an appropriate + * way to release such memory. */ + LIBUSB_TRANSFER_FREE_BUFFER = (1U << 1), + + /** Automatically call libusb_free_transfer() after callback returns. + * If this flag is set, it is illegal to call libusb_free_transfer() + * from your transfer callback, as this will result in a double-free + * when this flag is acted upon. */ + LIBUSB_TRANSFER_FREE_TRANSFER = (1U << 2), + + /** Terminate transfers that are a multiple of the endpoint's + * wMaxPacketSize with an extra zero length packet. This is useful + * when a device protocol mandates that each logical request is + * terminated by an incomplete packet (i.e. the logical requests are + * not separated by other means). + * + * This flag only affects host-to-device transfers to bulk and interrupt + * endpoints. In other situations, it is ignored. + * + * This flag only affects transfers with a length that is a multiple of + * the endpoint's wMaxPacketSize. On transfers of other lengths, this + * flag has no effect. Therefore, if you are working with a device that + * needs a ZLP whenever the end of the logical request falls on a packet + * boundary, then it is sensible to set this flag on every + * transfer (you do not have to worry about only setting it on transfers + * that end on the boundary). + * + * This flag is currently only supported on Linux. + * On other systems, libusb_submit_transfer() will return + * \ref LIBUSB_ERROR_NOT_SUPPORTED for every transfer where this + * flag is set. + * + * Available since libusb-1.0.9. + */ + LIBUSB_TRANSFER_ADD_ZERO_PACKET = (1U << 3) +}; + +/** \ingroup libusb_asyncio + * Isochronous packet descriptor. */ +struct libusb_iso_packet_descriptor { + /** Length of data to request in this packet */ + unsigned int length; + + /** Amount of data that was actually transferred */ + unsigned int actual_length; + + /** Status code for this packet */ + enum libusb_transfer_status status; +}; + +struct libusb_transfer; + +/** \ingroup libusb_asyncio + * Asynchronous transfer callback function type. When submitting asynchronous + * transfers, you pass a pointer to a callback function of this type via the + * \ref libusb_transfer::callback "callback" member of the libusb_transfer + * structure. libusb will call this function later, when the transfer has + * completed or failed. See \ref libusb_asyncio for more information. + * \param transfer The libusb_transfer struct the callback function is being + * notified about. + */ +typedef void (LIBUSB_CALL *libusb_transfer_cb_fn)(struct libusb_transfer *transfer); + +/** \ingroup libusb_asyncio + * The generic USB transfer structure. The user populates this structure and + * then submits it in order to request a transfer. After the transfer has + * completed, the library populates the transfer with the results and passes + * it back to the user. + */ +struct libusb_transfer { + /** Handle of the device that this transfer will be submitted to */ + libusb_device_handle *dev_handle; + + /** A bitwise OR combination of \ref libusb_transfer_flags. */ + uint8_t flags; + + /** Address of the endpoint where this transfer will be sent. */ + unsigned char endpoint; + + /** Type of the transfer from \ref libusb_transfer_type */ + unsigned char type; + + /** Timeout for this transfer in milliseconds. A value of 0 indicates no + * timeout. */ + unsigned int timeout; + + /** The status of the transfer. Read-only, and only for use within + * transfer callback function. + * + * If this is an isochronous transfer, this field may read COMPLETED even + * if there were errors in the frames. Use the + * \ref libusb_iso_packet_descriptor::status "status" field in each packet + * to determine if errors occurred. */ + enum libusb_transfer_status status; + + /** Length of the data buffer. Must be non-negative. */ + int length; + + /** Actual length of data that was transferred. Read-only, and only for + * use within transfer callback function. Not valid for isochronous + * endpoint transfers. */ + int actual_length; + + /** Callback function. This will be invoked when the transfer completes, + * fails, or is cancelled. */ + libusb_transfer_cb_fn callback; + + /** User context data. Useful for associating specific data to a transfer + * that can be accessed from within the callback function. + * + * This field may be set manually or is taken as the `user_data` parameter + * of the following functions: + * - libusb_fill_bulk_transfer() + * - libusb_fill_bulk_stream_transfer() + * - libusb_fill_control_transfer() + * - libusb_fill_interrupt_transfer() + * - libusb_fill_iso_transfer() */ + void *user_data; + + /** Data buffer */ + unsigned char *buffer; + + /** Number of isochronous packets. Only used for I/O with isochronous + * endpoints. Must be non-negative. */ + int num_iso_packets; + + /** Isochronous packet descriptors, for isochronous transfers only. */ + struct libusb_iso_packet_descriptor iso_packet_desc[LIBUSB_FLEXIBLE_ARRAY]; +}; + +/** \ingroup libusb_misc + * Capabilities supported by an instance of libusb on the current running + * platform. Test if the loaded library supports a given capability by calling + * \ref libusb_has_capability(). + */ +enum libusb_capability { + /** The libusb_has_capability() API is available. */ + LIBUSB_CAP_HAS_CAPABILITY = 0x0000U, + + /** Hotplug support is available on this platform. */ + LIBUSB_CAP_HAS_HOTPLUG = 0x0001U, + + /** The library can access HID devices without requiring user intervention. + * Note that before being able to actually access an HID device, you may + * still have to call additional libusb functions such as + * \ref libusb_detach_kernel_driver(). */ + LIBUSB_CAP_HAS_HID_ACCESS = 0x0100U, + + /** The library supports detaching of the default USB driver, using + * \ref libusb_detach_kernel_driver(), if one is set by the OS kernel */ + LIBUSB_CAP_SUPPORTS_DETACH_KERNEL_DRIVER = 0x0101U +}; + +/** \ingroup libusb_lib + * Log message levels. + */ +enum libusb_log_level { + /** (0) : No messages ever emitted by the library (default) */ + LIBUSB_LOG_LEVEL_NONE = 0, + + /** (1) : Error messages are emitted */ + LIBUSB_LOG_LEVEL_ERROR = 1, + + /** (2) : Warning and error messages are emitted */ + LIBUSB_LOG_LEVEL_WARNING = 2, + + /** (3) : Informational, warning and error messages are emitted */ + LIBUSB_LOG_LEVEL_INFO = 3, + + /** (4) : All messages are emitted */ + LIBUSB_LOG_LEVEL_DEBUG = 4 +}; + +/** \ingroup libusb_lib + * Log callback mode. + * + * Since version 1.0.23, \ref LIBUSB_API_VERSION >= 0x01000107 + * + * \see libusb_set_log_cb() + */ +enum libusb_log_cb_mode { + /** Callback function handling all log messages. */ + LIBUSB_LOG_CB_GLOBAL = (1 << 0), + + /** Callback function handling context related log messages. */ + LIBUSB_LOG_CB_CONTEXT = (1 << 1) +}; + +/** \ingroup libusb_lib + * Available option values for libusb_set_option() and libusb_init_context(). + */ +enum libusb_option { + /** Set the log message verbosity. + * + * This option must be provided an argument of type \ref libusb_log_level. + * The default level is LIBUSB_LOG_LEVEL_NONE, which means no messages are ever + * printed. If you choose to increase the message verbosity level, ensure + * that your application does not close the stderr file descriptor. + * + * You are advised to use level LIBUSB_LOG_LEVEL_WARNING. libusb is conservative + * with its message logging and most of the time, will only log messages that + * explain error conditions and other oddities. This will help you debug + * your software. + * + * If the LIBUSB_DEBUG environment variable was set when libusb was + * initialized, this option does nothing: the message verbosity is fixed + * to the value in the environment variable. + * + * If libusb was compiled without any message logging, this option does + * nothing: you'll never get any messages. + * + * If libusb was compiled with verbose debug message logging, this option + * does nothing: you'll always get messages from all levels. + */ + LIBUSB_OPTION_LOG_LEVEL = 0, + + /** Use the UsbDk backend for a specific context, if available. + * + * This option should be set at initialization with libusb_init_context() + * otherwise unspecified behavior may occur. + * + * Only valid on Windows. Ignored on all other platforms. + */ + LIBUSB_OPTION_USE_USBDK = 1, + + /** Do not scan for devices + * + * With this option set, libusb will skip scanning devices in + * libusb_init_context(). + * + * Hotplug functionality will also be deactivated. + * + * The option is useful in combination with libusb_wrap_sys_device(), + * which can access a device directly without prior device scanning. + * + * This is typically needed on Android, where access to USB devices + * is limited. + * + * This option should only be used with libusb_init_context() + * otherwise unspecified behavior may occur. + * + * Only valid on Linux. Ignored on all other platforms. + */ + LIBUSB_OPTION_NO_DEVICE_DISCOVERY = 2, + +#define LIBUSB_OPTION_WEAK_AUTHORITY LIBUSB_OPTION_NO_DEVICE_DISCOVERY + + /** Set the context log callback function. + * + * Set the log callback function either on a context or globally. This + * option must be provided an argument of type \ref libusb_log_cb. + * Using this option with a NULL context is equivalent to calling + * libusb_set_log_cb() with mode \ref LIBUSB_LOG_CB_GLOBAL. + * Using it with a non-NULL context is equivalent to calling + * libusb_set_log_cb() with mode \ref LIBUSB_LOG_CB_CONTEXT. + */ + LIBUSB_OPTION_LOG_CB = 3, + + LIBUSB_OPTION_MAX = 4 +}; + +/** \ingroup libusb_lib + * Callback function for handling log messages. + * \param ctx the context which is related to the log message, or NULL if it + * is a global log message + * \param level the log level, see \ref libusb_log_level for a description + * \param str the log message + * + * Since version 1.0.23, \ref LIBUSB_API_VERSION >= 0x01000107 + * + * \see libusb_set_log_cb() + */ +typedef void (LIBUSB_CALL *libusb_log_cb)(libusb_context *ctx, + enum libusb_log_level level, const char *str); + +/** \ingroup libusb_lib + * Structure used for setting options through \ref libusb_init_context. + * + */ +struct libusb_init_option { + /** Which option to set */ + enum libusb_option option; + /** An integer value used by the option (if applicable). */ + union { + int ival; + libusb_log_cb log_cbval; + } value; +}; + +int LIBUSB_CALL libusb_init(libusb_context **ctx); +int LIBUSB_CALL libusb_init_context(libusb_context **ctx, const struct libusb_init_option options[], int num_options); +void LIBUSB_CALL libusb_exit(libusb_context *ctx); +void LIBUSB_CALL libusb_set_debug(libusb_context *ctx, int level); +/* may be deprecated in the future in favor of lubusb_init_context()+libusb_set_option() */ +void LIBUSB_CALL libusb_set_log_cb(libusb_context *ctx, libusb_log_cb cb, int mode); +const struct libusb_version * LIBUSB_CALL libusb_get_version(void); +int LIBUSB_CALL libusb_has_capability(uint32_t capability); +const char * LIBUSB_CALL libusb_error_name(int errcode); +int LIBUSB_CALL libusb_setlocale(const char *locale); +const char * LIBUSB_CALL libusb_strerror(int errcode); + +ssize_t LIBUSB_CALL libusb_get_device_list(libusb_context *ctx, + libusb_device ***list); +void LIBUSB_CALL libusb_free_device_list(libusb_device **list, + int unref_devices); +libusb_device * LIBUSB_CALL libusb_ref_device(libusb_device *dev); +void LIBUSB_CALL libusb_unref_device(libusb_device *dev); + +int LIBUSB_CALL libusb_get_configuration(libusb_device_handle *dev, + int *config); +int LIBUSB_CALL libusb_get_device_descriptor(libusb_device *dev, + struct libusb_device_descriptor *desc); +int LIBUSB_CALL libusb_get_active_config_descriptor(libusb_device *dev, + struct libusb_config_descriptor **config); +int LIBUSB_CALL libusb_get_config_descriptor(libusb_device *dev, + uint8_t config_index, struct libusb_config_descriptor **config); +int LIBUSB_CALL libusb_get_config_descriptor_by_value(libusb_device *dev, + uint8_t bConfigurationValue, struct libusb_config_descriptor **config); +void LIBUSB_CALL libusb_free_config_descriptor( + struct libusb_config_descriptor *config); +int LIBUSB_CALL libusb_get_ss_endpoint_companion_descriptor( + libusb_context *ctx, + const struct libusb_endpoint_descriptor *endpoint, + struct libusb_ss_endpoint_companion_descriptor **ep_comp); +void LIBUSB_CALL libusb_free_ss_endpoint_companion_descriptor( + struct libusb_ss_endpoint_companion_descriptor *ep_comp); +int LIBUSB_CALL libusb_get_bos_descriptor(libusb_device_handle *dev_handle, + struct libusb_bos_descriptor **bos); +void LIBUSB_CALL libusb_free_bos_descriptor(struct libusb_bos_descriptor *bos); +int LIBUSB_CALL libusb_get_usb_2_0_extension_descriptor( + libusb_context *ctx, + struct libusb_bos_dev_capability_descriptor *dev_cap, + struct libusb_usb_2_0_extension_descriptor **usb_2_0_extension); +void LIBUSB_CALL libusb_free_usb_2_0_extension_descriptor( + struct libusb_usb_2_0_extension_descriptor *usb_2_0_extension); +int LIBUSB_CALL libusb_get_ss_usb_device_capability_descriptor( + libusb_context *ctx, + struct libusb_bos_dev_capability_descriptor *dev_cap, + struct libusb_ss_usb_device_capability_descriptor **ss_usb_device_cap); +void LIBUSB_CALL libusb_free_ss_usb_device_capability_descriptor( + struct libusb_ss_usb_device_capability_descriptor *ss_usb_device_cap); +int LIBUSB_CALL libusb_get_container_id_descriptor(libusb_context *ctx, + struct libusb_bos_dev_capability_descriptor *dev_cap, + struct libusb_container_id_descriptor **container_id); +void LIBUSB_CALL libusb_free_container_id_descriptor( + struct libusb_container_id_descriptor *container_id); +int LIBUSB_CALL libusb_get_platform_descriptor(libusb_context *ctx, + struct libusb_bos_dev_capability_descriptor *dev_cap, + struct libusb_platform_descriptor **platform_descriptor); +void LIBUSB_CALL libusb_free_platform_descriptor( + struct libusb_platform_descriptor *platform_descriptor); +uint8_t LIBUSB_CALL libusb_get_bus_number(libusb_device *dev); +uint8_t LIBUSB_CALL libusb_get_port_number(libusb_device *dev); +int LIBUSB_CALL libusb_get_port_numbers(libusb_device *dev, uint8_t *port_numbers, int port_numbers_len); +LIBUSB_DEPRECATED_FOR(libusb_get_port_numbers) +int LIBUSB_CALL libusb_get_port_path(libusb_context *ctx, libusb_device *dev, uint8_t *path, uint8_t path_length); +libusb_device * LIBUSB_CALL libusb_get_parent(libusb_device *dev); +uint8_t LIBUSB_CALL libusb_get_device_address(libusb_device *dev); +int LIBUSB_CALL libusb_get_device_speed(libusb_device *dev); +int LIBUSB_CALL libusb_get_max_packet_size(libusb_device *dev, + unsigned char endpoint); +int LIBUSB_CALL libusb_get_max_iso_packet_size(libusb_device *dev, + unsigned char endpoint); +int LIBUSB_CALL libusb_get_max_alt_packet_size(libusb_device *dev, + int interface_number, int alternate_setting, unsigned char endpoint); + +int LIBUSB_CALL libusb_get_interface_association_descriptors(libusb_device *dev, + uint8_t config_index, struct libusb_interface_association_descriptor_array **iad_array); +int LIBUSB_CALL libusb_get_active_interface_association_descriptors(libusb_device *dev, + struct libusb_interface_association_descriptor_array **iad_array); +void LIBUSB_CALL libusb_free_interface_association_descriptors( + struct libusb_interface_association_descriptor_array *iad_array); + +int LIBUSB_CALL libusb_wrap_sys_device(libusb_context *ctx, intptr_t sys_dev, libusb_device_handle **dev_handle); +int LIBUSB_CALL libusb_open(libusb_device *dev, libusb_device_handle **dev_handle); +void LIBUSB_CALL libusb_close(libusb_device_handle *dev_handle); +libusb_device * LIBUSB_CALL libusb_get_device(libusb_device_handle *dev_handle); + +int LIBUSB_CALL libusb_set_configuration(libusb_device_handle *dev_handle, + int configuration); +int LIBUSB_CALL libusb_claim_interface(libusb_device_handle *dev_handle, + int interface_number); +int LIBUSB_CALL libusb_release_interface(libusb_device_handle *dev_handle, + int interface_number); + +libusb_device_handle * LIBUSB_CALL libusb_open_device_with_vid_pid( + libusb_context *ctx, uint16_t vendor_id, uint16_t product_id); + +int LIBUSB_CALL libusb_set_interface_alt_setting(libusb_device_handle *dev_handle, + int interface_number, int alternate_setting); +int LIBUSB_CALL libusb_clear_halt(libusb_device_handle *dev_handle, + unsigned char endpoint); +int LIBUSB_CALL libusb_reset_device(libusb_device_handle *dev_handle); + +int LIBUSB_CALL libusb_alloc_streams(libusb_device_handle *dev_handle, + uint32_t num_streams, unsigned char *endpoints, int num_endpoints); +int LIBUSB_CALL libusb_free_streams(libusb_device_handle *dev_handle, + unsigned char *endpoints, int num_endpoints); + +unsigned char * LIBUSB_CALL libusb_dev_mem_alloc(libusb_device_handle *dev_handle, + size_t length); +int LIBUSB_CALL libusb_dev_mem_free(libusb_device_handle *dev_handle, + unsigned char *buffer, size_t length); + +int LIBUSB_CALL libusb_kernel_driver_active(libusb_device_handle *dev_handle, + int interface_number); +int LIBUSB_CALL libusb_detach_kernel_driver(libusb_device_handle *dev_handle, + int interface_number); +int LIBUSB_CALL libusb_attach_kernel_driver(libusb_device_handle *dev_handle, + int interface_number); +int LIBUSB_CALL libusb_set_auto_detach_kernel_driver( + libusb_device_handle *dev_handle, int enable); + +/* async I/O */ + +/** \ingroup libusb_asyncio + * Get the data section of a control transfer. This convenience function is here + * to remind you that the data does not start until 8 bytes into the actual + * buffer, as the setup packet comes first. + * + * Calling this function only makes sense from a transfer callback function, + * or situations where you have already allocated a suitably sized buffer at + * transfer->buffer. + * + * \param transfer a transfer + * \returns pointer to the first byte of the data section + */ +static inline unsigned char *libusb_control_transfer_get_data( + struct libusb_transfer *transfer) +{ + return transfer->buffer + LIBUSB_CONTROL_SETUP_SIZE; +} + +/** \ingroup libusb_asyncio + * Get the control setup packet of a control transfer. This convenience + * function is here to remind you that the control setup occupies the first + * 8 bytes of the transfer data buffer. + * + * Calling this function only makes sense from a transfer callback function, + * or situations where you have already allocated a suitably sized buffer at + * transfer->buffer. + * + * \param transfer a transfer + * \returns a casted pointer to the start of the transfer data buffer + */ +static inline struct libusb_control_setup *libusb_control_transfer_get_setup( + struct libusb_transfer *transfer) +{ + return (struct libusb_control_setup *)(void *)transfer->buffer; +} + +/** \ingroup libusb_asyncio + * Helper function to populate the setup packet (first 8 bytes of the data + * buffer) for a control transfer. The wIndex, wValue and wLength values should + * be given in host-endian byte order. + * + * \param buffer buffer to output the setup packet into + * This pointer must be aligned to at least 2 bytes boundary. + * \param bmRequestType see the + * \ref libusb_control_setup::bmRequestType "bmRequestType" field of + * \ref libusb_control_setup + * \param bRequest see the + * \ref libusb_control_setup::bRequest "bRequest" field of + * \ref libusb_control_setup + * \param wValue see the + * \ref libusb_control_setup::wValue "wValue" field of + * \ref libusb_control_setup + * \param wIndex see the + * \ref libusb_control_setup::wIndex "wIndex" field of + * \ref libusb_control_setup + * \param wLength see the + * \ref libusb_control_setup::wLength "wLength" field of + * \ref libusb_control_setup + */ +static inline void libusb_fill_control_setup(unsigned char *buffer, + uint8_t bmRequestType, uint8_t bRequest, uint16_t wValue, uint16_t wIndex, + uint16_t wLength) +{ + struct libusb_control_setup *setup = (struct libusb_control_setup *)(void *)buffer; + setup->bmRequestType = bmRequestType; + setup->bRequest = bRequest; + setup->wValue = libusb_cpu_to_le16(wValue); + setup->wIndex = libusb_cpu_to_le16(wIndex); + setup->wLength = libusb_cpu_to_le16(wLength); +} + +struct libusb_transfer * LIBUSB_CALL libusb_alloc_transfer(int iso_packets); +int LIBUSB_CALL libusb_submit_transfer(struct libusb_transfer *transfer); +int LIBUSB_CALL libusb_cancel_transfer(struct libusb_transfer *transfer); +void LIBUSB_CALL libusb_free_transfer(struct libusb_transfer *transfer); +void LIBUSB_CALL libusb_transfer_set_stream_id( + struct libusb_transfer *transfer, uint32_t stream_id); +uint32_t LIBUSB_CALL libusb_transfer_get_stream_id( + struct libusb_transfer *transfer); + +/** \ingroup libusb_asyncio + * Helper function to populate the required \ref libusb_transfer fields + * for a control transfer. + * + * If you pass a transfer buffer to this function, the first 8 bytes will + * be interpreted as a control setup packet, and the wLength field will be + * used to automatically populate the \ref libusb_transfer::length "length" + * field of the transfer. Therefore the recommended approach is: + * -# Allocate a suitably sized data buffer (including space for control setup) + * -# Call libusb_fill_control_setup() + * -# If this is a host-to-device transfer with a data stage, put the data + * in place after the setup packet + * -# Call this function + * -# Call libusb_submit_transfer() + * + * It is also legal to pass a NULL buffer to this function, in which case this + * function will not attempt to populate the length field. Remember that you + * must then populate the buffer and length fields later. + * + * \param transfer the transfer to populate + * \param dev_handle handle of the device that will handle the transfer + * \param buffer data buffer. If provided, this function will interpret the + * first 8 bytes as a setup packet and infer the transfer length from that. + * This pointer must be aligned to at least 2 bytes boundary. + * \param callback callback function to be invoked on transfer completion + * \param user_data user data to pass to callback function + * \param timeout timeout for the transfer in milliseconds + */ +static inline void libusb_fill_control_transfer( + struct libusb_transfer *transfer, libusb_device_handle *dev_handle, + unsigned char *buffer, libusb_transfer_cb_fn callback, void *user_data, + unsigned int timeout) +{ + struct libusb_control_setup *setup = (struct libusb_control_setup *)(void *)buffer; + transfer->dev_handle = dev_handle; + transfer->endpoint = 0; + transfer->type = LIBUSB_TRANSFER_TYPE_CONTROL; + transfer->timeout = timeout; + transfer->buffer = buffer; + if (setup) + transfer->length = (int) (LIBUSB_CONTROL_SETUP_SIZE + + libusb_le16_to_cpu(setup->wLength)); + transfer->user_data = user_data; + transfer->callback = callback; +} + +/** \ingroup libusb_asyncio + * Helper function to populate the required \ref libusb_transfer fields + * for a bulk transfer. + * + * \param transfer the transfer to populate + * \param dev_handle handle of the device that will handle the transfer + * \param endpoint address of the endpoint where this transfer will be sent + * \param buffer data buffer + * \param length length of data buffer + * \param callback callback function to be invoked on transfer completion + * \param user_data user data to pass to callback function + * \param timeout timeout for the transfer in milliseconds + */ +static inline void libusb_fill_bulk_transfer(struct libusb_transfer *transfer, + libusb_device_handle *dev_handle, unsigned char endpoint, + unsigned char *buffer, int length, libusb_transfer_cb_fn callback, + void *user_data, unsigned int timeout) +{ + transfer->dev_handle = dev_handle; + transfer->endpoint = endpoint; + transfer->type = LIBUSB_TRANSFER_TYPE_BULK; + transfer->timeout = timeout; + transfer->buffer = buffer; + transfer->length = length; + transfer->user_data = user_data; + transfer->callback = callback; +} + +/** \ingroup libusb_asyncio + * Helper function to populate the required \ref libusb_transfer fields + * for a bulk transfer using bulk streams. + * + * Since version 1.0.19, \ref LIBUSB_API_VERSION >= 0x01000103 + * + * \param transfer the transfer to populate + * \param dev_handle handle of the device that will handle the transfer + * \param endpoint address of the endpoint where this transfer will be sent + * \param stream_id bulk stream id for this transfer + * \param buffer data buffer + * \param length length of data buffer + * \param callback callback function to be invoked on transfer completion + * \param user_data user data to pass to callback function + * \param timeout timeout for the transfer in milliseconds + */ +static inline void libusb_fill_bulk_stream_transfer( + struct libusb_transfer *transfer, libusb_device_handle *dev_handle, + unsigned char endpoint, uint32_t stream_id, + unsigned char *buffer, int length, libusb_transfer_cb_fn callback, + void *user_data, unsigned int timeout) +{ + libusb_fill_bulk_transfer(transfer, dev_handle, endpoint, buffer, + length, callback, user_data, timeout); + transfer->type = LIBUSB_TRANSFER_TYPE_BULK_STREAM; + libusb_transfer_set_stream_id(transfer, stream_id); +} + +/** \ingroup libusb_asyncio + * Helper function to populate the required \ref libusb_transfer fields + * for an interrupt transfer. + * + * \param transfer the transfer to populate + * \param dev_handle handle of the device that will handle the transfer + * \param endpoint address of the endpoint where this transfer will be sent + * \param buffer data buffer + * \param length length of data buffer + * \param callback callback function to be invoked on transfer completion + * \param user_data user data to pass to callback function + * \param timeout timeout for the transfer in milliseconds + */ +static inline void libusb_fill_interrupt_transfer( + struct libusb_transfer *transfer, libusb_device_handle *dev_handle, + unsigned char endpoint, unsigned char *buffer, int length, + libusb_transfer_cb_fn callback, void *user_data, unsigned int timeout) +{ + transfer->dev_handle = dev_handle; + transfer->endpoint = endpoint; + transfer->type = LIBUSB_TRANSFER_TYPE_INTERRUPT; + transfer->timeout = timeout; + transfer->buffer = buffer; + transfer->length = length; + transfer->user_data = user_data; + transfer->callback = callback; +} + +/** \ingroup libusb_asyncio + * Helper function to populate the required \ref libusb_transfer fields + * for an isochronous transfer. + * + * \param transfer the transfer to populate + * \param dev_handle handle of the device that will handle the transfer + * \param endpoint address of the endpoint where this transfer will be sent + * \param buffer data buffer + * \param length length of data buffer + * \param num_iso_packets the number of isochronous packets + * \param callback callback function to be invoked on transfer completion + * \param user_data user data to pass to callback function + * \param timeout timeout for the transfer in milliseconds + */ +static inline void libusb_fill_iso_transfer(struct libusb_transfer *transfer, + libusb_device_handle *dev_handle, unsigned char endpoint, + unsigned char *buffer, int length, int num_iso_packets, + libusb_transfer_cb_fn callback, void *user_data, unsigned int timeout) +{ + transfer->dev_handle = dev_handle; + transfer->endpoint = endpoint; + transfer->type = LIBUSB_TRANSFER_TYPE_ISOCHRONOUS; + transfer->timeout = timeout; + transfer->buffer = buffer; + transfer->length = length; + transfer->num_iso_packets = num_iso_packets; + transfer->user_data = user_data; + transfer->callback = callback; +} + +/** \ingroup libusb_asyncio + * Convenience function to set the length of all packets in an isochronous + * transfer, based on the num_iso_packets field in the transfer structure. + * + * \param transfer a transfer + * \param length the length to set in each isochronous packet descriptor + * \see libusb_get_max_packet_size() + */ +static inline void libusb_set_iso_packet_lengths( + struct libusb_transfer *transfer, unsigned int length) +{ + int i; + + for (i = 0; i < transfer->num_iso_packets; i++) + transfer->iso_packet_desc[i].length = length; +} + +/** \ingroup libusb_asyncio + * Convenience function to locate the position of an isochronous packet + * within the buffer of an isochronous transfer. + * + * This is a thorough function which loops through all preceding packets, + * accumulating their lengths to find the position of the specified packet. + * Typically you will assign equal lengths to each packet in the transfer, + * and hence the above method is sub-optimal. You may wish to use + * libusb_get_iso_packet_buffer_simple() instead. + * + * \param transfer a transfer + * \param packet the packet to return the address of + * \returns the base address of the packet buffer inside the transfer buffer, + * or NULL if the packet does not exist. + * \see libusb_get_iso_packet_buffer_simple() + */ +static inline unsigned char *libusb_get_iso_packet_buffer( + struct libusb_transfer *transfer, unsigned int packet) +{ + int i; + size_t offset = 0; + int _packet; + + /* oops..slight bug in the API. packet is an unsigned int, but we use + * signed integers almost everywhere else. range-check and convert to + * signed to avoid compiler warnings. FIXME for libusb-2. */ + if (packet > INT_MAX) + return NULL; + _packet = (int) packet; + + if (_packet >= transfer->num_iso_packets) + return NULL; + + for (i = 0; i < _packet; i++) + offset += transfer->iso_packet_desc[i].length; + + return transfer->buffer + offset; +} + +/** \ingroup libusb_asyncio + * Convenience function to locate the position of an isochronous packet + * within the buffer of an isochronous transfer, for transfers where each + * packet is of identical size. + * + * This function relies on the assumption that every packet within the transfer + * is of identical size to the first packet. Calculating the location of + * the packet buffer is then just a simple calculation: + * buffer + (packet_size * packet) + * + * Do not use this function on transfers other than those that have identical + * packet lengths for each packet. + * + * \param transfer a transfer + * \param packet the packet to return the address of + * \returns the base address of the packet buffer inside the transfer buffer, + * or NULL if the packet does not exist. + * \see libusb_get_iso_packet_buffer() + */ +static inline unsigned char *libusb_get_iso_packet_buffer_simple( + struct libusb_transfer *transfer, unsigned int packet) +{ + int _packet; + + /* oops..slight bug in the API. packet is an unsigned int, but we use + * signed integers almost everywhere else. range-check and convert to + * signed to avoid compiler warnings. FIXME for libusb-2. */ + if (packet > INT_MAX) + return NULL; + _packet = (int) packet; + + if (_packet >= transfer->num_iso_packets) + return NULL; + + return transfer->buffer + ((int) transfer->iso_packet_desc[0].length * _packet); +} + +/* sync I/O */ + +int LIBUSB_CALL libusb_control_transfer(libusb_device_handle *dev_handle, + uint8_t request_type, uint8_t bRequest, uint16_t wValue, uint16_t wIndex, + unsigned char *data, uint16_t wLength, unsigned int timeout); + +int LIBUSB_CALL libusb_bulk_transfer(libusb_device_handle *dev_handle, + unsigned char endpoint, unsigned char *data, int length, + int *actual_length, unsigned int timeout); + +int LIBUSB_CALL libusb_interrupt_transfer(libusb_device_handle *dev_handle, + unsigned char endpoint, unsigned char *data, int length, + int *actual_length, unsigned int timeout); + +/** \ingroup libusb_desc + * Retrieve a descriptor from the default control pipe. + * This is a convenience function which formulates the appropriate control + * message to retrieve the descriptor. + * + * \param dev_handle a device handle + * \param desc_type the descriptor type, see \ref libusb_descriptor_type + * \param desc_index the index of the descriptor to retrieve + * \param data output buffer for descriptor + * \param length size of data buffer + * \returns number of bytes returned in data, or LIBUSB_ERROR code on failure + */ +static inline int libusb_get_descriptor(libusb_device_handle *dev_handle, + uint8_t desc_type, uint8_t desc_index, unsigned char *data, int length) +{ + return libusb_control_transfer(dev_handle, LIBUSB_ENDPOINT_IN, + LIBUSB_REQUEST_GET_DESCRIPTOR, (uint16_t) ((desc_type << 8) | desc_index), + 0, data, (uint16_t) length, 1000); +} + +/** \ingroup libusb_desc + * Retrieve a descriptor from a device. + * This is a convenience function which formulates the appropriate control + * message to retrieve the descriptor. The string returned is Unicode, as + * detailed in the USB specifications. + * + * \param dev_handle a device handle + * \param desc_index the index of the descriptor to retrieve + * \param langid the language ID for the string descriptor + * \param data output buffer for descriptor + * \param length size of data buffer + * \returns number of bytes returned in data, or LIBUSB_ERROR code on failure + * \see libusb_get_string_descriptor_ascii() + */ +static inline int libusb_get_string_descriptor(libusb_device_handle *dev_handle, + uint8_t desc_index, uint16_t langid, unsigned char *data, int length) +{ + return libusb_control_transfer(dev_handle, LIBUSB_ENDPOINT_IN, + LIBUSB_REQUEST_GET_DESCRIPTOR, (uint16_t)((LIBUSB_DT_STRING << 8) | desc_index), + langid, data, (uint16_t) length, 1000); +} + +int LIBUSB_CALL libusb_get_string_descriptor_ascii(libusb_device_handle *dev_handle, + uint8_t desc_index, unsigned char *data, int length); + +/* polling and timeouts */ + +int LIBUSB_CALL libusb_try_lock_events(libusb_context *ctx); +void LIBUSB_CALL libusb_lock_events(libusb_context *ctx); +void LIBUSB_CALL libusb_unlock_events(libusb_context *ctx); +int LIBUSB_CALL libusb_event_handling_ok(libusb_context *ctx); +int LIBUSB_CALL libusb_event_handler_active(libusb_context *ctx); +void LIBUSB_CALL libusb_interrupt_event_handler(libusb_context *ctx); +void LIBUSB_CALL libusb_lock_event_waiters(libusb_context *ctx); +void LIBUSB_CALL libusb_unlock_event_waiters(libusb_context *ctx); +int LIBUSB_CALL libusb_wait_for_event(libusb_context *ctx, struct timeval *tv); + +int LIBUSB_CALL libusb_handle_events_timeout(libusb_context *ctx, + struct timeval *tv); +int LIBUSB_CALL libusb_handle_events_timeout_completed(libusb_context *ctx, + struct timeval *tv, int *completed); +int LIBUSB_CALL libusb_handle_events(libusb_context *ctx); +int LIBUSB_CALL libusb_handle_events_completed(libusb_context *ctx, int *completed); +int LIBUSB_CALL libusb_handle_events_locked(libusb_context *ctx, + struct timeval *tv); +int LIBUSB_CALL libusb_pollfds_handle_timeouts(libusb_context *ctx); +int LIBUSB_CALL libusb_get_next_timeout(libusb_context *ctx, + struct timeval *tv); + +/** \ingroup libusb_poll + * File descriptor for polling + */ +struct libusb_pollfd { + /** Numeric file descriptor */ + int fd; + + /** Event flags to poll for from . POLLIN indicates that you + * should monitor this file descriptor for becoming ready to read from, + * and POLLOUT indicates that you should monitor this file descriptor for + * nonblocking write readiness. */ + short events; +}; + +/** \ingroup libusb_poll + * Callback function, invoked when a new file descriptor should be added + * to the set of file descriptors monitored for events. + * \param fd the new file descriptor + * \param events events to monitor for, see \ref libusb_pollfd for a + * description + * \param user_data User data pointer specified in + * libusb_set_pollfd_notifiers() call + * \see libusb_set_pollfd_notifiers() + */ +typedef void (LIBUSB_CALL *libusb_pollfd_added_cb)(int fd, short events, + void *user_data); + +/** \ingroup libusb_poll + * Callback function, invoked when a file descriptor should be removed from + * the set of file descriptors being monitored for events. After returning + * from this callback, do not use that file descriptor again. + * \param fd the file descriptor to stop monitoring + * \param user_data User data pointer specified in + * libusb_set_pollfd_notifiers() call + * \see libusb_set_pollfd_notifiers() + */ +typedef void (LIBUSB_CALL *libusb_pollfd_removed_cb)(int fd, void *user_data); + +const struct libusb_pollfd ** LIBUSB_CALL libusb_get_pollfds( + libusb_context *ctx); +void LIBUSB_CALL libusb_free_pollfds(const struct libusb_pollfd **pollfds); +void LIBUSB_CALL libusb_set_pollfd_notifiers(libusb_context *ctx, + libusb_pollfd_added_cb added_cb, libusb_pollfd_removed_cb removed_cb, + void *user_data); + +/** \ingroup libusb_hotplug + * Callback handle. + * + * Callbacks handles are generated by libusb_hotplug_register_callback() + * and can be used to deregister callbacks. Callback handles are unique + * per libusb_context and it is safe to call libusb_hotplug_deregister_callback() + * on an already deregistered callback. + * + * Since version 1.0.16, \ref LIBUSB_API_VERSION >= 0x01000102 + * + * For more information, see \ref libusb_hotplug. + */ +typedef int libusb_hotplug_callback_handle; + +/** \ingroup libusb_hotplug + * + * Since version 1.0.16, \ref LIBUSB_API_VERSION >= 0x01000102 + * + * Hotplug events */ +typedef enum { + /** A device has been plugged in and is ready to use */ + LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED = (1 << 0), + + /** A device has left and is no longer available. + * It is the user's responsibility to call libusb_close on any handle associated with a disconnected device. + * It is safe to call libusb_get_device_descriptor on a device that has left */ + LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT = (1 << 1) +} libusb_hotplug_event; + +/** \ingroup libusb_hotplug + * + * Since version 1.0.16, \ref LIBUSB_API_VERSION >= 0x01000102 + * + * Hotplug flags */ +typedef enum { + /** Arm the callback and fire it for all matching currently attached devices. */ + LIBUSB_HOTPLUG_ENUMERATE = (1 << 0) +} libusb_hotplug_flag; + +/** \ingroup libusb_hotplug + * Convenience macro when not using any flags */ +#define LIBUSB_HOTPLUG_NO_FLAGS 0 + +/** \ingroup libusb_hotplug + * Wildcard matching for hotplug events */ +#define LIBUSB_HOTPLUG_MATCH_ANY -1 + +/** \ingroup libusb_hotplug + * Hotplug callback function type. When requesting hotplug event notifications, + * you pass a pointer to a callback function of this type. + * + * This callback may be called by an internal event thread and as such it is + * recommended the callback do minimal processing before returning. + * + * libusb will call this function later, when a matching event had happened on + * a matching device. See \ref libusb_hotplug for more information. + * + * It is safe to call either libusb_hotplug_register_callback() or + * libusb_hotplug_deregister_callback() from within a callback function. + * + * Since version 1.0.16, \ref LIBUSB_API_VERSION >= 0x01000102 + * + * \param ctx context of this notification + * \param device libusb_device this event occurred on + * \param event event that occurred + * \param user_data user data provided when this callback was registered + * \returns bool whether this callback is finished processing events. + * returning 1 will cause this callback to be deregistered + */ +typedef int (LIBUSB_CALL *libusb_hotplug_callback_fn)(libusb_context *ctx, + libusb_device *device, libusb_hotplug_event event, void *user_data); + +/** \ingroup libusb_hotplug + * Register a hotplug callback function + * + * Register a callback with the libusb_context. The callback will fire + * when a matching event occurs on a matching device. The callback is + * armed until either it is deregistered with libusb_hotplug_deregister_callback() + * or the supplied callback returns 1 to indicate it is finished processing events. + * + * If the \ref LIBUSB_HOTPLUG_ENUMERATE is passed the callback will be + * called with a \ref LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED for all devices + * already plugged into the machine. Note that libusb modifies its internal + * device list from a separate thread, while calling hotplug callbacks from + * libusb_handle_events(), so it is possible for a device to already be present + * on, or removed from, its internal device list, while the hotplug callbacks + * still need to be dispatched. This means that when using \ref + * LIBUSB_HOTPLUG_ENUMERATE, your callback may be called twice for the arrival + * of the same device, once from libusb_hotplug_register_callback() and once + * from libusb_handle_events(); and/or your callback may be called for the + * removal of a device for which an arrived call was never made. + * + * Since version 1.0.16, \ref LIBUSB_API_VERSION >= 0x01000102 + * + * \param[in] ctx context to register this callback with + * \param[in] events bitwise or of hotplug events that will trigger this callback. + * See \ref libusb_hotplug_event + * \param[in] flags bitwise or of hotplug flags that affect registration. + * See \ref libusb_hotplug_flag + * \param[in] vendor_id the vendor id to match or \ref LIBUSB_HOTPLUG_MATCH_ANY + * \param[in] product_id the product id to match or \ref LIBUSB_HOTPLUG_MATCH_ANY + * \param[in] dev_class the device class to match or \ref LIBUSB_HOTPLUG_MATCH_ANY + * \param[in] cb_fn the function to be invoked on a matching event/device + * \param[in] user_data user data to pass to the callback function + * \param[out] callback_handle pointer to store the handle of the allocated callback (can be NULL) + * \returns \ref LIBUSB_SUCCESS on success LIBUSB_ERROR code on failure + */ +int LIBUSB_CALL libusb_hotplug_register_callback(libusb_context *ctx, + int events, int flags, + int vendor_id, int product_id, int dev_class, + libusb_hotplug_callback_fn cb_fn, void *user_data, + libusb_hotplug_callback_handle *callback_handle); + +/** \ingroup libusb_hotplug + * Deregisters a hotplug callback. + * + * Deregister a callback from a libusb_context. This function is safe to call from within + * a hotplug callback. + * + * Since version 1.0.16, \ref LIBUSB_API_VERSION >= 0x01000102 + * + * \param[in] ctx context this callback is registered with + * \param[in] callback_handle the handle of the callback to deregister + */ +void LIBUSB_CALL libusb_hotplug_deregister_callback(libusb_context *ctx, + libusb_hotplug_callback_handle callback_handle); + +/** \ingroup libusb_hotplug + * Gets the user_data associated with a hotplug callback. + * + * Since version v1.0.24 \ref LIBUSB_API_VERSION >= 0x01000108 + * + * \param[in] ctx context this callback is registered with + * \param[in] callback_handle the handle of the callback to get the user_data of + */ +void * LIBUSB_CALL libusb_hotplug_get_user_data(libusb_context *ctx, + libusb_hotplug_callback_handle callback_handle); + +int LIBUSB_CALLV libusb_set_option(libusb_context *ctx, enum libusb_option option, ...); + +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +#if defined(__cplusplus) +} +#endif + +#endif diff --git a/sysroot-arm64/usr/lib/aarch64-linux-gnu/libudev.so b/sysroot-arm64/usr/lib/aarch64-linux-gnu/libudev.so new file mode 120000 index 0000000..a0c297d --- /dev/null +++ b/sysroot-arm64/usr/lib/aarch64-linux-gnu/libudev.so @@ -0,0 +1 @@ +lib/aarch64-linux-gnu/libudev.so.1 \ No newline at end of file diff --git a/sysroot-arm64/usr/lib/aarch64-linux-gnu/libudev.so.1 b/sysroot-arm64/usr/lib/aarch64-linux-gnu/libudev.so.1 new file mode 120000 index 0000000..b12b1bf --- /dev/null +++ b/sysroot-arm64/usr/lib/aarch64-linux-gnu/libudev.so.1 @@ -0,0 +1 @@ +libudev.so.1.7.8 \ No newline at end of file diff --git a/sysroot-arm64/usr/lib/aarch64-linux-gnu/libudev.so.1.7.8 b/sysroot-arm64/usr/lib/aarch64-linux-gnu/libudev.so.1.7.8 new file mode 100644 index 0000000..3091f25 Binary files /dev/null and b/sysroot-arm64/usr/lib/aarch64-linux-gnu/libudev.so.1.7.8 differ diff --git a/sysroot-arm64/usr/lib/aarch64-linux-gnu/libusb-1.0.a b/sysroot-arm64/usr/lib/aarch64-linux-gnu/libusb-1.0.a new file mode 100644 index 0000000..91afbef Binary files /dev/null and b/sysroot-arm64/usr/lib/aarch64-linux-gnu/libusb-1.0.a differ diff --git a/sysroot-arm64/usr/lib/aarch64-linux-gnu/libusb-1.0.so b/sysroot-arm64/usr/lib/aarch64-linux-gnu/libusb-1.0.so new file mode 120000 index 0000000..1acf7c4 --- /dev/null +++ b/sysroot-arm64/usr/lib/aarch64-linux-gnu/libusb-1.0.so @@ -0,0 +1 @@ +libusb-1.0.so.0.4.0 \ No newline at end of file diff --git a/sysroot-arm64/usr/lib/aarch64-linux-gnu/libusb-1.0.so.0 b/sysroot-arm64/usr/lib/aarch64-linux-gnu/libusb-1.0.so.0 new file mode 120000 index 0000000..1acf7c4 --- /dev/null +++ b/sysroot-arm64/usr/lib/aarch64-linux-gnu/libusb-1.0.so.0 @@ -0,0 +1 @@ +libusb-1.0.so.0.4.0 \ No newline at end of file diff --git a/sysroot-arm64/usr/lib/aarch64-linux-gnu/libusb-1.0.so.0.4.0 b/sysroot-arm64/usr/lib/aarch64-linux-gnu/libusb-1.0.so.0.4.0 new file mode 100644 index 0000000..5422f10 Binary files /dev/null and b/sysroot-arm64/usr/lib/aarch64-linux-gnu/libusb-1.0.so.0.4.0 differ diff --git a/sysroot-arm64/usr/lib/aarch64-linux-gnu/pkgconfig/libusb-1.0.pc b/sysroot-arm64/usr/lib/aarch64-linux-gnu/pkgconfig/libusb-1.0.pc new file mode 100644 index 0000000..875f2c4 --- /dev/null +++ b/sysroot-arm64/usr/lib/aarch64-linux-gnu/pkgconfig/libusb-1.0.pc @@ -0,0 +1,11 @@ +prefix=/usr +exec_prefix=${prefix} +libdir=${prefix}/lib/aarch64-linux-gnu +includedir=${prefix}/include + +Name: libusb-1.0 +Description: C API for USB device access from Linux, Mac OS X, Windows, OpenBSD/NetBSD and Solaris userspace +Version: 1.0.27 +Libs: -L${libdir} -lusb-1.0 +Libs.private: -ludev +Cflags: -I${includedir}/libusb-1.0 diff --git a/sysroot-arm64/usr/share/doc/libudev1/NEWS.Debian.gz b/sysroot-arm64/usr/share/doc/libudev1/NEWS.Debian.gz new file mode 100644 index 0000000..5c1d261 Binary files /dev/null and b/sysroot-arm64/usr/share/doc/libudev1/NEWS.Debian.gz differ diff --git a/sysroot-arm64/usr/share/doc/libudev1/changelog.Debian.gz b/sysroot-arm64/usr/share/doc/libudev1/changelog.Debian.gz new file mode 100644 index 0000000..ff68d67 Binary files /dev/null and b/sysroot-arm64/usr/share/doc/libudev1/changelog.Debian.gz differ diff --git a/sysroot-arm64/usr/share/doc/libudev1/copyright b/sysroot-arm64/usr/share/doc/libudev1/copyright new file mode 100644 index 0000000..62cf732 --- /dev/null +++ b/sysroot-arm64/usr/share/doc/libudev1/copyright @@ -0,0 +1,287 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: systemd +Upstream-Contact: systemd-devel@lists.freedesktop.org +Source: https://www.freedesktop.org/wiki/Software/systemd/ + +Files: * +Copyright: 2008-2015 Kay Sievers + 2010-2015 Lennart Poettering + 2012-2015 Zbigniew Jędrzejewski-Szmek + 2013-2015 Tom Gundersen + 2013-2015 Daniel Mack + 2010-2015 Harald Hoyer + 2013-2015 David Herrmann + 2013, 2014 Thomas H.P. Andersen + 2013, 2014 Daniel Buch + 2014 Susant Sahani + 2009-2015 Intel Corporation + 2000, 2005 Red Hat, Inc. + 2009 Alan Jenkins + 2010 ProFUSION embedded systems + 2010 Maarten Lankhorst + 1995-2004 Miquel van Smoorenburg + 1999 Tom Tromey + 2011 Michal Schmidt + 2012 B. Poettering + 2012 Holger Hans Peter Freyther + 2012 Dan Walsh + 2012 Roberto Sassu + 2013 David Strauss + 2013 Marius Vollmer + 2013 Jan Janssen + 2013 Simon Peeters +License: LGPL-2.1+ + +Files: src/basic/siphash24.h + src/basic/siphash24.c +Copyright: 2012 Jean-Philippe Aumasson + 2012 Daniel J. Bernstein +License: CC0-1.0 + +Files: src/shared/linux/* + src/basic/linux/* +Copyright: 2004-2009 Red Hat, Inc. + 2011-2014 PLUMgrid + 2001-2003 Sistina Software (UK) Limited. + 2008 Ian Kent + 1998 David S. Miller >davem@redhat.com> + 2001 Jeff Garzik + 2006-2010 Johannes Berg + 2008 Luis Carlos Cobo + 2008 Michael Buesch + 2008, 2009 Luis R. Rodriguez + 2008 Jouni Malinen + 2008 Colin McCabe + 2018-2019 Intel Corporation + 2007 Oracle. + 2009 Wolfgang Grandegger + 1999 Thomas Davis + 2015 Sabrina Dubroca + 1999-2000 Maxim Krasnyansky + 2015-2019 Jason A. Donenfeld +License: GPL-2 with Linux-syscall-note exception + +Files: src/basic/sparse-endian.h +Copyright: 2012 Josh Triplett +License: Expat + +Files: src/basic/MurmurHash2.c + src/basic/MurmurHash2.h + src/libsystemd/sd-journal/lookup3.c + src/libsystemd/sd-journal/lookup3.h +Copyright: none +License: public-domain + You can use this free for any purpose. It's in the public domain. It has no + warranty. + +Files: src/udev/ata_id/ata_id.c + src/udev/cdrom_id/cdrom_id.c + src/udev/dmi_memory_id/dmi_memory_id.c + src/udev/mtd_probe/mtd_probe.c + src/udev/mtd_probe/mtd_probe.h + src/udev/mtd_probe/probe_smartmedia.c + src/udev/scsi_id/scsi.h + src/udev/scsi_id/scsi_id.c + src/udev/scsi_id/scsi_id.h + src/udev/scsi_id/scsi_serial.c + src/udev/udevadm.c + src/udev/udevadm-control.c + src/udev/udevadm.h + src/udev/udevadm-info.c + src/udev/udevadm-monitor.c + src/udev/udevadm-settle.c + src/udev/udevadm-test-builtin.c + src/udev/udevadm-test.c + src/udev/udevadm-trigger.c + src/udev/udevadm-util.c + src/udev/udevadm-util.h + src/udev/udev-builtin-blkid.c + src/udev/udev-builtin.h + src/udev/udev-builtin-input_id.c + src/udev/udev-builtin-kmod.c + src/udev/udev-builtin-path_id.c + src/udev/udev-builtin-uaccess.c + src/udev/udev-builtin-usb_id.c + src/udev/udev-ctrl.h + src/udev/udevd.c + src/udev/udevd.h + src/udev/udev-event.c + src/udev/udev-event.h + src/udev/udev-node.c + src/udev/udev-node.h + src/udev/udev-rules.c + src/udev/udev-rules.h + src/udev/udev-watch.c + src/udev/udev-watch.h + src/udev/v4l_id/v4l_id.c +Copyright: 2003-2012 Kay Sievers + 2003-2004 Greg Kroah-Hartman + 2004 Chris Friesen + 2004, 2009, 2010 David Zeuthen + 2005, 2006 SUSE Linux Products GmbH + 2003 IBM Corp. + 2007 Hannes Reinecke + 2009 Canonical Ltd. + 2009 Scott James Remnant + 2009 Martin Pitt + 2009 Piter Punk + 2009, 2010 Lennart Poettering + 2009 Filippo Argiolas + 2010 Maxim Levitsky + 2011 ProFUSION embedded systems + 2011 Karel Zak + 2014 Zbigniew Jędrzejewski-Szmek + 2014 David Herrmann + 2014 Carlos Garnacho +License: GPL-2+ + +Files: debian/* +Copyright: 2010-2013 Tollef Fog Heen + 2011 Josh Triplett + 2013-2014 Michael Stapelberg + 2013-2020 Martin Pitt + 2013-2022 Michael Biebl + 2013 Daniel Schaal + 2013 Guido Günther + 2014-2015 Didier Roche + 2014-2015 Marco d'Itri + 2014-2017 Sjoerd Simons + 2014 Ansgar Burchardt + 2014 Jon Severinsson + 2015-2019 Felipe Sateler + 2015 Adam Conrad + 2015 Andreas Henriksson + 2015 Christian Seiler + 2015 Julian Wollrath + 2016-2018 Evgeny Vereshchagin + 2016,2018 Laurent Bigonville + 2016-2019 Dimitri John Ledkov + 2016,2019 Michael Prokop + 2016 Alexander Kurtz + 2016 Antonio Ospite + 2016 Iain Lane + 2016 Simon McVittie + 2017-2018 Nicolas Braud-Santoni + 2017-2019 Martin Pitt + 2017 Cyril Brulebois + 2017 Ondřej Nový + 2018-2019 Mert Dirik + 2018 Adam Borowski + 2018 Alf Gaida + 2018 Benjamin Drung + 2018 Gunnar Hjalmarsson + 2018 Manuel A. Fernandez Montecelo + 2019-2021 Balint Reczey + 2019-2021 Dan Streetman + 2019 Daniel Kahn Gillmor + 2020-2021 Helmut Grohne + 2020 Topi Miettinen + 2020 Youfu Zhang + 2020 Zbigniew Jędrzejewski-Szmek + 2020 наб + 2021-2022 Luca Boccassi + 2021-2022 Lukas Märdian + 2021 Frantisek Sumsal + 2021 Ioanna Alifieraki + 2021 Jan Kiszka + 2021 Matthias Klumpp + 2021 Salvatore Bonaccorso +License: LGPL-2.1+ + +License: Expat + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + . + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + . + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + IN THE SOFTWARE. + +License: GPL-2 with Linux-syscall-note exception + NOTE! This copyright does *not* cover user programs that use kernel services + by normal system calls - this is merely considered normal use of the kernel, + and does *not* fall under the heading of "derived work". Also note that the + GPL below is copyrighted by the Free Software Foundation, but the instance of + code that it refers to (the Linux kernel) is copyrighted by me and others who + actually wrote it. + . + Also note that the only valid version of the GPL as far as the kernel is + concerned is _this_ particular version of the license (ie v2, not v2.2 or v3.x + or whatever), unless explicitly otherwise stated. + . + Linus Torvalds + . + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + . + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + . + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. + . + On Debian and systems the full text of the GNU General Public + License version 2 can be found in the file + `/usr/share/common-licenses/GPL-2` + +License: GPL-2+ + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + . + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + . + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + . + On Debian systems, the complete text of the GNU General Public License + version 2 can be found in ‘/usr/share/common-licenses/GPL-2’. + +License: LGPL-2.1+ + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1, or (at your option) + any later version. + . + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + . + You should have received a copy of the GNU Lesser General Public License along + with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + . + On Debian systems, the complete text of the GNU Lesser General Public + License version 2.1 can be found in ‘/usr/share/common-licenses/LGPL-2.1’. + +License: CC0-1.0 + To the extent possible under law, the author(s) have dedicated all copyright + and related and neighboring rights to this software to the public domain + worldwide. This software is distributed without any warranty. + . + You should have received a copy of the CC0 Public Domain Dedication along with + this software. If not, see . + . + On Debian systems, the complete text of the CC0 1.0 Universal license can be + found in ‘/usr/share/common-licenses/CC0-1.0’. diff --git a/sysroot-arm64/usr/share/doc/libusb-1.0-0-dev/README b/sysroot-arm64/usr/share/doc/libusb-1.0-0-dev/README new file mode 120000 index 0000000..ecbd147 --- /dev/null +++ b/sysroot-arm64/usr/share/doc/libusb-1.0-0-dev/README @@ -0,0 +1 @@ +../libusb-1.0-0/README \ No newline at end of file diff --git a/sysroot-arm64/usr/share/doc/libusb-1.0-0-dev/changelog.Debian.gz b/sysroot-arm64/usr/share/doc/libusb-1.0-0-dev/changelog.Debian.gz new file mode 120000 index 0000000..8e3297c --- /dev/null +++ b/sysroot-arm64/usr/share/doc/libusb-1.0-0-dev/changelog.Debian.gz @@ -0,0 +1 @@ +../libusb-1.0-0/changelog.Debian.gz \ No newline at end of file diff --git a/sysroot-arm64/usr/share/doc/libusb-1.0-0-dev/copyright b/sysroot-arm64/usr/share/doc/libusb-1.0-0-dev/copyright new file mode 100644 index 0000000..5890798 --- /dev/null +++ b/sysroot-arm64/usr/share/doc/libusb-1.0-0-dev/copyright @@ -0,0 +1,121 @@ +This package was debianized by Christopher L Cheney on +Wed, 13 Jun 2001 12:21:44 -0500. + +It was downloaded from http://www.libusb.info + + +Authors: + Alan Ott + Alan Stern + Alex Vatchenko + Andrew Fernandes + Anthony Clay + Artem Egorkine + Aurelien Jarno + Bastien Nocera + Bei Zhang + Benjamin Dobell + Chris Dickens + Colin Walters + Dave Camarillo + David Engraf + David Moore + Davidlohr Bueso + Federico Manzan + Felipe Balbi + Florian Albrechtskirchinger + Francesco Montorsi + Francisco Facioni + Graeme Gill + Gustavo Zacarias + Hans Ulrich Niedermann + Hector Martin + Hoi-Ho Chan + Ilya Konstantinov + James Hanko + Joshua Blake + Karsten Koenig + Konrad Rzepecki + Kuangye Guo + Lars Wirzenius + Luca Longinotti + Martin Koegler + Matthias Bolte + Mike Frysinger + Mikhail Gusarov + Moritz Fischer + Nicholas Corgan + Omri Iluz + Orin Eman + Paul Fertser + Pekka Nikander + Rob Walker + Sean McBride + Sebastian Pipping + Simon Haggett + Thomas Röfer + Tim Roberts + Toby Peterson + Trygve Laugstøl + Uri Lublin + Vasily Khoruzhick + Vegard Storheil Eriksen + Vitali Lovich + Xiaofan Chen + Zoltán Kovács + Роман Донченко + xantares + + +Copyright: + Copyright (C) 2001 Johannes Erdfelt + Copyright (C) 2007-2009 Daniel Drake + Copyright (C) 2010-2012 Peter Stuge + Copyright (C) 2008-2013 Nathan Hjelm + Copyright (C) 2009-2013 Pete Batard + Copyright (C) 2009-2013 Ludovic Rousseau + Copyright (C) 2010-2012 Michael Plante + Copyright (C) 2011-2013 Hans de Goede + Copyright (C) 2012-2013 Martin Pieuchot + + +License of the libusb library and most examples except ezusb and fxload: + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. + +On Debian systems, the complete text of the LGPL license can be found +in the /usr/share/common-licenses/LGPL-2.1 file. + + +License of ezusb and fxload: + This source code is free software; you can redistribute it + and/or modify it in source code form under the terms of the GNU + General Public License as published by the Free Software + Foundation; either version 2 of the License, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 + USA. + +On Debian systems, the complete text of the GPL license can be found +in the /usr/share/common-licenses/GPL-2 file. + diff --git a/sysroot-arm64/usr/share/doc/libusb-1.0-0/README b/sysroot-arm64/usr/share/doc/libusb-1.0-0/README new file mode 100644 index 0000000..0f66085 --- /dev/null +++ b/sysroot-arm64/usr/share/doc/libusb-1.0-0/README @@ -0,0 +1,29 @@ +# libusb + +libusb is a library for USB device access from Linux, macOS, +Windows, OpenBSD/NetBSD, Haiku, Solaris userspace, and WebAssembly +via WebUSB. +It is written in C (Haiku backend in C++) and licensed under the GNU +Lesser General Public License version 2.1 or, at your option, any later +version (see COPYING). + +libusb is abstracted internally in such a way that it can hopefully +be ported to other operating systems. Please see the PORTING +file for more information. + +libusb homepage: +https://libusb.info/ + +Developers will wish to consult the API documentation: +http://api.libusb.info + +Use the mailing list for questions, comments, etc: +http://mailing-list.libusb.info + +- Hans de Goede +- Xiaofan Chen +- Ludovic Rousseau +- Nathan Hjelm +- Chris Dickens + +(Please use the mailing list rather than mailing developers directly) diff --git a/sysroot-arm64/usr/share/doc/libusb-1.0-0/changelog.Debian.gz b/sysroot-arm64/usr/share/doc/libusb-1.0-0/changelog.Debian.gz new file mode 100644 index 0000000..778afe2 Binary files /dev/null and b/sysroot-arm64/usr/share/doc/libusb-1.0-0/changelog.Debian.gz differ diff --git a/sysroot-arm64/usr/share/doc/libusb-1.0-0/copyright b/sysroot-arm64/usr/share/doc/libusb-1.0-0/copyright new file mode 100644 index 0000000..5890798 --- /dev/null +++ b/sysroot-arm64/usr/share/doc/libusb-1.0-0/copyright @@ -0,0 +1,121 @@ +This package was debianized by Christopher L Cheney on +Wed, 13 Jun 2001 12:21:44 -0500. + +It was downloaded from http://www.libusb.info + + +Authors: + Alan Ott + Alan Stern + Alex Vatchenko + Andrew Fernandes + Anthony Clay + Artem Egorkine + Aurelien Jarno + Bastien Nocera + Bei Zhang + Benjamin Dobell + Chris Dickens + Colin Walters + Dave Camarillo + David Engraf + David Moore + Davidlohr Bueso + Federico Manzan + Felipe Balbi + Florian Albrechtskirchinger + Francesco Montorsi + Francisco Facioni + Graeme Gill + Gustavo Zacarias + Hans Ulrich Niedermann + Hector Martin + Hoi-Ho Chan + Ilya Konstantinov + James Hanko + Joshua Blake + Karsten Koenig + Konrad Rzepecki + Kuangye Guo + Lars Wirzenius + Luca Longinotti + Martin Koegler + Matthias Bolte + Mike Frysinger + Mikhail Gusarov + Moritz Fischer + Nicholas Corgan + Omri Iluz + Orin Eman + Paul Fertser + Pekka Nikander + Rob Walker + Sean McBride + Sebastian Pipping + Simon Haggett + Thomas Röfer + Tim Roberts + Toby Peterson + Trygve Laugstøl + Uri Lublin + Vasily Khoruzhick + Vegard Storheil Eriksen + Vitali Lovich + Xiaofan Chen + Zoltán Kovács + Роман Донченко + xantares + + +Copyright: + Copyright (C) 2001 Johannes Erdfelt + Copyright (C) 2007-2009 Daniel Drake + Copyright (C) 2010-2012 Peter Stuge + Copyright (C) 2008-2013 Nathan Hjelm + Copyright (C) 2009-2013 Pete Batard + Copyright (C) 2009-2013 Ludovic Rousseau + Copyright (C) 2010-2012 Michael Plante + Copyright (C) 2011-2013 Hans de Goede + Copyright (C) 2012-2013 Martin Pieuchot + + +License of the libusb library and most examples except ezusb and fxload: + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. + +On Debian systems, the complete text of the LGPL license can be found +in the /usr/share/common-licenses/LGPL-2.1 file. + + +License of ezusb and fxload: + This source code is free software; you can redistribute it + and/or modify it in source code form under the terms of the GNU + General Public License as published by the Free Software + Foundation; either version 2 of the License, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 + USA. + +On Debian systems, the complete text of the GPL license can be found +in the /usr/share/common-licenses/GPL-2 file. + diff --git a/version.json b/version.json index 4ed9dca..60983ec 100644 --- a/version.json +++ b/version.json @@ -1,6 +1,6 @@ { - "version": "0.2", - "date": "02.08.2026 um 09:34", + "version": "0.2.2", + "build_date": "03.08.2026 um 14;01", "description": "Messung von zwei Spannung und Steuerung von Relais", "features": [ "ADS1115-Abfrage über go-i2c", diff --git a/web/server.go b/web/server.go index f83a6e3..294e0ce 100644 --- a/web/server.go +++ b/web/server.go @@ -45,11 +45,11 @@ func NewServer(port string, readVolt func(int) float64, toggle func(int), getRel } } -func (s *Server) Start() error { +func (s *Server) Start(certFile, keyFile string) error { http.HandleFunc("/", s.handleIndex) http.HandleFunc("/api/status", s.handleAPIStatus) http.HandleFunc("/api/toggle", s.handleAPIToggle) - return http.ListenAndServe(s.port, nil) + return http.ListenAndServeTLS(s.port, certFile, keyFile, nil) } func (s *Server) handleIndex(w http.ResponseWriter, r *http.Request) { diff --git a/web/static/index.html b/web/static/index.html index e71ab3d..d853e75 100644 --- a/web/static/index.html +++ b/web/static/index.html @@ -91,7 +91,7 @@