用的是V3s 4.13的版本,已经在menuconfig中设置了Kernel debugging,Kernel low-level debugging functions
在usb_disconnect这个函数中加了几句话,如下
void usb_disconnect(struct usb_device **pdev)
{
struct usb_port *port_dev = NULL;
struct usb_device *udev = *pdev;
struct usb_hub *hub = NULL;
int port1 = 1;
printk(KERN_NOTICE, "usb_disconnect begin\n");
/* mark the device as inactive, so any further urb submissions for
* this device (and any of its children) will fail immediately.
* this quiesces everything except pending urbs.
*/
usb_set_device_state(udev, USB_STATE_NOTATTACHED);
dev_info(&udev->dev, "AAUSB disconnect, device number %d\n",
udev->devnum);
_dev_info(&udev->dev, "BBBBUSB disconnect, device number %d\n",
udev->devnum);
printk(KERN_INFO, "---KERN_INFO usb_disconnect begin\n");
printk(KERN_ALERT, "--- KERN_ALERTalert usb_disconnect begin\n");
printk(KERN_WARNING, "---KERN_WARNING usb_disconnect begin\n");
printk(KERN_NOTICE, "---KERN_WARNING usb_disconnect begin\n");
printk(KERN_DEBUG, "---KERN_DEBUG usb_disconnect begin\n");
.....
}
输出结果为:
[ 35.141543] usb 2-1: AAUSB disconnect, device number 3
[ 35.146689] usb 2-1: BBBBUSB disconnect, device number 3
就是说dev_info,_dev_info两个函数可以输出,而printk函数没有输出,这是怎么回事啊?
离线
usb_set_device_state(udev, USB_STATE_NOTATTACHED);
dev_info(&udev->dev, "1AAUSB disconnect, device number %d\n",
udev->devnum);
_dev_info(&udev->dev, "2BBBBUSB disconnect, device number %d\n",
udev->devnum);
printk(KERN_ERR "BBBcan't register hub driver\n"),
printk_emit(0,1,0,0, "KERN_ALERT AAAAAAAAAAAAA");
printk_emit(0,2,0,0, "KERN_INFO AAAAAAAAAAAAA");
printk_emit(0,3,0,0, "KERN_WARNING AAAAAAAAAAAAA");
printk_emit(0,4,0,0, "KERN_NOTICE AAAAAAAAAAAAA");
printk_emit(0,5,0,0, "KERN_DEBUG AAAAAAAAAAAAA");
这几个都可以输出
现在可以了,谁定义的这种语法啊,printk(KERN_ERR "BBBcan't register hub driver\n"), KERN_ERR后面没逗号
离线
确保100%输出,只能KERN_ERR无疑
离线