/drivers/net/usb/hso.c
另一个USB转串口驱动
# Support usbhost autosuspend/remote wakeup
write /sys/bus/usb/devices/usb1/power/level on
write /sys/bus/usb/devices/1-2/power/level on
解决USB remote wakeup的bug。
int mode;
int fd = open( "/dev/mdtvctrl", O_RDWR );
memset(&g_adr, 0, sizeof(g_adr));
if(fd < 0)
{
PDEBUG("failed openning device file for control./n");
return SMSHOSTLIB_ERR_COMM_ERR;
}
if (0 > ioctl(fd, SMSCHAR_GET_DEVICE_MODE, &mode))
{
close(fd);
PDEBUG("SMSCHAR_GET_DEVICE_MODE failed %d/n", errno);
return SMSHOSTLIB_ERR_COMM_ERR;
}
close(fd);
一直在SMSCHAR_GET_DEVICE_MODE这地方出错,后面发现smschar.c中的
struct file_operations smschar_fops = {
.owner = THIS_MODULE,
.read = smschar_read,
.write = smschar_write,
.open = smschar_open,
.release = smschar_release,
.mmap = smschar_mmap,
.poll = smschar_poll,
.ioctl = smschar_ioctl,
};
smschar_open和smschar_ioctl这两个函数根本就没有被执行。。。
查看Makefile:
ifdef CONFIG_SMS_HOSTLIB_SUBSYS
ifneq ($(CONFIG_SMS_HOSTLIB_SUBSYS),n)
SMS_HOSTLIB_SUBSYS := 1
EXTRA_CFLAGS += -DSMS_HOSTLIB_SUBSYS
SMSOBJ += smschar.o
endif
endif
查看Kconfig:
config SMS_HOSTLIB_SUBSYS
bool "Host Library Subsystem support"
default n
---help---
Choose if you would like to have Siano's host library kernel sub-system support.
原来Siano module components ---> [*] Host Library Subsystem support 需要选上。。。
重新编译make modules,加载模块时发现节点被占用,将“int smschar_major = 251;“修改为”int smschar_major = 245;“,再次加载模块,手动创建节点,运行测试程序。
测试程序成功运行,查看log信息,发现spi通信正常,接上天线能够收到信号,但是后面启动服务时出错。。。