tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

7.1 panic by playing with USB



Hello

I am experimenting with a NFC USB device, detected like this:
ugen0 at uhub0 port 1
ugen0: SCM Micro SCL3711-NFC&RW, rev 2.00/2.07, addr 2

usbdevs(8) says:
addr 1: UHCI root hub, vendor 0x8086
 addr 2: SCL3711-NFC&RW, SCM Micro

It works fine with libnfc, but on NetBSD, the USB device disapear
after first use (that does not happen on e.g. MacOSX):

arefaire# nfc-list             
nfc-list uses libnfc 1.7.1
NFC device: SCM Micro / SCL3711-NFC&RW opened
1 ISO14443A passive target(s) found:
ISO/IEC 14443A (106 kbps) target:
    ATQA (SENS_RES): 03  44  
       UID (NFCID1): 04  40  34  72  5f  2d  80  
      SAK (SEL_RES): 20  
                ATS: 75  77  81  02  80  

arefaire# nfc-list 
nfc-list uses libnfc 1.7.1
No NFC device found.

The device is still there according to usbdevs(8). My understanding is
that it went into a bad state, and I want to reset it. How can I do 
that? The only way I found for now it to unplug/replug it. Even a 
system reboot does not restore it to a working state.

I also made various attempts using libusb, by setting configuration to 
current value which should "act as a lightweight device reset"
according to documentation [1], or with values -1 or 0. I also
tired libusb_reset_device(). Nnne of that change the state of 
the device. However I found a sequence that reliabily crash a
GENERIC NetBSD-7.1/i386 kernel:

libusb_init
libusb_get_device_list
libusb_open
libusb_set_configuration with config = 0
libusb_close
libusb_free_device_list
libusb_exit
sleep for 5 seconds
libusb_init => kernel panic


uvm_fault(0xc2de0c70, 0, 1) -> 0xe
fatal page fault in supervisor mode
trap type 6 code 0 eip c09bf5c2 cs 8 eflags 10246 cr2 3 ilevel 0 esp c3428f04
curlwp 0xc3354000 pid 4765 lid 1 lowest kstack 0xdb20c2c0
panic: trap
cpu0: Begin traceback...
vpanic(c0dcea3f,db20dbc8,db20dc44,c096fcba,c0dcea3f,db20dc50,db20dc50,1,db20c2c0
,10246) at netbsd:vpanic+0x121
snprintf(c0dcea3f,db20dc50,db20dc50,1,db20c2c0,10246,3,0,c3428f04,c333736c) at n
etbsd:snprintf
trap_tss() at netbsd:trap_tss

On reboot, the kernel ackowledges the issue:
uhub0: port 1, set config at addr 2 failed
uhub0: device problem, disabling port 1

Do we have a way to really hard reset a USB device, like powering off and
onn the port, for instance?

{1] http://libusb.sourceforge.net/api-1.0/group__dev.html#ga186593ecae576dad6cd9679f45a2aa43

-- 
Emmanuel Dreyfus
manu%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index