Skip to content

Commit

Permalink
Fix for LinuxSDK 2019.01
Browse files Browse the repository at this point in the history
  • Loading branch information
lelegard committed Feb 12, 2019
1 parent a306cb3 commit 2747b83
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 11 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ Windows and Linux systems.

### Version identification

Currently, there are three different device drivers in the LinuxSDK package
named `Dta`, `DtaNw` and `Dtu`. Each driver has a distinct version number.
Currently, there are different device drivers in the LinuxSDK package named
`Dta`, `DtaNw`, `Dtu`, `DtPcie`. Each driver has a distinct version number.
It is not possible to provide three different DKMS packages since these drivers
interact with each other in the kernel (at least `Dta` and `DtaNw`) and
contain common code. It is important that a consistent combination of drivers
Expand Down
9 changes: 5 additions & 4 deletions build-dektec-dkms
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ cp "$SDKDIR/License" \
"$SDKDIR/Readme" \
"$SDKDIR/Drivers/Dta/Source/Linux/51-dta.rules" \
"$SDKDIR/Drivers/Dtu/Source/Linux/51-dtu.rules" \
"$SDKDIR/Drivers/DtPcie/Source/Linux/51-dtpcie.rules" \
"$SRCDIR"

# In case of "prepare only", we are done.
Expand All @@ -253,17 +254,17 @@ if $INSTALL; then
verbose "installing dkms dektec/$VERSION"
sudo rm -rf "$DKMS_INSTALL"
sudo cp -r "$DKMS_DIR" "$DKMS_INSTALL" || cleanexit 1
sudo install -m 644 -o root -g root "$SRCDIR/51-dta.rules" "$SRCDIR/51-dtu.rules" /etc/udev/rules.d/
sudo install -m 644 -o root -g root "$SRCDIR/51-dta.rules" "$SRCDIR/51-dtu.rules" "$SRCDIR/51-dtpcie.rules" /etc/udev/rules.d/
sudo dkms install -m dektec -v "$VERSION" --force
cleanexit 0
fi

# Special uninstall operation.
if $UNINSTALL; then
verbose "removing dkms dektec/$VERSION"
sudo rmmod DtaNw Dta Dtu
sudo rmmod DtaNw Dta Dtu DtPcie
sudo dkms remove "dektec/$VERSION" --all
sudo rm -rf "$DKMS_INSTALL" /etc/udev/rules.d/51-dta.rules /etc/udev/rules.d/51-dtu.rules
sudo rm -rf "$DKMS_INSTALL" /etc/udev/rules.d/51-dta.rules /etc/udev/rules.d/51-dtu.rules /etc/udev/rules.d/51-dtpcie.rules
cleanexit 0
fi

Expand Down Expand Up @@ -336,7 +337,7 @@ if $DEB_DISTRO; then
done
chmod 755 "$DEBDIR/DEBIAN/postinst" "$DEBDIR/DEBIAN/prerm"
cp -rp "$SRCDIR/dektec-$VERSION" "$DEBDIR/usr/src"
install -m 644 "$SRCDIR/51-dta.rules" "$SRCDIR/51-dtu.rules" "$DEBDIR/etc/udev/rules.d"
install -m 644 "$SRCDIR/51-dta.rules" "$SRCDIR/51-dtu.rules" "$SRCDIR/51-dtpcie.rules" "$DEBDIR/etc/udev/rules.d"
install -m 644 "$SRCDIR/Readme" "$SRCDIR/License" "$DEBDIR/usr/share/doc/dektec-dkms"
# Build the binary package
Expand Down
1 change: 1 addition & 0 deletions config/Makefile.template
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ default:
$(MAKE) -C Drivers/Dta/Source/Linux
$(MAKE) -C Drivers/DtaNw/Source/Linux
$(MAKE) -C Drivers/Dtu/Source/Linux
$(MAKE) -C Drivers/DtPcie/Source/Linux

clean:
find . \( -name '.*.o.cmd' -o -name '.*.ko.cmd' -o -name '*.mod.c' -o -name '*.o' -o -name '.*.d' -o -name '*.ko' -o -name '.tmp_versions' -o -name 'modules.order' -o -name 'Module.symvers' \) -print0 | xargs -0 rm -rf
3 changes: 2 additions & 1 deletion config/control.template
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ Depends: dkms, linux-headers-amd64 | linux-headers-generic | linux-headers
Description: Source code and DKMS setup for the Dektec device drivers.
This package installs the source code and DKMS setup for the kernel modules
of the Dektec device drivers. Each time the kernel is upgraded, the Dektec
modules are automatically recompiled. The provided drivers are Dta, DtaNw, Dtu.
modules are automatically recompiled. The provided drivers are Dta, DtaNw,
Dtu and DtPcie.
.
Dektec is a manufacturer of PC add-on cards, USB devices, IP converters and
software for the professional digital-television market. Their products are
Expand Down
5 changes: 3 additions & 2 deletions config/dektec-dkms.spec
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Requires: elfutils-libelf-devel
%description
Provide the source code and DKMS setup for the kernel modules of the Dektec
device drivers. Each time the kernel is upgraded, the Dektec modules are
automatically recompiled. The provided drivers are Dta, DtaNw, Dtu.
automatically recompiled. The provided drivers are Dta, DtaNw, Dtu, DtPcie.

Dektec is a manufacturer of PC add-on cards, USB devices, IP converters and
software for the professional digital-television market. Their products are
Expand All @@ -35,7 +35,7 @@ This is an independent packaging of the Dektec original drivers.
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/usr/src $RPM_BUILD_ROOT/etc/udev/rules.d
cp -r dektec-%{version} $RPM_BUILD_ROOT/usr/src
install -m 644 51-dta.rules 51-dtu.rules $RPM_BUILD_ROOT/etc/udev/rules.d
install -m 644 51-dta.rules 51-dtu.rules 51-dtpcie.rules $RPM_BUILD_ROOT/etc/udev/rules.d

%post
[[ $(/usr/sbin/dkms status | grep dektec | grep "%{version}" | wc -l) -eq 0 ]] && /usr/sbin/dkms add -m dektec -v "%{version}"
Expand All @@ -55,4 +55,5 @@ rm -rf $RPM_BUILD_ROOT
/usr/src/dektec-%{version}
/etc/udev/rules.d/51-dta.rules
/etc/udev/rules.d/51-dtu.rules
/etc/udev/rules.d/51-dtpcie.rules
%doc Readme License
4 changes: 4 additions & 0 deletions config/dkms.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,7 @@ DEST_MODULE_LOCATION[1]=/kernel/drivers/misc
BUILT_MODULE_NAME[2]=Dtu
BUILT_MODULE_LOCATION[2]=Drivers/Dtu/Source/Linux
DEST_MODULE_LOCATION[2]=/kernel/drivers/misc

BUILT_MODULE_NAME[3]=DtPcie
BUILT_MODULE_LOCATION[3]=Drivers/DtPcie/Source/Linux
DEST_MODULE_LOCATION[3]=/kernel/drivers/misc
4 changes: 2 additions & 2 deletions config/postinst.template
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

if [[ "$1" = "configure" ]]; then
# Fix file permissions and ownership.
chown -R root:root /usr/src/dektec-{{VERSION}} /etc/udev/rules.d/51-dta.rules /etc/udev/rules.d/51-dtu.rules /usr/share/doc/dektec-dkms
chown -R root:root /usr/src/dektec-{{VERSION}} /etc/udev/rules.d/51-dt*.rules /usr/share/doc/dektec-dkms
find /usr/src/dektec-{{VERSION}} -type f -print0 | xargs -0 chmod 644
find /usr/src/dektec-{{VERSION}} -type d -print0 | xargs -0 chmod 755
chmod 755 /usr/share/doc/dektec-dkms
chmod 644 /etc/udev/rules.d/51-dta.rules /etc/udev/rules.d/51-dtu.rules /usr/share/doc/dektec-dkms/*
chmod 644 /etc/udev/rules.d/51-dt*.rules /usr/share/doc/dektec-dkms/*

# Build the initial version of the driver.
[[ $(/usr/sbin/dkms status | grep dektec | grep "{{VERSION}}" | wc -l) -eq 0 ]] && /usr/sbin/dkms add -m dektec -v "{{VERSION}}"
Expand Down
53 changes: 53 additions & 0 deletions patches/dektec-dkms-2019.01.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
diff -Naur dektec-dkms-2019.01.0/dektec-2019.01.0/Drivers/DtaNw/Source/Linux/DtaNwIal.c dektec-dkms-2019.01.0.fixed/dektec-2019.01.0/Drivers/DtaNw/Source/Linux/DtaNwIal.c
--- dektec-dkms-2019.01.0/dektec-2019.01.0/Drivers/DtaNw/Source/Linux/DtaNwIal.c 2019-02-13 16:15:43.437810888 +0100
+++ dektec-dkms-2019.01.0.fixed/dektec-2019.01.0/Drivers/DtaNw/Source/Linux/DtaNwIal.c 2019-02-13 16:29:19.038926498 +0100
@@ -79,8 +79,10 @@
#endif
static void DtaNwEvtGetDriverInfo(struct net_device* pDevice,
struct ethtool_drvinfo* pInfo);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,20,0)
static Int DtaNwEvtGetSettings(struct net_device* pDevice, struct ethtool_cmd* pCmd);
static Int DtaNwEvtSetSettings(struct net_device* pDevice, struct ethtool_cmd* pCmd);
+#endif
UInt32 DtaNwEvtGetLink(struct net_device* pDevice);
#ifdef NO_HW_FEATURE_SUPPORT
static UInt32 DtaNwEvtGetRxCsum(struct net_device* pDevice);
@@ -105,8 +107,10 @@
static const struct ethtool_ops EthToolOps =
{
.get_drvinfo = DtaNwEvtGetDriverInfo,
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,20,0)
.get_settings = DtaNwEvtGetSettings,
.set_settings = DtaNwEvtSetSettings,
+#endif
.get_link = DtaNwEvtGetLink,
#ifdef PERM_ADDR_SUPPORT
.get_perm_addr = DtaNwEvtGetPermAddr,
@@ -477,6 +481,7 @@

//-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- DtaNwEvtGetSettings -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
//
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,20,0)
static Int DtaNwEvtGetSettings(struct net_device* pDevice, struct ethtool_cmd* pCmd)
{
DtaNwDeviceData* pDvcData = netdev_priv(pDevice);
@@ -536,9 +541,11 @@
DtDbgOut(MAX, IAL, "Exit");
return 0;
}
+#endif

//-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- DtaNwEvtSetSettings -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
//
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,20,0)
static Int DtaNwEvtSetSettings(struct net_device* pDevice, struct ethtool_cmd* pCmd)
{
DtaNwDeviceData* pDvcData = netdev_priv(pDevice);
@@ -584,6 +591,7 @@

return 0;
}
+#endif

//-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- DtaNwEvtGetLink -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
//

0 comments on commit 2747b83

Please sign in to comment.