Open bkerler opened 3 years ago
Hi,
In which Linux distribution are you on and version?
It looks like the libusb is not claiming the device. The get the serial command does not need to claim the interface, that is why it is working.
We need to try to replicate the issue to understand the root cause.
Best regards
Hi I'm using Ubuntu 20.04. Pykush is working fine, it's just the ykushcmd that's causing issues and doesn't work (except reading serial).
Hi! I have the same problem when cross-compiling the tool for OpenWRT 19.07.7 on Netgear WNDR3700v2.
# dmesg
[406508.729963] usb 1-1: new high-speed USB device number 62 using ehci-platform
[406508.962439] hub 1-1:1.0: USB hub found
[406508.972297] hub 1-1:1.0: 5 ports detected
[406509.729954] usb 1-1.2: new full-speed USB device number 63 using ehci-platform
[406509.926067] cdc_acm 1-1.2:1.0: ttyACM0: USB ACM device
[406509.970813] cdc_ether 1-1.2:1.2 usb0: register 'cdc_ether' at usb-1b000000.usb-1.2, CDC Ethernet Device, 7a:10:c2:67:b2:26
[406509.985029] cdc_ether 1-1.2:1.2 usb0: kevent 12 may have been dropped
[406509.991708] cdc_ether 1-1.2:1.2 usb0: kevent 11 may have been dropped
[406510.139964] usb 1-1.4: new full-speed USB device number 64 using ehci-platform
[406510.329142] hid-generic 0003:04D8:F11B.0006: hiddev96,hidraw0: USB HID v1.11 Device [Yepkit Lda. YKUSH3] on usb-1b000000.usb-1.4/input0
[406510.519961] usb 1-1.5: new high-speed USB device number 65 using ehci-platform
# ./ykushcmd ykush3 -l
Attached YKUSH 3 Boards:
1. Board found with serial number: YK3BXXXX
# ./ykushcmd ykush3 -d 1
Unable to write to device
I followed these instructions for the cross-compilation and applied the following patch to the ykush
repo (the openwrt
checkout is located besides the ykush
checkout in my filesystem):
diff --git a/Makefile b/Makefile
diff --git a/Makefile b/Makefile
index 501f1d2..6a9edeb 100644
--- a/Makefile
+++ b/Makefile
@@ -10,7 +10,6 @@ SOURCE += utils/command_parser.cpp
SOURCE += utils/string2val.cpp
SOURCE += usbhid/usbhid.cpp
-
SOURCE_FULL = $(addprefix src/, $(SOURCE))
PROG_SOURCE_FULL = $(addprefix src/, $(PROG_SOURCE))
OBJS = $(SOURCE_FULL:.cpp=.o)
@@ -19,24 +18,23 @@ PROG_OBJ = $(PROG_SOURCE_FULL:.cpp=.o)
DEFINES += _LINUX_
DEFINES += _LIBUSB_
-COMPILE_FLAGS += $(addprefix -D, $(DEFINES))
+CFLAGS += $(addprefix -D, $(DEFINES))
-CUR_PATH = $(shell echo $(PWD))
-INCLUDEPATHS = $(addprefix -I$(CUR_PATH)/, $(dir $(SOURCE_FULL)) libusb )
+INCLUDEPATHS = $(addprefix -I$(CURDIR)/, $(dir $(SOURCE_FULL)) libusb )
LOADPATHS =
LIBS = -lusb-1.0
-CPP = g++
+CXX ?= g++
ykushcmd : $(PROG_OBJ) $(OBJS)
- $(CPP) -o bin/$@ $(PROG_OBJ) $(OBJS) $(LIBS)
+ $(CXX) -o bin/$@ $(PROG_OBJ) $(OBJS) $(LDFLAGS) $(LIBS)
$(PROG_OBJ) : %.o : %.cpp
- $(CPP) $(COMPILE_FLAGS) $(INCLUDEPATHS) -c $< -o $@
+ $(CXX) $(CFLAGS) $(INCLUDEPATHS) -c $< -o $@
$(OBJS) : %.o : %.cpp %.h
- $(CPP) $(COMPILE_FLAGS) $(INCLUDEPATHS) -c $< -o $@
+ $(CXX) $(CFLAGS) $(INCLUDEPATHS) -c $< -o $@
clean :
diff --git a/build.sh b/build.sh
index 0a67b40..bb5dc24 100755
--- a/build.sh
+++ b/build.sh
@@ -2,9 +2,14 @@
#
# YKUSH command application build script
+export PATH=${PATH}:../openwrt/staging_dir/toolchain-mips_24kc_gcc-7.5.0_musl/bin/
+export STAGING_DIR=../openwrt/staging_dir/toolchain-mips_24kc_gcc-7.5.0_musl/
+
make clean
echo "Building YKUSHCMD..."
-make
-
-
+make -j CC=mips-openwrt-linux-musl-gcc CXX=mips-openwrt-linux-musl-g++ \
+ LD=mips-openwrt-linux-musl-ld \
+ LDFLAGS=-L../openwrt/staging_dir/target-mips_24kc_musl/usr/lib \
+ CFLAGS="-I../openwrt/staging_dir/target-mips_25kc_musl/usr/include -D_LIBUSB_ \
+ -I../openwrt/staging_dir/target-mips_24kc_musl/usr/include/hidapi"
Hi,
I'm getting "Unable to write to device" any time I try to use the -d or -u options. Getting the serial on ykush3 works fine.
$ sudo ykushcmd ykush3 -l Attached YKUSH Boards:
Furthermore, having a view on dmesg, it says the following :+1: [10996.094157] usb 1-3.1.1.4: new full-speed USB device number 23 using xhci_hcd [10996.217231] usb 1-3.1.1.4: New USB device found, idVendor=04d8, idProduct=f11b, bcdDevice= 0.01 [10996.217235] usb 1-3.1.1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [10996.217237] usb 1-3.1.1.4: Product: YKUSH3 [10996.217238] usb 1-3.1.1.4: Manufacturer: Yepkit Lda. [10996.217239] usb 1-3.1.1.4: SerialNumber: YK3BXXXX (XXXX replaced) [10996.298486] hid-generic 0003:04D8:F11B.000F: hiddev6,hidraw8: USB HID v1.11 Device [Yepkit Lda. YKUSH3] on usb-0000:09:00.1-3.1.1.4/input0 [11004.369927] usb 1-3.1.1.4: usbfs: process 34449 (ykushcmd) did not claim interface 0 before use