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

Add verbose (dump) option, report endpoint numbers, simplify device adaptions #1

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

tormodvolden
Copy link

I have been adapting this to my own test device, and these changes should be useful in any case.

What do you think about moving this to the libusb/examples tree? It could get some more attention there.

"onexit" is used in the MinGW stdlib.h header file.

Signed-off-by: Tormod Volden <[email protected]>
@mcuee
Copy link

mcuee commented Apr 4, 2022

Nice one. No so sure if Wander will have time to update this repo after so long.

In case you want to extend this, another thing is to sort out the issues under Windows. Minor changes will be required.
Ref: https://github.com/mcuee/isochronous/blob/master/iso_win.c

$ make -i
cc -g3 -Wall -Wextra  -std=c99 -D_GNU_SOURCE=1 -D _POSIX_C_SOURCE=199309L -IC:/msys64/mingw64/include/libusb-1.0    -c -o iso.o iso.c
iso.c:42:1: error: conflicting types for 'onexit'
   42 | onexit(void)
      | ^~~~~~
In file included from C:/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/10.3.0/include/mm_malloc.h:27,
                 from C:/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/10.3.0/include/xmmintrin.h:34,
                 from C:/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/10.3.0/include/immintrin.h:29,
                 from C:/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/10.3.0/include/x86intrin.h:32,
                 from C:/msys64/mingw64/x86_64-w64-mingw32/include/winnt.h:1555,
                 from C:/msys64/mingw64/x86_64-w64-mingw32/include/minwindef.h:163,
                 from C:/msys64/mingw64/x86_64-w64-mingw32/include/windef.h:9,
                 from C:/msys64/mingw64/x86_64-w64-mingw32/include/windows.h:69,
                 from C:/msys64/mingw64/include/libusb-1.0/libusb.h:58,
                 from iso.c:1:
C:/msys64/mingw64/x86_64-w64-mingw32/include/stdlib.h:712:20: note: previous declaration of 'onexit' was here
  712 |   onexit_t __cdecl onexit(onexit_t _Func);
      |                    ^~~~~~
make: [<builtin>: iso.o] Error 1 (ignored)
cc  -o iso-test iso.o -LC:/msys64/mingw64/lib -lusb-1.0
cc.exe: error: iso.o: No such file or directory
make: [Makefile:9: iso-test] Error 1 (ignored)

@tormodvolden
Copy link
Author

@mcuee isn't your Windows build issue taken care of by 0c1dd29 ?

@mcuee
Copy link

mcuee commented Apr 4, 2022

My mistake. I was not using the right branch. It is good.

$ make
cc -g3 -Wall -Wextra  -std=c99 -D_GNU_SOURCE=1 -D _POSIX_C_SOURCE=199309L -IC:/msys64/mingw64/include/libusb-1.0    -c -o iso.o iso.c
cc  -o iso-test iso.o -LC:/msys64/mingw64/lib -lusb-1.0

@mcuee
Copy link

mcuee commented Apr 4, 2022

The potential improvement is to take in more options, for example.
-d: to specify the vid:pid
-i: to specify the interface
-a: to specify the alt setting

@tormodvolden
Copy link
Author

tormodvolden commented Apr 4, 2022

Hmm, I already added -i for "IN only" and -o for "OUT only" in my tree but -i for interface is also logical. Alternatively we can use an "in" or "out" argument, instead of an option.

@mcuee
Copy link

mcuee commented Apr 4, 2022

Hmm, I already added -i for "IN only" and -o for "OUT only" in my tree but -i for interface is also logical. Alternatively we can use an "in" or "out" argument, instead of an option.

No problem. We can even spell out more details like "intf" for interface and "altf" for interface alternate settings.

-d VID:PID (hex)
-i interface
-a altsetting
-e IN endpoint (hex, 0x80 will be or'ed)
-u OUT endpoint (hex)

An optional argument "in" or "out" limits the test
to the given direction.

Examples:
iso-test -d 0483:5730 -i 1 -a 1 -e 2 -u 1 -n 44 -v
iso-test -d 0483:5730 -i 1 -a 1 -u 1 out

Signed-off-by: Tormod Volden <[email protected]>
@tormodvolden
Copy link
Author

Added options for VID/PID, interface, altsetting, endpoints:
-d VID:PID (hex)
-i interface
-a altsetting
-e IN endpoint number (hex, 0x80 will be or'ed)
-u OUT endpoint number (hex)

An optional argument "in" or "out" limits the test to the given direction. Examples:

iso-test -d 0483:5730 -i 1 -a 1 -e 2 -u 1 -n 44 -v
iso-test -d 0483:5730 -i 1 -a 1 -u 1 out

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

Successfully merging this pull request may close these issues.

2 participants