lowlander / dmx_usb_module Goto Github PK
View Code? Open in Web Editor NEWLinux kernel module for Enttec Open DMX dongle
Home Page: http://www.erwinrol.com/open-dmx-usb-linux-driver/
License: GNU General Public License v2.0
Linux kernel module for Enttec Open DMX dongle
Home Page: http://www.erwinrol.com/open-dmx-usb-linux-driver/
License: GNU General Public License v2.0
Hi, I've used your module now on a few different debian boxes (x86) for cheap dmx <> artnet converters, using the $15 dollar USB > DMX adapters off of amazon, which are also just FTDI converters like the Open DMX. Your module works great with them. I've written up instructions/documentation on how to compile and install it on modern apt based systems (both 4.x and 5.x kernel, seems to work great on both). I could submit it as a pull request so your git repo has instructions besides rasPI, would it be best to add it to readme.md or elsewhere?
I'm on ubuntu 64-bit with kernel 3.5.0-30-generic and things are not going well. I had to add an err() macro (see drewp@129aa31) but now I get lots of corruption on the output: https://www.youtube.com/watch?v=NLrY3HrXR3k .
Notably, when I output r/g/b to channels 50,51,52, my device shows black unless I dial its dmx offset down to 47.
make -C /lib/modules/5.15.0-46-generic/build M=/home/dmx/dmx_usb_module
make[1]: Entering directory '/usr/src/linux-headers-5.15.0-46-generic'
CC [M] /home/dmx/dmx_usb_module/dmx_usb.o
In file included from ./include/linux/kernel.h:19,
from /home/dmx/dmx_usb_module/dmx_usb.c:16:
/home/dmx/dmx_usb_module/dmx_usb.c: In function ‘dmx_usb_write’:
./include/linux/kern_levels.h:5:18: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘size_t’ {aka ‘long unsigned int’} [-Wformat=]
5 | #define KERN_SOH "\001" /* ASCII Start Of Header /
| ^~~~~~
./include/linux/printk.h:422:11: note: in definition of macro ‘printk_index_wrap’
422 | _p_func(_fmt, ##VA_ARGS);
| ^~~~
/home/dmx/dmx_usb_module/dmx_usb.c:41:45: note: in expansion of macro ‘printk’
41 | #define dbg(format, arg...) do { if (debug) printk(KERN_DEBUG FILE ": " format "\n" , ## arg); } while (0)
| ^~~~~~
./include/linux/kern_levels.h:15:20: note: in expansion of macro ‘KERN_SOH’
15 | #define KERN_DEBUG KERN_SOH "7" / debug-level messages */
| ^~~~~~~~
/home/dmx/dmx_usb_module/dmx_usb.c:41:52: note: in expansion of macro ‘KERN_DEBUG’
41 | #define dbg(format, arg...) do { if (debug) printk(KERN_DEBUG FILE ": " format "\n" , ## arg); } while (0)
| ^~~~~~~~~~
/home/dmx/dmx_usb_module/dmx_usb.c:409:2: note: in expansion of macro ‘dbg’
409 | dbg("%s - minor %d, count = %d", FUNCTION, dev->minor, count);
| ^~~
MODPOST /home/dmx/dmx_usb_module/Module.symvers
CC [M] /home/dmx/dmx_usb_module/dmx_usb.mod.o
LD [M] /home/dmx/dmx_usb_module/dmx_usb.ko
BTF [M] /home/dmx/dmx_usb_module/dmx_usb.ko
Skipping BTF generation for /home/dmx/dmx_usb_module/dmx_usb.ko due to unavailability of vmlinux
make[1]: Leaving directory '/usr/src/linux-headers-5.15.0-46-generic'
gcc -O2 -pipe -Wall dmx_usb_test.c -o dmx_usb_test
I had to apply https://github.com/openwrt/packages/blob/master/libs/dmx_usb_module/patches/002-fix-build-4.14.patch to get it to build. Yet dmx_usb_test
fails and causes a kernel stack dump.
The driver loads and probes the devices successfully, everything looks normal:
[ 1.686732] usb 2-1.1: new full-speed USB device number 3 using ehci-pci
[ 1.790360] usb 2-1.1: New USB device found, idVendor=0403, idProduct=6001, bcdDevice= 6.00
[ 1.790367] usb 2-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1.790372] usb 2-1.1: Product: DMX USB PRO
[ 1.790376] usb 2-1.1: Manufacturer: ENTTEC
[ 1.790381] usb 2-1.1: SerialNumber: EN172833
...
[ 2.554415] /usr/src/dmx_usb_module-20130818/dmx_usb.c: DMX USB device now attached to dmx0
[ 2.554415] /usr/src/dmx_usb_module-20130818/dmx_usb.c: DMX USB device now attached to dmx0
[ 2.554457] usbcore: registered new interface driver dmx_usb
[ 2.554458] /usr/src/dmx_usb_module-20130818/dmx_usb.c: DMX USB Driver v0.1.20130818
Running dmx_usb_test
fails:
./dmx_usb_test
write: Bad address
and causes this:
[ 38.470537] ------------[ cut here ]------------
[ 38.470540] transfer buffer not dma capable
[ 38.470691] WARNING: CPU: 0 PID: 1047 at drivers/usb/core/hcd.c:1586 usb_hcd_map_urb_for_dma+0x413/0x570 [usbcore]
[ 38.470693] Modules linked in: rfcomm fuse bnep sunrpc dm_crypt algif_skcipher af_alg joydev mousedev i915 intel_powerclamp coretemp arc4 kvm_intel dell_wmi snd_hda_codec_hdmi wmi_bmof sparse_keymap kvm gpio_ich iTCO_wdt iwldvm iTCO_vendor_support dell_rbtn snd_hda_codec_idt nls_iso8859_1 snd_hda_codec_generic nls_cp437 ppdev vfat mac80211 fat snd_hda_intel dell_laptop snd_hda_codec irqbypass dell_smbios i2c_algo_bit iwlwifi dm_mod crct10dif_pclmul dell_wmi_descriptor crc32_pclmul drm_kms_helper dcdbas uvcvideo ghash_clmulni_intel videobuf2_vmalloc snd_hda_core pcbc dell_smm_hwmon videobuf2_memops videobuf2_v4l2 snd_hwdep aesni_intel btusb btrtl btbcm videobuf2_common aes_x86_64 crypto_simd btintel cryptd glue_helper intel_cstate intel_uncore drm cfg80211 bluetooth psmouse input_leds snd_pcm pcspkr
[ 38.470770] videodev snd_timer dmx_usb(O) media snd e1000e intel_agp ecdh_generic intel_gtt intel_ips soundcore lpc_ich agpgart rfkill syscopyarea tpm_tis sysfillrect sysimgblt fb_sys_fops i2c_i801 wmi tpm_tis_core tpm rtc_cmos parport_pc rng_core parport dell_smo8800 evdev mac_hid pcc_cpufreq battery ac acpi_cpufreq sg vhba(O) crypto_user binder_linux(O) ashmem_linux(O) ip_tables x_tables ext4 crc32c_generic crc16 mbcache jbd2 fscrypto sr_mod cdrom sd_mod serio_raw atkbd libps2 ahci sdhci_pci cqhci libahci sdhci crc32c_intel led_class ehci_pci libata ehci_hcd scsi_mod mmc_core usbcore usb_common i8042 serio
[ 38.470847] CPU: 0 PID: 1047 Comm: dmx_usb_test Tainted: G O 4.18.1-arch1-1-ARCH #1
[ 38.470849] Hardware name: Dell Inc. Latitude E4310/0D8H24, BIOS A15 05/12/2017
[ 38.470865] RIP: 0010:usb_hcd_map_urb_for_dma+0x413/0x570 [usbcore]
[ 38.470866] Code: 39 c9 73 30 80 3d 8d c6 02 00 00 41 bd f5 ff ff ff 0f 85 57 ff ff ff 48 c7 c7 88 1e 26 c0 c6 05 73 c6 02 00 01 e8 f7 42 63 d6 <0f> 0b 8b 53 64 e9 3a ff ff ff 65 48 8b 0c 25 00 5c 01 00 48 8b 49
[ 38.470926] RSP: 0018:ffffa45903407cc8 EFLAGS: 00010282
[ 38.470930] RAX: 0000000000000000 RBX: ffffa085a9fbc180 RCX: 0000000000000001
[ 38.470932] RDX: 0000000080000001 RSI: ffffffff97681166 RDI: 00000000ffffffff
[ 38.470934] RBP: ffffa085d3189000 R08: 0000000000000001 R09: 000000000000036b
[ 38.470936] R10: 0000000000000004 R11: 0000000000000000 R12: 0000000000600000
[ 38.470938] R13: 00000000fffffff5 R14: 00007ffcc18ff4e0 R15: 0000000000000000
[ 38.470942] FS: 00007fa041039500(0000) GS:ffffa085dfc00000(0000) knlGS:0000000000000000
[ 38.470944] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 38.470946] CR2: 000055ddc0999004 CR3: 00000001f8dae006 CR4: 00000000000206f0
[ 38.470948] Call Trace:
[ 38.470969] usb_hcd_submit_urb+0x38d/0xb30 [usbcore]
[ 38.470977] ? path_openat+0x400/0x14b0
[ 38.470982] ? __do_page_fault+0x237/0x570
[ 38.470999] usb_start_wait_urb+0x65/0x160 [usbcore]
[ 38.471007] dmx_usb_write+0x115/0x1e0 [dmx_usb]
[ 38.471016] __vfs_write+0x36/0x190
[ 38.471022] ? __audit_syscall_entry+0xd7/0x160
[ 38.471028] ? syscall_slow_exit_work+0x19b/0x1b0
[ 38.471033] vfs_write+0xa9/0x190
[ 38.471037] ksys_write+0x4f/0xb0
[ 38.471042] do_syscall_64+0x5b/0x170
[ 38.471050] entry_SYSCALL_64_after_hwframe+0x44/0xa9
[ 38.471054] RIP: 0033:0x7fa040f607a8
[ 38.471055] Code: 89 02 48 c7 c0 ff ff ff ff eb b3 0f 1f 80 00 00 00 00 f3 0f 1e fa 48 8d 05 95 6d 0d 00 8b 00 85 c0 75 17 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 58 c3 0f 1f 80 00 00 00 00 41 54 49 89 d4 55
[ 38.471115] RSP: 002b:00007ffcc18ff4d8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
[ 38.471118] RAX: ffffffffffffffda RBX: 00007ffcc18ff4e0 RCX: 00007fa040f607a8
[ 38.471120] RDX: 0000000000000201 RSI: 00007ffcc18ff4e0 RDI: 0000000000000003
[ 38.471123] RBP: 0000000000000003 R08: 00007fa041033be0 R09: 00007fa041033be0
[ 38.471124] R10: 0000000000000000 R11: 0000000000000246 R12: 000055ddc0998110
[ 38.471126] R13: 00007ffcc18ff7e0 R14: 0000000000000000 R15: 0000000000000000
[ 38.471131] ---[ end trace 43b3ea1ef0fbbf06 ]---
Any ideas? @NeoRaider @FriedZombie
Hi,
When I tried to build dmx_usb_module for Linux Kernel 6.6.18, I got following error.
Could you help?
Thanks,
CC [M] /home/cm/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_filogic/dmx_usb_module-19.12.1/dmx_usb.o
/home/cm/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_filogic/dmx_usb_module-19.12.1/dmx_usb.c:100:47: error: macro "DEFINE_SEMAPHORE" requires 2 arguments, but only 1 given
100 | static DEFINE_SEMAPHORE(disconnect_sem);
| ^
In file included from ./include/linux/fs.h:25,
from ./arch/arm64/include/asm/elf.h:141,
from ./include/linux/elf.h:6,
from ./include/linux/module.h:19,
from /home/cm/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_filogic/dmx_usb_module-19.12.1/dmx_usb.c:20:
./include/linux/semaphore.h:34: note: macro "DEFINE_SEMAPHORE" defined here
34 | #define DEFINE_SEMAPHORE(_name, _n) \
|
/home/cm/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_filogic/dmx_usb_module-19.12.1/dmx_usb.c:100:16: error: type defaults to 'int' in declaration of 'DEFINE_SEMAPHORE' [-Werror=implicit-int]
100 | static DEFINE_SEMAPHORE(disconnect_sem);
| ^~~~~~~~~~~~~~~~
/home/cm/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_filogic/dmx_usb_module-19.12.1/dmx_usb.c: In function 'dmx_usb_open':
/home/cm/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_filogic/dmx_usb_module-19.12.1/dmx_usb.c:277:16: error: 'disconnect_sem' undeclared (first use in this function)
277 | down (&disconnect_sem);
| ^~~~~~~~~~~~~~
/home/cm/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_filogic/dmx_usb_module-19.12.1/dmx_usb.c:277:16: note: each undeclared identifier is reported only once for each function it appears in
/home/cm/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_filogic/dmx_usb_module-19.12.1/dmx_usb.c: In function 'dmx_usb_disconnect':
/home/cm/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_filogic/dmx_usb_module-19.12.1/dmx_usb.c:677:16: error: 'disconnect_sem' undeclared (first use in this function)
677 | down (&disconnect_sem);
| ^~~~~~~~~~~~~~
/home/cm/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_filogic/dmx_usb_module-19.12.1/dmx_usb.c: At top level:
/home/cm/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_filogic/dmx_usb_module-19.12.1/dmx_usb.c:100:16: error: 'DEFINE_SEMAPHORE' defined but not used [-Werror=unused-variable]
100 | static DEFINE_SEMAPHORE(disconnect_sem);
| ^~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[7]: *** [scripts/Makefile.build:243: /home/cm/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_filogic/dmx_usb_module-19.12.1/dmx_usb.o] Error 1
make[6]: *** [/home/cm/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_filogic/linux-6.6.18/Makefile:1913: /home/cm/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_filogic/dmx_usb_module-19.12.1] Error 2
make[5]: *** [Makefile:234: __sub-make] Error 2
make[5]: Leaving directory '/home/cm/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_filogic/linux-6.6.18'
make[4]: *** [Makefile:15: default] Error 2
make[4]: Leaving directory '/home/cm/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_filogic/dmx_usb_module-19.12.1'
make[3]: *** [Makefile:58: /home/cm/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_filogic/dmx_usb_module-19.12.1/.built] Error 2
make[3]: Leaving directory '/home/cm/openwrt/feeds/packages/libs/dmx_usb_module'
time: package/feeds/packages/dmx_usb_module/compile#0.74#0.14#0.86
ERROR: package/feeds/packages/dmx_usb_module failed to build.
Hi,
I have this system installed on my RPi4B:
Linux rpi 6.1.0-rpi4-rpi-v8 #1 SMP PREEMPT Debian 1:6.1.54-1+rpt2 (2023-10-05) aarch64 GNU/Linux
I need to control LED light connected with Enttec's Open DMX USB device.
I'm able to compile the module after installing kernel headers:
sudo apt install raspberrypi-kernel-headers
But when I install the compiled module using:
sudo insmod dmx_usb.ko
I don't have /dev/dmx0
as is expected in the dmx_usb_test
.
This is what I see, when I connect the device to my RPi:
oldes@rpi:~/git/dmx_usb_module $ ls -la /dev/serial/by-id
total 0
drwxr-xr-x 2 root root 60 Nov 10 07:17 .
drwxr-xr-x 4 root root 80 Nov 10 07:17 ..
lrwxrwxrwx 1 root root 13 Nov 10 07:17 usb-FTDI_FT232R_USB_UART_A10NH808-if00-port0 -> ../../ttyUSB0
Any idea, how to make the module working on my setup?
Newer kernels need the following patch:
index 1e4071e..e79db0c 100644
--- a/dmx_usb.c
+++ b/dmx_usb.c
@@ -23,6 +23,7 @@
#include <asm/uaccess.h>
#include <linux/usb.h>
#include <linux/version.h>
+#include <linux/uaccess.h>
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)
#include <linux/semaphore.h>
error on rpi 4, Debian 11.6 when compiling api-source:
`File "usr/bin/rpi-source", line 111
except urllib2.HTTPError, e:
SyntaxError: invalid syntax`
I tried changing 'urllib2' to 'url lib', same error
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.