Skip to content
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

Allow filtering by port number #114

Open
desowin opened this issue Apr 4, 2021 · 1 comment
Open

Allow filtering by port number #114

desowin opened this issue Apr 4, 2021 · 1 comment

Comments

@desowin
Copy link
Owner

desowin commented Apr 4, 2021

Currently USBPcapCMD allows filtering by device address. The address gets saved between subsequent extcap starts. This is ok if the user does not reconnect the device and the device address stays intact.

It might be worthwhile to allow specifying filtered devices using port numbers. When filtered device is connected via hub, the full "path" should be used (e.g. 1:2:3 is when device is connected via two hubs in following way [Root Hub port 1] <- [USB Hub port 2] <- [USB Hub port 3] <- [device]).

@kamathba
Copy link

I will leave a breadcrumb here in case I don't get to making a PR.

Main hint was here: https://libusb-win32-devel.narkive.com/5JWg4Ofi/identify-the-physical-usb-ports-used-by-a-driver-handle#post3

Which refers to this code:
usb_enumerate_hub: https://github.com/libusb/libusb/blob/116d34f608b02f4e14668450b158acf5db726f95/libusb/os/windows_usb.c#L870
set_device_paths: https://github.com/libusb/libusb/blob/116d34f608b02f4e14668450b158acf5db726f95/libusb/os/windows_usb.c#L1401

Since that code is >10 years old, here is the most recent form of it:
get_dev_port_number: https://github.com/libusb/libusb/blob/master/libusb/os/windows_winusb.c#L1231

I haven't done any windows kernel work, and I'm not too familiar with this code base, but if there is enough information (files/functions in this codebase you think are in scope for modification) to make a shot at this that is reasonably likely to work and you be on board with, I could give it a go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants