-
Notifications
You must be signed in to change notification settings - Fork 8
Backport USB rework and devinfo API addition to 3.3 release #37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
0d99451
usb: move phy to union with pci_dev in hcd_info_t
adamgreloch e8d3500
usb: fix urbSync transfers
adamgreloch 1992a84
libusb: lookup `devfs` in addition to `/dev` when connecting
adamgreloch 6241f95
drv: fix drvBind to fail if no driver is matched
adamgreloch 0791bfa
drv: wait for any drivers to be added before trying to match iface
adamgreloch 0602c75
usb: add port change detect workaround for L2 TTs
adamgreloch 77aab09
dev: deduce product name from class if string descriptors are unavail…
adamgreloch 76cc2f7
hcd: use uint32_t for base/phybase instead of int
adamgreloch 743b0bc
libusb/driver: add generic insertion/deletion/completion handling
adamgreloch f16b500
libusb/driver: add usb_driver_t struct and run drivers from it
adamgreloch 2a4fe5c
libusb/driver: generalize pipeOps
adamgreloch 824615b
usb: add ability to run device drivers from usbhost process
adamgreloch 50c9489
usb: add option to restrict to internal drivers only
adamgreloch 7807d8b
usb/hcd: avoid potential race by initializing roothub before hcd init
adamgreloch 61db7c5
libusb: fix insertion result not being passed to msg sender
adamgreloch 5294de4
usb: pass device insertion result from driver to usbhost
adamgreloch 7e41edf
libusb: move external headers to `include` dir
adamgreloch 29f3c91
unify libusb/usb log prints
adamgreloch 7085871
usb/usb: replace USB_INTERNAL_ONLY ifdefs to always create /dev/usb
adamgreloch 90bc653
libusb: fix driver name passing if using procdriver
adamgreloch beda0f0
usb: preserve utf16 value of string descriptors
adamgreloch c6eb186
dev: print vid:pid on device insertion
adamgreloch e858d51
usb/drv: fix drivers not being bound to all possible dev interfaces
adamgreloch 6643ced
usb: add device info retrieval API based on driver's device file oid
adamgreloch 91853a6
usb/drv: reset msg before each msgSend
adamgreloch File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,12 @@ | ||
| # | ||
| # Makefile for Phoenix-RTOS libusb | ||
| # | ||
| # Copyright 2021 Phoenix Systems | ||
| # Copyright 2025 Phoenix Systems | ||
| # | ||
|
|
||
| NAME := libusb | ||
| LOCAL_PATH := $(call my-dir) | ||
| HEADERS := $(wildcard $(LOCAL_PATH)*.h) | ||
| LOCAL_SRCS := cdc_client.c hid_client.c driver.c | ||
| LOCAL_SRCS := cdc_client.c hid_client.c driver.c procdriver.c internal.c devinfo.c | ||
| LOCAL_CFLAGS := -I$(LOCAL_PATH) | ||
|
|
||
| include $(static-lib.mk) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| /* | ||
| * Phoenix-RTOS | ||
| * | ||
| * Libusb driver interface | ||
| * | ||
| * USB low-level information API for userspace applications | ||
| * | ||
| * Copyright 2025 Phoenix Systems | ||
adamgreloch marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| * Author: Adam Greloch | ||
| * | ||
| * %LICENSE% | ||
| */ | ||
|
|
||
| #include <usbdriver.h> | ||
|
|
||
| #include <usbdevinfo.h> | ||
|
|
||
| #include "usbinternal.h" | ||
| #include "log.h" | ||
|
|
||
|
|
||
| int usb_devinfoGet(oid_t oid, usb_devinfo_desc_t *desc) | ||
| { | ||
| int err; | ||
| oid_t hostOid; | ||
| msg_t msg = { 0 }; | ||
| usb_msg_t *imsg = (usb_msg_t *)msg.i.raw; | ||
|
|
||
| usb_hostLookup(&hostOid); | ||
|
|
||
| msg.type = mtDevCtl; | ||
| imsg->type = usb_msg_devdesc; | ||
| imsg->devdesc.oid = oid; | ||
| msg.o.data = desc; | ||
| msg.o.size = sizeof(usb_devinfo_desc_t); | ||
|
|
||
| err = msgSend(hostOid.port, &msg); | ||
| if (err < 0) { | ||
| log_error("msgSend failed: %d\n", err); | ||
| return err; | ||
| } | ||
|
|
||
| if (msg.o.err < 0) { | ||
| log_error("msg.o.err=%d\n", msg.o.err); | ||
| return msg.o.err; | ||
| } | ||
|
|
||
| return 0; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.