我使用的是 Ubuntu 15.10,它无法检测到我的 SD 卡插入。我尝试了多种解决方案,这些解决方案似乎是解决此类问题的常见答案,但都没有成功。
我看见这次讨论这表明 Realtek 有一个适用于类似设备的驱动程序,并且一些小技巧通常可以解决我的特定设备的问题。
按照这些步骤运行后make
,我收到以下错误:
cp -f ./define.release ./define.h
make -C /lib/modules/4.2.0-34-generic/build/ SUBDIRS=/home/anti/Software/rts5227 modules
make[1]: Entering directory '/usr/src/linux-headers-4.2.0-34-generic'
CC [M] /home/anti/Software/rts5227/rtsx.o
/home/anti/Software/rts5227/rtsx.c: In function ‘proc_info’:
/home/anti/Software/rts5227/rtsx.c:148:55: error: macro "__DATE__" might prevent reproducible builds [-Werror=date-time]
SPRINTF(" Build: %s, %s\n", __DATE__, __TIME__);
^
/home/anti/Software/rts5227/rtsx.c:148:55: error: macro "__TIME__" might prevent reproducible builds [-Werror=date-time]
In file included from include/linux/printk.h:6:0,
from include/linux/kernel.h:13,
from include/linux/sched.h:17,
from include/linux/blkdev.h:4,
from /home/anti/Software/rts5227/rtsx.c:23:
/home/anti/Software/rts5227/rtsx.c: In function ‘rtsx_control_thread’:
include/linux/kern_levels.h:4:18: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘u64 {aka long long unsigned int}’ [-Wformat=]
#define KERN_SOH "\001" /* ASCII Start Of Header */
^
include/linux/kern_levels.h:10:18: note: in expansion of macro ‘KERN_SOH’
#define KERN_ERR KERN_SOH "3" /* error conditions */
^
/home/anti/Software/rts5227/rtsx.c:521:11: note: in expansion of macro ‘KERN_ERR’
printk(KERN_ERR "Bad target number (%d:%d)\n",
^
include/linux/kern_levels.h:4:18: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘u64 {aka long long unsigned int}’ [-Wformat=]
#define KERN_SOH "\001" /* ASCII Start Of Header */
^
include/linux/kern_levels.h:10:18: note: in expansion of macro ‘KERN_SOH’
#define KERN_ERR KERN_SOH "3" /* error conditions */
^
/home/anti/Software/rts5227/rtsx.c:527:11: note: in expansion of macro ‘KERN_ERR’
printk(KERN_ERR "Bad LUN (%d:%d)\n",
^
/home/anti/Software/rts5227/rtsx.c: In function ‘rtsx_probe’:
/home/anti/Software/rts5227/rtsx.c:921:39: error: macro "__DATE__" might prevent reproducible builds [-Werror=date-time]
printk(KERN_INFO "--- %s, %s ---\n", __DATE__, __TIME__);
^
/home/anti/Software/rts5227/rtsx.c:921:49: error: macro "__TIME__" might prevent reproducible builds [-Werror=date-time]
printk(KERN_INFO "--- %s, %s ---\n", __DATE__, __TIME__);
^
/home/anti/Software/rts5227/rtsx.c: At top level:
/home/anti/Software/rts5227/rtsx.c:132:12: warning: ‘proc_info’ defined but not used [-Wunused-function]
static int proc_info (struct Scsi_Host *host, char *buffer,
^
cc1: some warnings being treated as errors
scripts/Makefile.build:258: recipe for target '/home/anti/Software/rts5227/rtsx.o' failed
make[2]: *** [/home/anti/Software/rts5227/rtsx.o] Error 1
Makefile:1398: recipe for target '_module_/home/anti/Software/rts5227' failed
make[1]: *** [_module_/home/anti/Software/rts5227] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-4.2.0-34-generic'
Makefile:35: recipe for target 'default' failed
make: *** [default] Error 2
有什么方法可以解决这个问题并使用该驱动程序来使用我的阅读器?
我的内核版本是4.2.0-34-generic
。
这是输出lspci -v | grep Reader
02:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. RTS5227 PCI Express Card Reader (rev 01)
我将提供解决问题可能需要的任何其他输出。
提前致谢!
答案1
好的,我明白了。
造成问题的是vmalloc()
驱动程序源的各个文件中对该函数的隐式声明。
我添加了#include <linux/vmalloc.h>
相关文件,分别是rtsx.c
、rtsx_chip.c
和rtsx_scsi.c
。ms.c
运行 make 时我仍然收到很多警告和注释,但能够编译并安装驱动程序,并且 SD 卡现在可以工作了!