你好,我在kernel4.4上運行這個ch9344.ko時(1.16版本,makefile沒有修改),提示:
insmod: can't insert '/system/lib/modules/ch934x.ko': invalid module format
同樣的編譯器編譯其他的驅(qū)動,就沒問題,急,求幫助
謝謝
你好,我在kernel4.4上運行這個ch9344.ko時(1.16版本,makefile沒有修改),提示:
insmod: can't insert '/system/lib/modules/ch934x.ko': invalid module format
同樣的編譯器編譯其他的驅(qū)動,就沒問題,急,求幫助
謝謝
如果修改makefile
把KERNELDIR := /lib/modules/$(shell uname -r)/build
改成:KERNELDIR ?=$(KERNEL_DIR)
則編譯報錯:
build driver module: ch9344
rm -rf *.mk .tmp_versions Module.symvers *.mod.c *.o *.ko .*.cmd Module.markers modules.order
make -C /home/vm/rk/project/firefly-sdk/rk3328_drv/../kernel? M=/home/vm/rk/project/firefly-sdk/rk3328_drv/ch9344??
make[1]: Entering directory '/home/vm/rk/project/firefly-sdk/kernel'
? LD? ? ? /home/vm/rk/project/firefly-sdk/rk3328_drv/ch9344/built-in.o
? CC [M]? /home/vm/rk/project/firefly-sdk/rk3328_drv/ch9344/ch934x.o
/home/vm/rk/project/firefly-sdk/rk3328_drv/ch9344/ch934x.c: In function 'ch934x_tty_ioctl':
/home/vm/rk/project/firefly-sdk/rk3328_drv/ch9344/ch934x.c:1395:16: warning: unused variable 'flags' [-Wunused-variable]
error, forbidden warning:ch934x.c:1395
? unsigned long flags;
? ? ? ? ? ? ? ? ^~~~~
At top level:
/home/vm/rk/project/firefly-sdk/rk3328_drv/ch9344/ch934x.c:2202:12: warning: 'ch934x_reset_resume' defined but not used [-Wunused-function]
error, forbidden warning:ch934x.c:2202
?static int ch934x_reset_resume(struct usb_interface *intf)
? ? ? ? ? ? ^~~~~~~~~~~~~~~~~~~
/home/vm/rk/project/firefly-sdk/rk3328_drv/ch9344/ch934x.c:2142:12: warning: 'ch934x_suspend' defined but not used [-Wunused-function]
error, forbidden warning:ch934x.c:2142
?static int ch934x_suspend(struct usb_interface *intf, pm_message_t message)
? ? ? ? ? ? ^~~~~~~~~~~~~~
/home/vm/rk/project/firefly-sdk/rk3328_drv/ch9344/ch934x.c:1158:13: warning: 'ch934x_tty_unthrottle' defined but not used [-Wunused-function]
error, forbidden warning:ch934x.c:1158
?static void ch934x_tty_unthrottle(struct tty_struct *tty)
? ? ? ? ? ? ?^~~~~~~~~~~~~~~~~~~~~
/home/vm/rk/project/firefly-sdk/rk3328_drv/ch9344/ch934x.c:1148:13: warning: 'ch934x_tty_throttle' defined but not used [-Wunused-function]
error, forbidden warning:ch934x.c:1148
?static void ch934x_tty_throttle(struct tty_struct *tty)
? ? ? ? ? ? ?^~~~~~~~~~~~~~~~~~~
/home/vm/rk/project/firefly-sdk/rk3328_drv/ch9344/ch934x.c:219:12: warning: 'ch934x_cmd_in' defined but not used [-Wunused-function]
error, forbidden warning:ch934x.c:219
?static int ch934x_cmd_in(struct ch934x *ch934x,
? ? ? ? ? ? ^~~~~~~~~~~~~
/home/vm/rk/project/firefly-sdk/rk3328_drv/ch9344/ch934x.c:154:12: warning: 'ch934x_control_out' defined but not used [-Wunused-function]
error, forbidden warning:ch934x.c:154
?static int ch934x_control_out(struct ch934x *ch934x, u8 request,
? ? ? ? ? ? ^~~~~~~~~~~~~~~~~~
scripts/Makefile.build:283: recipe for target '/home/vm/rk/project/firefly-sdk/rk3328_drv/ch9344/ch934x.o' failed
make[2]: *** [/home/vm/rk/project/firefly-sdk/rk3328_drv/ch9344/ch934x.o] Error 1
Makefile:1479: recipe for target '_module_/home/vm/rk/project/firefly-sdk/rk3328_drv/ch9344' failed
make[1]: *** [_module_/home/vm/rk/project/firefly-sdk/rk3328_drv/ch9344] Error 2
make[1]: Leaving directory '/home/vm/rk/project/firefly-sdk/kernel'
Makefile:5: recipe for target 'default' failed
make: *** [default] Error 2
您好,建議先明確下編譯其他驅(qū)動所引用的Kernel Src是否和CH9344引用的相同。常規(guī)情況若一樣不會提示格式不兼容,也可以使用file或module相關(guān)命令檢查下ko文件兼容性。另,不排除你的系統(tǒng)存在多個版本的kernel-headers。
這個是另一個驅(qū)動的makefile
ifneq ($(KERNELRELEASE), )
obj-m := common.o?
else
KERNELDIR ?=$(KERNEL_DIR)
PWD? ? ? ?:= $(shell pwd)
default:
$(MAKE) -C $(KERNEL_DIR) M=$(PWD) modules
endif
clean:
rm -rf *.d *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions modules.order Module.symvers
depend .depend dep:
$(CC) $(CFLAGS) -M *.c > .depend
ifeq (.depend,$(wildcard .depend))
include .depend
endif
感覺還是ch934x的makefile導(dǎo)致的問題,但是我如果改了makefile又編譯出錯,如上38樓
您好,對于默認(rèn)makefile編譯出錯問題,應(yīng)該是編譯驅(qū)動kernel src沒有對應(yīng)到默認(rèn)makefile指定的路徑。改用你第二種方式理論上可行,出錯是因為你系統(tǒng)默認(rèn)makefile規(guī)則要求,強制將warning當(dāng)成錯誤??蓢L試:
1、修改kernel src的makefile,取消將警告當(dāng)作錯誤的問題;
2、修改ch934x.c其中的warning的未使用函數(shù)進(jìn)行注釋,重新編譯;
你好,編譯出錯的問題,我已經(jīng)改好了,把未使用的函數(shù)注釋了就好,但是加載驅(qū)動的時候,沒有提示錯誤,/dev/目錄下也沒有生成對應(yīng)的設(shè)備節(jié)點,這個是為什么?
以下是加載驅(qū)動的log:
?insmod /system/lib/modules/ch934x.ko?
usbcore: registered new interface driver usb_wch
ch934x: USB driver for USB to serial chip ch9344.
ch934x: V1.16 On 2020.12.05
如上問題,是由于系統(tǒng)未能正常識別到CH9344設(shè)備導(dǎo)致。關(guān)于驅(qū)動加載成功但節(jié)點未產(chǎn)生時,建議先通過“l(fā)susb”或"dmesg"命令查看usb設(shè)備的識別和工作情況。
您好,上述的問題現(xiàn)在都解決了,現(xiàn)在想把9344串口信號轉(zhuǎn)成485信號,這個是否支持呢,我在使用gpio時,發(fā)現(xiàn)不能控制,一直是低電平
tty device test ok.
press s to set modem, z to clear modem, g to get modem, b to send break, w to write, r to read, G to test gpio, q for quit.
G
press e to enable gpio, d to disable gpio, press o to set gpio output, i on input, d to disable gpio, h to output high, l on low, g to get gpio, q for quit.
e
press e to enable gpio, d to disable gpio, press o to set gpio output, i on input, d to disable gpio, h to output high, l on low, g to get gpio, q for quit.
o
press e to enable gpio, d to disable gpio, press o to set gpio output, i on input, d to disable gpio, h to output high, l on low, g to get gpio, q for quit.
h
press e to enable gpio, d to disable gpio, press o to set gpio output, i on input, d to disable gpio, h to output high, l on low, g to get gpio, q for quit.
以上操作無效果
比較著急,請問有了解gpio使用方式的嗎
您好,如上驅(qū)動和應(yīng)用是支持芯片GPIO操作的,且CH9344芯片的RS485控制信號串口發(fā)送時自動控制無需通過軟件開啟。若測試遇到無法正常進(jìn)行,先通過系統(tǒng)命令lsusb或sysfs查看當(dāng)前ch9344的usb revision版本號(v36.00及以上可支持),有疑問可按照下方聯(lián)系方式與我溝通。
你好,謝謝回復(fù)
我這邊用的是嵌入式linux,lsusb只能看到這些信息,
[root@rk3328:/]# lsusb
Bus 004 Device 002: ID 1a86:e018
Bus 001 Device 001: ID 1d6b:0002
Bus 002 Device 001: ID 1d6b:0002
Bus 003 Device 001: ID 1d6b:0001
Bus 004 Device 001: ID 1d6b:0002
Bus 005 Device 001: ID 1d6b:0003
我需要如何確定9344的內(nèi)部版本呢
usb設(shè)備插入后輸入dmesg信息 ,查看usb枚舉的詳細(xì)信息即可。
你好,我掃了一遍沒找到相關(guān)信息哦,9344已經(jīng)加載進(jìn)來了
uevent path:/sys/bus/usb/devices/./uevent?
uevent path:/sys/bus/usb/devices/../uevent?
uevent path:/sys/bus/usb/devices/4-1/uevent?
line: MAJOR=189
, prefix: PRODUCT=.
line: MINOR=385
, prefix: PRODUCT=.
line: DEVNAME=bus/usb/004/002
, prefix: PRODUCT=.
line: DEVTYPE=usb_device
, prefix: PRODUCT=.
line: DRIVER=usb
, prefix: PRODUCT=.
line: PRODUCT=1a86/e018/3500
, prefix: PRODUCT=.
pid:vid : 1a86:e018?
line: TYPE=255/128/55
, prefix: PRODUCT=.
line: BUSNUM=004
, prefix: PRODUCT=.
line: DEVNUM=002
, prefix: PRODUCT=.
uevent path:/sys/bus/usb/devices/usb1/uevent?
line: MAJOR=189
, prefix: PRODUCT=.
line: MINOR=0
, prefix: PRODUCT=.
line: DEVNAME=bus/usb/001/001
, prefix: PRODUCT=.
line: DEVTYPE=usb_device
, prefix: PRODUCT=.
line: DRIVER=usb
, prefix: PRODUCT=.
line: PRODUCT=1d6b/2/404
, prefix: PRODUCT=.
pid:vid : 1d6b:0002?
line: TYPE=9/0/1
, prefix: PRODUCT=.
line: BUSNUM=001
, prefix: PRODUCT=.
line: DEVNUM=001
, prefix: PRODUCT=.
uevent path:/sys/bus/usb/devices/usb2/uevent?
line: MAJOR=189
, prefix: PRODUCT=.
line: MINOR=128
, prefix: PRODUCT=.
line: DEVNAME=bus/usb/002/001
, prefix: PRODUCT=.
line: DEVTYPE=usb_device
, prefix: PRODUCT=.
line: DRIVER=usb
, prefix: PRODUCT=.
line: PRODUCT=1d6b/2/404
, prefix: PRODUCT=.
pid:vid : 1d6b:0002?
line: TYPE=9/0/0
, prefix: PRODUCT=.
line: BUSNUM=002
, prefix: PRODUCT=.
line: DEVNUM=001
, prefix: PRODUCT=.
uevent path:/sys/bus/usb/devices/usb3/uevent?
line: MAJOR=189
, prefix: PRODUCT=.
line: MINOR=256
, prefix: PRODUCT=.
line: DEVNAME=bus/usb/003/001
, prefix: PRODUCT=.
line: DEVTYPE=usb_device
, prefix: PRODUCT=.
line: DRIVER=usb
, prefix: PRODUCT=.
line: PRODUCT=1d6b/1/404
, prefix: PRODUCT=.
pid:vid : 1d6b:0001?
line: TYPE=9/0/0
, prefix: PRODUCT=.
line: BUSNUM=003
, prefix: PRODUCT=.
line: DEVNUM=001
, prefix: PRODUCT=.
uevent path:/sys/bus/usb/devices/usb4/uevent?
line: MAJOR=189
, prefix: PRODUCT=.
line: MINOR=384
, prefix: PRODUCT=.
line: DEVNAME=bus/usb/004/001
, prefix: PRODUCT=.
line: DEVTYPE=usb_device
, prefix: PRODUCT=.
line: DRIVER=usb
, prefix: PRODUCT=.
line: PRODUCT=1d6b/2/404
, prefix: PRODUCT=.
pid:vid : 1d6b:0002?
line: TYPE=9/0/1
, prefix: PRODUCT=.
line: BUSNUM=004
, prefix: PRODUCT=.
line: DEVNUM=001
, prefix: PRODUCT=.
uevent path:/sys/bus/usb/devices/usb5/uevent?
line: MAJOR=189
, prefix: PRODUCT=.
line: MINOR=512
, prefix: PRODUCT=.
line: DEVNAME=bus/usb/005/001
, prefix: PRODUCT=.
line: DEVTYPE=usb_device
, prefix: PRODUCT=.
line: DRIVER=usb
, prefix: PRODUCT=.
line: PRODUCT=1d6b/3/404
, prefix: PRODUCT=.
pid:vid : 1d6b:0003?
line: TYPE=9/0/3
, prefix: PRODUCT=.
line: BUSNUM=005
, prefix: PRODUCT=.
line: DEVNUM=001
, prefix: PRODUCT=.
uevent path:/sys/bus/usb/devices/3-0:1.0/uevent?
line: DEVTYPE=usb_interface
, prefix: PRODUCT=.
line: DRIVER=hub
, prefix: PRODUCT=.
line: PRODUCT=1d6b/1/404
, prefix: PRODUCT=.
pid:vid : 1d6b:0001?
line: TYPE=9/0/0
, prefix: PRODUCT=.
line: INTERFACE=9/0/0
, prefix: PRODUCT=.
line: MODALIAS=usb:v1D6Bp0001d0404dc09dsc00dp00ic09isc00ip00in00
, prefix: PRODUCT=.
uevent path:/sys/bus/usb/devices/4-0:1.0/uevent?
line: DEVTYPE=usb_interface
, prefix: PRODUCT=.
line: DRIVER=hub
, prefix: PRODUCT=.
line: PRODUCT=1d6b/2/404
, prefix: PRODUCT=.
pid:vid : 1d6b:0002?
line: TYPE=9/0/1
, prefix: PRODUCT=.
line: INTERFACE=9/0/0
, prefix: PRODUCT=.
line: MODALIAS=usb:v1D6Bp0002d0404dc09dsc00dp01ic09isc00ip00in00
, prefix: PRODUCT=.
uevent path:/sys/bus/usb/devices/4-1:1.0/uevent?
line: DEVTYPE=usb_interface
, prefix: PRODUCT=.
line: PRODUCT=1a86/e018/3500
, prefix: PRODUCT=.
pid:vid : 1a86:e018?
line: TYPE=255/128/55
, prefix: PRODUCT=.
line: INTERFACE=255/128/55
, prefix: PRODUCT=.
line: MODALIAS=usb:v1A86pE018d3500dcFFdsc80dp37icFFisc80ip37in00
, prefix: PRODUCT=.
uevent path:/sys/bus/usb/devices/5-0:1.0/uevent?
line: DEVTYPE=usb_interface
, prefix: PRODUCT=.
line: DRIVER=hub
, prefix: PRODUCT=.
line: PRODUCT=1d6b/3/404
, prefix: PRODUCT=.
pid:vid : 1d6b:0003?
line: TYPE=9/0/3
, prefix: PRODUCT=.
line: INTERFACE=9/0/0
, prefix: PRODUCT=.
line: MODALIAS=usb:v1D6Bp0003d0404dc09dsc00dp03ic09isc00ip00in00
, prefix: PRODUCT=.
uevent path:/sys/bus/usb/devices/1-0:1.0/uevent?
line: DEVTYPE=usb_interface
, prefix: PRODUCT=.
line: DRIVER=hub
, prefix: PRODUCT=.
line: PRODUCT=1d6b/2/404
, prefix: PRODUCT=.
pid:vid : 1d6b:0002?
line: TYPE=9/0/1
, prefix: PRODUCT=.
line: INTERFACE=9/0/0
, prefix: PRODUCT=.
line: MODALIAS=usb:v1D6Bp0002d0404dc09dsc00dp01ic09isc00ip00in00
, prefix: PRODUCT=.
uevent path:/sys/bus/usb/devices/2-0:1.0/uevent?
line: DEVTYPE=usb_interface
, prefix: PRODUCT=.
line: DRIVER=hub
, prefix: PRODUCT=.
line: PRODUCT=1d6b/2/404
, prefix: PRODUCT=.
pid:vid : 1d6b:0002?
line: TYPE=9/0/0
, prefix: PRODUCT=.
line: INTERFACE=9/0/0
, prefix: PRODUCT=.
line: MODALIAS=usb:v1D6Bp0002d0404dc09dsc00dp00ic09isc00ip00in00
, prefix: PRODUCT=.