[Android Software/Hacking General [Developers Only]] qexing:
Hi Guys:

I'm using Lenovo K800 now, it use the same Medfield platform like Moto Razr i,

It supports USB OTG, but doesn't support usb-storage for external usb disk

Lenovo doesn't provide K800's kernel source,

so I compiled some USB related kernel modules from Moto Razr i 3.0.8 kernel source

these are what I get:

scsi_mod.ko

sd_mod.ko

usb-storage.ko

1.

I can load these modules in Lenovo K800, I connect my external usb disk (high speed)

to Lenovo K800 through a high speed USB hub (with power supply), usb disk can be recognized

if I run "dd" command to test reading usb disk, it will fail after reading for various seconds,

in these seconds data can be readed, then "I/O error" occurs, then USB disk reset

2.

If I connect external usb disk (high speed) to K800 through a full speed USB hub (also with power supply),

so usb disk will work in full speed mode, speed is quiet slow, but I can read through the whole usb disk

without any error

3.

If I connect a full speed external usb disk to K800 through a high speed USB hub,

I still get "I/O error" message like situation 1

the dmesg output like this:

---------------------------------------------------------------------------------------------------------------

<6>[ 303.190553] usb 1-1: new high speed USB device number 2 using penwell_otg

<6>[ 303.343537] hub 1-1:1.0: USB hub found

<6>[ 303.343937] hub 1-1:1.0: 4 ports detected

<4>[ 303.390899] penwell_otg 0000:00:02.3: ERR in HNP polling = -32, stop HNP polling

<6>[ 307.493811] usb_otg_suspend OTG HNP update suspend

<4>[ 317.369781] intel_scu_watchdog: Expected SW WDT warning irq received

<4>[ 317.369833] intel_scu_watchdog: interrupt tasklet body start

<3>[ 317.369979] intel_scu_watchdog: watchdog_keepalive

<6>[ 363.119997] intel_mdf_battery msic_battery: vbus_volt:5323

<6>[ 363.121088] intel_mdf_battery msic_battery: vbatt:3880000 temp:200

<7>[ 363.125085] max17042_get_property: VFSOC=61

<7>[ 363.125110] max17042_get_property: SOC= 62

<7>[ 363.126709] max17042_get_property: VFSOC=61

<7>[ 363.126726] max17042_get_property: SOC= 62

<7>[ 363.136076] max17042_get_property: VFSOC=61

<7>[ 363.136101] max17042_get_property: SOC= 62

<6>[ 423.277567] intel_mdf_battery msic_battery: vbus_volt:5323

<6>[ 423.278665] intel_mdf_battery msic_battery: vbatt:3881875 temp:200

<7>[ 423.281530] max17042_get_property: VFSOC=61

<7>[ 423.281555] max17042_get_property: SOC= 62

<7>[ 423.283265] max17042_get_property: VFSOC=61

<7>[ 423.283282] max17042_get_property: SOC= 62

<7>[ 423.291069] max17042_get_property: VFSOC=61

<7>[ 423.291095] max17042_get_property: SOC= 62

.....

<7>[ 2535.986746] usb-storage: Command READ_10 (10 bytes)

<7>[ 2535.986757] usb-storage: 28 00 00 30 a4 e0 00 00 f0 00

<7>[ 2535.986819] usb-storage: Bulk Command S 0x43425355 T 0x616c L 122880 F 128 Trg 0 LUN 0 CL 10

<7>[ 2535.986834] usb-storage: usb_stor_bulk_transfer_buf: xfer 31 bytes

<7>[ 2535.987185] usb-storage: Status code 0; transferred 31/31

<7>[ 2535.987198] usb-storage: -- transfer complete

<7>[ 2535.987209] usb-storage: Bulk command transfer result=0

<7>[ 2535.987224] usb-storage: usb_stor_bulk_transfer_sglist: xfer 122880 bytes, 29 entries

<7>[ 2536.025373] usb-storage: Status code -71; transferred 62976/122880

<7>[ 2536.025387] usb-storage: -- unknown error

<7>[ 2536.025393] usb-storage: Bulk data transfer result 0x4

<7>[ 2536.025397] usb-storage: -- transport indicates error, resetting

<7>[ 2536.025409] usb-storage: usb_stor_pre_reset

<3>[ 2536.057289] hub 1-1:1.0: cannot reset port 4 (err = -71)

<3>[ 2536.089281] hub 1-1:1.0: cannot reset port 4 (err = -71)

<3>[ 2536.126276] hub 1-1:1.0: cannot reset port 4 (err = -71)

<3>[ 2536.163273] hub 1-1:1.0: cannot reset port 4 (err = -71)

<3>[ 2536.200287] hub 1-1:1.0: cannot reset port 4 (err = -71)

<3>[ 2536.205573] hub 1-1:1.0: Cannot enable port 4. Maybe the USB cable is bad?

<3>[ 2536.244297] hub 1-1:1.0: cannot disable port 4 (err = -71)

<3>[ 2536.281293] hub 1-1:1.0: cannot reset port 4 (err = -71)

<3>[ 2536.318302] hub 1-1:1.0: cannot reset port 4 (err = -71)

<3>[ 2536.355284] hub 1-1:1.0: cannot reset port 4 (err = -71)

<3>[ 2536.392280] hub 1-1:1.0: cannot reset port 4 (err = -71)

<3>[ 2536.429277] hub 1-1:1.0: cannot reset port 4 (err = -71)

<3>[ 2536.434557] hub 1-1:1.0: Cannot enable port 4. Maybe the USB cable is bad?

<3>[ 2536.473263] hub 1-1:1.0: cannot disable port 4 (err = -71)

<3>[ 2536.510288] hub 1-1:1.0: cannot reset port 4 (err = -71)

<3>[ 2536.547259] hub 1-1:1.0: cannot reset port 4 (err = -71)

<3>[ 2536.584280] hub 1-1:1.0: cannot reset port 4 (err = -71)

<3>[ 2536.621280] hub 1-1:1.0: cannot reset port 4 (err = -71)

<3>[ 2536.658268] hub 1-1:1.0: cannot reset port 4 (err = -71)

<3>[ 2536.663562] hub 1-1:1.0: Cannot enable port 4. Maybe the USB cable is bad?

<3>[ 2536.702386] hub 1-1:1.0: cannot disable port 4 (err = -71)

<3>[ 2536.739275] hub 1-1:1.0: cannot reset port 4 (err = -71)

<3>[ 2536.776264] hub 1-1:1.0: cannot reset port 4 (err = -71)

<3>[ 2536.813273] hub 1-1:1.0: cannot reset port 4 (err = -71)

<3>[ 2536.850261] hub 1-1:1.0: cannot reset port 4 (err = -71)

<3>[ 2536.887254] hub 1-1:1.0: cannot reset port 4 (err = -71)

<3>[ 2536.892529] hub 1-1:1.0: Cannot enable port 4. Maybe the USB cable is bad?

<3>[ 2536.931288] hub 1-1:1.0: cannot disable port 4 (err = -71)

<3>[ 2536.968258] hub 1-1:1.0: cannot disable port 4 (err = -71)

<7>[ 2536.973734] usb-storage: usb_stor_post_reset

<7>[ 2536.973746] usb-storage: usb_reset_device returns -19

<7>[ 2536.973755] usb-storage: usb_stor_Bulk_reset called

<7>[ 2536.973765] usb-storage: usb_stor_control_msg: rq=ff rqtype=21 value=0000 index=00 len=0

<7>[ 2536.973774] usb-storage: Soft reset failed: -19

<7>[ 2536.973781] usb-storage: scsi cmd done, result=0x70000

<7>[ 2536.973829] usb-storage: queuecommand_lck called

<7>[ 2536.973846] usb-storage: *** thread sleeping.

<7>[ 2536.973853] usb-storage: *** thread awakened.

<7>[ 2536.973863] usb-storage: Command READ_10 (10 bytes)

<7>[ 2536.973867] usb-storage: 28 00 00 30 a4 e0 00 00 f0 00

<7>[ 2536.973892] usb-storage: Bulk Command S 0x43425355 T 0x616d L 122880 F 128 Trg 0 LUN 0 CL 10

<7>[ 2536.973898] usb-storage: usb_stor_bulk_transfer_buf: xfer 31 bytes

<7>[ 2536.973904] usb-storage: Status code -19; transferred 31/31

<7>[ 2536.973908] usb-storage: -- unknown error

<7>[ 2536.973913] usb-storage: Bulk command transfer result=4

<7>[ 2536.973917] usb-storage: -- transport indicates error, resetting

<7>[ 2536.973923] usb-storage: unable to lock device for reset: -19

<7>[ 2536.973928] usb-storage: usb_stor_Bulk_reset called

<7>[ 2536.973935] usb-storage: usb_stor_control_msg: rq=ff rqtype=21 value=0000 index=00 len=0

<7>[ 2536.973940] usb-storage: Soft reset failed: -19

<7>[ 2536.973945] usb-storage: scsi cmd done, result=0x70000

<7>[ 2536.973974] usb-storage: queuecommand_lck called

<7>[ 2536.973985] usb-storage: *** thread sleeping.

<7>[ 2536.973989] usb-storage: *** thread awakened.

<7>[ 2536.973995] usb-storage: Command READ_10 (10 bytes)

<7>[ 2536.973999] usb-storage: 28 00 00 30 a4 e0 00 00 f0 00

<7>[ 2536.974022] usb-storage: Bulk Command S 0x43425355 T 0x616e L 122880 F 128 Trg 0 LUN 0 CL 10

<7>[ 2536.974028] usb-storage: usb_stor_bulk_transfer_buf: xfer 31 bytes

<7>[ 2536.974034] usb-storage: Status code -19; transferred 31/31

<7>[ 2536.974038] usb-storage: -- unknown error

<7>[ 2536.974042] usb-storage: Bulk command transfer result=4

<7>[ 2536.974047] usb-storage: -- transport indicates error, resetting

<7>[ 2536.974052] usb-storage: unable to lock device for reset: -19

<7>[ 2536.974057] usb-storage: usb_stor_Bulk_reset called

<7>[ 2536.974064] usb-storage: usb_stor_control_msg: rq=ff rqtype=21 value=0000 index=00 len=0

<7>[ 2536.974069] usb-storage: Soft reset failed: -19

<7>[ 2536.974074] usb-storage: scsi cmd done, result=0x70000

<7>[ 2536.974097] usb-storage: queuecommand_lck called

<7>[ 2536.974108] usb-storage: *** thread sleeping.

<7>[ 2536.974114] usb-storage: *** thread awakened.

<7>[ 2536.974121] usb-storage: Command READ_10 (10 bytes)

<7>[ 2536.974125] usb-storage: 28 00 00 30 a4 e0 00 00 f0 00

<7>[ 2536.974153] usb-storage: Bulk Command S 0x43425355 T 0x616f L 122880 F 128 Trg 0 LUN 0 CL 10

<7>[ 2536.974160] usb-storage: usb_stor_bulk_transfer_buf: xfer 31 bytes

<7>[ 2536.974167] usb-storage: Status code -19; transferred 31/31

<7>[ 2536.974172] usb-storage: -- unknown error

<7>[ 2536.974177] usb-storage: Bulk command transfer result=4

<7>[ 2536.974182] usb-storage: -- transport indicates error, resetting

<7>[ 2536.974188] usb-storage: unable to lock device for reset: -19

<7>[ 2536.974194] usb-storage: usb_stor_Bulk_reset called

<7>[ 2536.974201] usb-storage: usb_stor_control_msg: rq=ff rqtype=21 value=0000 index=00 len=0

<7>[ 2536.974208] usb-storage: Soft reset failed: -19

<7>[ 2536.974214] usb-storage: scsi cmd done, result=0x70000

<7>[ 2536.974241] usb-storage: queuecommand_lck called

<7>[ 2536.974256] usb-storage: *** thread sleeping.

<7>[ 2536.974261] usb-storage: *** thread awakened.

<7>[ 2536.974267] usb-storage: Command READ_10 (10 bytes)

<7>[ 2536.974271] usb-storage: 28 00 00 30 a4 e0 00 00 f0 00

<7>[ 2536.974294] usb-storage: Bulk Command S 0x43425355 T 0x6170 L 122880 F 128 Trg 0 LUN 0 CL 10

<7>[ 2536.974300] usb-storage: usb_stor_bulk_transfer_buf: xfer 31 bytes

<7>[ 2536.974306] usb-storage: Status code -19; transferred 31/31

<7>[ 2536.974310] usb-storage: -- unknown error

<7>[ 2536.974314] usb-storage: Bulk command transfer result=4

<7>[ 2536.974318] usb-storage: -- transport indicates error, resetting

<7>[ 2536.974323] usb-storage: unable to lock device for reset: -19

<7>[ 2536.974329] usb-storage: usb_stor_Bulk_reset called

<7>[ 2536.974335] usb-storage: usb_stor_control_msg: rq=ff rqtype=21 value=0000 index=00 len=0

<7>[ 2536.974340] usb-storage: Soft reset failed: -19

<7>[ 2536.974345] usb-storage: scsi cmd done, result=0x70000

<7>[ 2536.974368] usb-storage: queuecommand_lck called

<7>[ 2536.974378] usb-storage: *** thread sleeping.

<7>[ 2536.974383] usb-storage: *** thread awakened.

---------------------------------------------------------------------------------------------------------------

Is there any limitation to Medfield's penwell OTG? Does this also happens to Razr i?

Is this related to USB OTG's HNP polling?

Really thanks

Uranus Zhou