You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am on a ds220j with DSM 7.2 & kernel 4.4.x and I didn't want to use virtualhere so I set about seeing if I could get usbip tools working, to share HID(k+m) devices from my NAS to my windows pc using usbip-win2. Synology in their wisdom messed with the driver they included and also the tools(which are from the 2.x kernel version) to support printers but made it difficult on much else. Maybe there is some trick to them, or they have better tools and drivers on the Virtual Machine supporting models.
I did see some google searches and found some posts in synology community forums and reddit that had interest, so I figure instead of deleting everything, I'd share. I don't intend to make a package but here are the steps I followed in case anybody wants to repeat or clean it up to make a package, and should hopefully help be a first step towards doing so.
First off is making the usbip tools from the 4.4.x kernel.
Create a directory in spksrc/cross called usbip and create a Makefile with the following:
PKG_NAME = usbip
PKG_VERS = 4.4.x
PKG_EXT = tar.gz
PKG_DIST_NAME = $(PKG_NAME)-$(PKG_VERS).$(PKG_EXT)
PKG_DIST_SITE = https://github.com/CeruleanSky/usbip-4.4.x/archive/refs/tags/
PKG_DIR = usbip-4.4.x-$(PKG_NAME)-$(PKG_VERS)
include ../../mk/spksrc.common.mk
BUILD_DEPENDS = cross/libudev_219
HOMEPAGE = https://www.kernel.org/
COMMENT = usbip tools included in the linux kernel
LICENSE = GPLv2
include ../../mk/spksrc.common.mk
GNU_CONFIGURE = 1
PRE_CONFIGURE_TARGET = usbip_pre_configure
#shared modules need extra compile fixing
CONFIGURE_ARGS = --disable-shared
include ../../mk/spksrc.cross-cc.mk
.PHONY: usbip_pre_configure
usbip_pre_configure:
$(RUN) ; chmod +x ./autogen.sh
$(RUN) ; ./autogen.sh
You might have to fix those $(RUN) statements in the bottom to have tabs instead of space or vice versa in front of them.
This makefile will grab usbip tools that is almost the same as in the linux 4.4.302 kernel, but with one change, the usbip-host module's internal name has been renamed to usbip to match the synology kernel modules name.
Then you go make digests , make arch-rtd1296-7.2 or you can attempt whatever your DSM and chipset is which may have different problems. It will fail, if this were a package somewhere preconfigure would use sed scripts to fix the files, but you can just use nano or vim to fix the badly compiling ones instead.
First edit `work-rtd1296-7.2/systemd-219/src/shared/missing.h or whatever your work folder is called and around line 748 comment out the next 3 lines to look similar to
go to the near top area of work-rtd1296-7.2/systemd-219/src/shared/macro.h where the other include statements are and add a #include <sys/sysmacros.h> to the include section. Above the #include "<sys/types.h>" lines works.
Now go make arch-rtd1296-7.2 again and it should all build.
You'll find your files to transfer to your NAS in work-rtd1296-7.2/install/usr/local/usbip/sbin
#######################################
Next step is getting a working kernel module. Fortunately building this much easier. Synology builds the usbip-inf driver which doesn't work so well. But they did include alternative drivers in the kernel source that at least work for hid devices and perhaps other things as well. Though it would probably be best if the original kernel ones were only lightly modified or backported someday.
Create a directory spksrc/spk/synokernel-usbip and create the following Makefile:
Do make arch-rtd1296-7.2 and you'll find your kernel modules in work-rtd1296-7.2/install/usr/local/lib/modules/rtd1296-7.2/4.4.302+/drivers/usb/usbip to place on your NAS. Next you'll have to unload the old modules and load the alternative ones.
Where insmod ./usbip-... is where ever you put your new kernel modules. You'll probably want a startup script for this. I didn't replace the old ones just in case it broke something that I wouldn't realize until later.
With your tools that were compiled earlier, now you need to do a ./usbip list -l , then do a ./usbip bind -b 2-1 or whatever the id is of the usb device you want share is, then run ./usbipd perhaps adding a -D to keep it running as a daemon. Now you can connect to your device with usbip-win2 or a lot more usbip supporting apps.
Thnx a lot for your contribution, well done. Hopefully this will be beneficial for others or someone may look into integrating this into a package. If you need guidance (and have time and interest) in pursuing this work don't hesitate to reach out. Cheers!
I am on a ds220j with DSM 7.2 & kernel 4.4.x and I didn't want to use virtualhere so I set about seeing if I could get usbip tools working, to share HID(k+m) devices from my NAS to my windows pc using usbip-win2. Synology in their wisdom messed with the driver they included and also the tools(which are from the 2.x kernel version) to support printers but made it difficult on much else. Maybe there is some trick to them, or they have better tools and drivers on the Virtual Machine supporting models.
I did see some google searches and found some posts in synology community forums and reddit that had interest, so I figure instead of deleting everything, I'd share. I don't intend to make a package but here are the steps I followed in case anybody wants to repeat or clean it up to make a package, and should hopefully help be a first step towards doing so.
First off is making the usbip tools from the 4.4.x kernel.
Create a directory in spksrc/cross called usbip and create a Makefile with the following:
You might have to fix those $(RUN) statements in the bottom to have tabs instead of space or vice versa in front of them.
This makefile will grab usbip tools that is almost the same as in the linux 4.4.302 kernel, but with one change, the usbip-host module's internal name has been renamed to usbip to match the synology kernel modules name.
Then you go
make digests
,make arch-rtd1296-7.2
or you can attempt whatever your DSM and chipset is which may have different problems. It will fail, if this were a package somewhere preconfigure would use sed scripts to fix the files, but you can just use nano or vim to fix the badly compiling ones instead.work-rtd1296-7.2/systemd-219/src/shared/macro.h
where the other include statements are and add a#include <sys/sysmacros.h>
to the include section. Above the#include "<sys/types.h>"
lines works.Now go
make arch-rtd1296-7.2
again and it should all build.You'll find your files to transfer to your NAS in
work-rtd1296-7.2/install/usr/local/usbip/sbin
#######################################
Next step is getting a working kernel module. Fortunately building this much easier. Synology builds the usbip-inf driver which doesn't work so well. But they did include alternative drivers in the kernel source that at least work for hid devices and perhaps other things as well. Though it would probably be best if the original kernel ones were only lightly modified or backported someday.
Create a directory spksrc/spk/synokernel-usbip and create the following Makefile:
Do
make arch-rtd1296-7.2
and you'll find your kernel modules inwork-rtd1296-7.2/install/usr/local/lib/modules/rtd1296-7.2/4.4.302+/drivers/usb/usbip
to place on your NAS. Next you'll have to unload the old modules and load the alternative ones.Where insmod ./usbip-... is where ever you put your new kernel modules. You'll probably want a startup script for this. I didn't replace the old ones just in case it broke something that I wouldn't realize until later.
With your tools that were compiled earlier, now you need to do a
./usbip list -l
, then do a./usbip bind -b 2-1
or whatever the id is of the usb device you want share is, then run./usbipd
perhaps adding a-D
to keep it running as a daemon. Now you can connect to your device with usbip-win2 or a lot more usbip supporting apps.###########################
Bonus is
To get the usb id database to get some names when you list things.
The text was updated successfully, but these errors were encountered: