File tree Expand file tree Collapse file tree 2 files changed +26
-10
lines changed
Expand file tree Collapse file tree 2 files changed +26
-10
lines changed Original file line number Diff line number Diff line change 4040 - name : Set up Cygwin
4141 uses : egor-tensin/setup-cygwin@v4
4242 with :
43- packages : gcc-core gcc-g++ make libreadline8 libreadline-devel libusb1.0 libusb1.0-devel libncursesw10
43+ packages : gcc-core gcc-g++ make libreadline8 libreadline-devel libusb1.0 libusb1.0-devel
4444
4545 - name : Compile project
4646 run : |
@@ -49,12 +49,15 @@ jobs:
4949 mkdir build
5050 cp usbhostfs_pc\usbhostfs_pc.exe build
5151 cp pspsh\pspsh.exe build
52- cp C:\tools\cygwin\bin\cygwin1.dll build
53- cp C:\tools\cygwin\bin\cygstdc++-6.dll build
54- cp C:\tools\cygwin\bin\cyggcc_s-seh-1.dll build
55- cp C:\tools\cygwin\bin\cygreadline8.dll build
56- cp C:\tools\cygwin\bin\cygusb-1.0.dll build
57- cp C:\tools\cygwin\bin\cygncursesw-10.dll build
52+
53+ - name : Collect and copy Cygwin DLL dependencies
54+ shell : C:\tools\cygwin\bin\bash.exe --norc -eo pipefail -o igncr '{0}'
55+ run : |
56+ for exe in build/usbhostfs_pc.exe build/pspsh.exe; do
57+ cygcheck "$exe" | grep -E '\.dll$' | grep "\\\\cyg" | while read -r dll; do
58+ [[ -f "$dll" ]] && cp "$dll" build/
59+ done
60+ done
5861
5962 - name : Upload artifacts
6063 if : ${{ success() }}
Original file line number Diff line number Diff line change 5858#define MAX_TOKENS 256
5959
6060#define BASE_PORT 10000
61+ #define USB_CONFIG_NUM 1
62+ #define USB_IFACE_NUM 0
6163
6264#ifdef __CYGWIN__
6365#define USB_TIMEOUT 1000
@@ -272,14 +274,25 @@ libusb_device_handle *open_device(libusb_device *usbdev)
272274 return NULL ;
273275 }
274276 if (!r ) {
275- r = libusb_set_configuration (ret , 1 );
277+ int cfgn ;
278+ r = libusb_get_configuration (ret , & cfgn );
276279 if (r ) {
277280 seteuid (getuid ());
278281 setegid (getgid ());
279- fprintf (stderr , "Failed at selecting USB configuration: %d\n" , r );
282+ fprintf (stderr , "Failed at reading selected USB configuration: %d\n" , r );
280283 return NULL ;
281284 }
282- r = libusb_claim_interface (ret , 0 );
285+ if (cfgn != USB_CONFIG_NUM )
286+ {
287+ r = libusb_set_configuration (ret , 1 );
288+ if (r ) {
289+ seteuid (getuid ());
290+ setegid (getgid ());
291+ fprintf (stderr , "Failed at selecting USB configuration: %d\n" , r );
292+ return NULL ;
293+ }
294+ }
295+ r = libusb_claim_interface (ret , USB_IFACE_NUM );
283296 if (r ) {
284297 seteuid (getuid ());
285298 setegid (getgid ());
You can’t perform that action at this time.
0 commit comments