magnusja / libaums

Open source library to access USB Mass Storage devices on Android without rooting your device
Apache License 2.0
1.26k stars 270 forks source link

Wrong CSW status #124

Open MaartenStottelaar opened 6 years ago

MaartenStottelaar commented 6 years ago

Some USB devices seem to return an invalid CSW status, even when the operation apears to be correct. If I return TRUE in cases where csw.getbCswStatus== 1 in "transferCommand" (line 134) with these USB devices, the data transfer seems to be OK. For now I ignore csw.getbCswStatus== 1, but like to solve this problem.

Maarten

magnusja commented 6 years ago

Hey there,

and sorry for the late response.

Thanks for this information, I never had this problem, to be honest. Can you maybe elaborate a little which phone and pen drive you use? Is there a pattern?

MaartenStottelaar commented 6 years ago

Dear Magnusja,

I am running the code on a Enybox 'Android box' with Android 6 (I tried several pieces). It seems that about 50% of the USB sticks do not work, but I have at least one official Sandisk 32G that works fine. I also noticed that (smaller) FAT formatted devices do not work, but that can of course eailly be solved.

Maarten

PMMKing commented 6 years ago

Thanks for solving my problem.

dandan8936 commented 6 years ago

Hi, I have the same problem now, ScsiInquiryResponse [peripheralQualifier=0, peripheralDeviceType=0, removableMedia=false, spcVersion=2, responseDataFormat=2] java.io.IOException: Unsuccessful Csw status: 1

alVal6 commented 6 years ago

I get this error when i setupDevice() as in your MainActivity code, it happens to me with 2 usb different sticks, both fat 32 and mbr. 06:11:09.200 2229-2229/com.usb E/2: error setting up device java.io.IOException: Unsuccessful Csw status: 1 at com.github.mjdev.libaums.driver.scsi.ScsiBlockDevice.transferCommand(ScsiBlockDevice.java:185) at com.github.mjdev.libaums.driver.scsi.ScsiBlockDevice.init(ScsiBlockDevice.java:98) at com.github.mjdev.libaums.UsbMassStorageDevice.setupDevice(UsbMassStorageDevice.java:232) at com.github.mjdev.libaums.UsbMassStorageDevice.init(UsbMassStorageDevice.java:192) i always get same error with some usb sticks

Please help

alVal6 commented 6 years ago

Hi!, i solved the problem, just need a delay before calling discover function and all usb sticks work.

RandallXia commented 6 years ago

Hi there! I sleep the thread 1 second before i call device.init(); and it works!

alVal6 commented 6 years ago

Nice!!! its great to hear it, you can try timer Countdown in order to avoid sleeping the thread

bealebe commented 5 years ago

I'm still getting this. The 1 second sleep doesn't help.

alVal6 commented 5 years ago

Try with 3 seconds delay

[https://ci3.googleusercontent.com/proxy/GYeW-WfXrv_SHe0fBJj--7wGxKXhXu22PUhEGDHeEPu98HxeGrUyMeXjFyLdSYJTwwajU6av-6Y9Fw=s0-d-e1-ft#http://bizintek.es/logo-bizintek.png]

C/ Nemesio Mogrobejo 9A 48015 - Bilbao (Vizcaya) Tel: +34 94 437 26 96 Fax: +34 94 434 47 05 www.bizintek.eshttp://www.bizintek.es/ Álvaro Valtierra De Pablo Firmware Engineer

a.valtierra@bizintekinnova.commailto:m.viqueira@bizintekinnova.com

[https://ci4.googleusercontent.com/proxy/iN-a4agKdd_Pwr0dNwJWrzAozdp2wO52fOLxMKG7ANaQPfRy5EglRL8zAbD_oS4=s0-d-e1-ft#http://bizintek.es/bg.png]


De: Bryan E Beale notifications@github.com Enviado: jueves, 25 de octubre de 2018 21:38:00 Para: magnusja/libaums Cc: Alvaro Valtierra; Comment Asunto: Re: [magnusja/libaums] Wrong CSW status (#124)

I'm still getting this. The 1 second sleep doesn't help.

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/magnusja/libaums/issues/124#issuecomment-433178835, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AnixcmGtKmoKiNBLONtkACmA6GtnX1Nnks5uohMYgaJpZM4REueP.