added isochronous modus

This commit is contained in:
2026-02-18 22:42:52 +01:00
parent 170f5dabcc
commit 99d9242264
7 changed files with 428 additions and 60 deletions
+43
View File
@@ -127,12 +127,55 @@ func readInterfaces(sysPath, busID string) []Interface {
iface.Driver = filepath.Base(driverLink)
}
// Read endpoints
iface.Endpoints = readEndpoints(ifacePath)
ifaces = append(ifaces, iface)
}
return ifaces
}
func readEndpoints(ifacePath string) []Endpoint {
entries, err := os.ReadDir(ifacePath)
if err != nil {
return nil
}
var eps []Endpoint
for _, entry := range entries {
name := entry.Name()
if !strings.HasPrefix(name, "ep_") || name == "ep_00" {
continue
}
epPath := filepath.Join(ifacePath, name)
addr, _ := strconv.ParseUint(readString(epPath, "bEndpointAddress"), 16, 8)
var transferType uint8
switch readString(epPath, "type") {
case "Control":
transferType = TransferTypeControl
case "Isoc":
transferType = TransferTypeIsochronous
case "Bulk":
transferType = TransferTypeBulk
case "Interrupt":
transferType = TransferTypeInterrupt
}
maxPkt := readUint32(epPath, "wMaxPacketSize")
eps = append(eps, Endpoint{
Address: uint8(addr),
TransferType: transferType,
MaxPacketSize: uint16(maxPkt),
})
}
return eps
}
func readString(dir, attr string) string {
data, err := os.ReadFile(filepath.Join(dir, attr))
if err != nil {