nspire-emus / firebird

Multi-platform emulator of TI Nspire calculators
GNU General Public License v3.0
704 stars 69 forks source link

Cannot send file #221

Open VoxelPrismatic opened 4 years ago

VoxelPrismatic commented 4 years ago

I have firebird 1.5 running on android 9 with the storage permissions enabled. I managed to get the CX CAS version 3.6.0.546 running but cannot transfer any file to the calculator. I try the same file on my PC and it works fine. does anybody know what the issue could be and how I can transfer files on android?

Vogtinator commented 4 years ago

Does the target folder exist already? Does the filename end in .tns? Is there anything helpful in the adb log?

VoxelPrismatic commented 4 years ago

Yes the target folder exists. Yes the file name ends in .tns. This is the log, i cannot understand it: log.txt

Vogtinator commented 4 years ago

Unfortunately there's nothing useful in there. Are the filenames of boot1 and flash in the configuration shown correctly?

VoxelPrismatic commented 4 years ago

Yes they do, and the emulator starts up fine

Vogtinator commented 4 years ago

Can you describe in which way it fails? After you select a file, does it say "Failed" immediately? To get logs from the device, please copy the flash image to a PC and run it, then download NspireLogs.zip.

VoxelPrismatic commented 4 years ago

The funny thing is: it sends fine on PC, the issue is with the android app it takes about 3 seconds before it says "Status: Failed!"

VoxelPrismatic commented 4 years ago

However, the transfer on desktop with the mobile UI stalls...

VoxelPrismatic commented 4 years ago

Serial Monitor from Mobile UI on desktop:

image


20:56:59.860,20-10-30,0000000386,UDP SC: TI_UDP_BindIPAddr +++
20:56:59.860,20-10-30,0000000386,UDP SC: NU_Bind Successful
20:56:59.860,20-10-30,0000000386,UDP SC: TI_UDP_BindIPAddr ---
20:57:00.800,20-10-30,0000000480,dbgWirelessIconState(): !~!~!~!~!~!~!~!~    Wireless Icon:NoSled    ~!~!~!~!~!~!~!~!
autodim_power_callback
20:57:09.270,20-10-30,0000001327,UDP SC: allowUSBCallback(): allow USB connector: YES
autodim_power_callback
20:57:09.470,20-10-30,0000001347,CM: _____ streamChangeCallback called: cnhp=1176c568
20:57:09.470,20-10-30,0000001347,CM: StreamChangeCallback: Connector returned 1 entries
20:57:09.470,20-10-30,0000001347,CM: StreamChangeCallback: 1 entries to be added...
20:57:09.470,20-10-30,0000001347,CM: _____ Adding stream: nSpireDev0, type = 2
20:57:09.490,20-10-30,0000001349,sm_Connector:statemachineThread(): Enter->USBConnected. State->Idle.
20:57:09.490,20-10-30,0000001349,sm_Connector:statemachineThread(): Exit->USBConnected. State->USBConnected.
20:57:09.490,20-10-30,0000001349,Remote Stream (nSpireDev0) RX buf: 0x117864d4: 0.0
20:57:10.990,20-10-30,0000001399,Sending ADDR REQ packet to device stream: nSpireDev0 : 0.0:4003 0.0:4003 [seq=1] [siz=2]
20:57:10.990,20-10-30,0000001399,Exit ADDR REQ Send.
20:57:10.990,20-10-30,0000001399,CM: StreamChangeCallback: 0 entries to be removed...
20:57:10.990,20-10-30,0000001399,IS: RECV ADDR PKT 0x117874e4 from 0.0 : 100.0:4003 100.1:4003 [seq=1] [siz=4]
20:57:10.990,20-10-30,0000001399,CM: _____ Reassigned stream nSpireDev0 (np 0x11775050) to addr 100.0
20:57:10.990,20-10-30,0000001399,IS: process_addr_assign: DEFAULT max payload = 254
20:57:10.990,20-10-30,0000001399,CM: _____ Reassigned stream Local Node (np 0x1176E694) to addr 100.1
20:57:10.990,20-10-30,0000001399,IS: (ADDR TTL=0x0) ACK WINDOW SIZE = 1: 0.0
20:57:10.990,20-10-30,0000001399,CM: node_notify_cb: 100.1, event_type 0x00000001, np 0x11775050 (nSpireDev0)
20:57:10.990,20-10-30,0000001399,TI_NN_NotifyCallback Called. Node address =  0x6400. +++
20:57:10.990,20-10-30,0000001399,NN: Can Log In = true
20:57:10.990,20-10-30,0000001399,End of TI_NN_NotifyCallback. ---
20:57:10.990,20-10-30,0000001399,NN: Logged In = false
20:57:10.990,20-10-30,0000001399,cnConnectorCallback():NOTE_CN_NAVNET_LOGINSTATUS Logged in: 0
20:57:10.990,20-10-30,0000001399,TI_NN_Login Called.
20:57:10.990,20-10-30,0000001399,login: user name[0], password[NULL].
20:57:10.000,20-10-30,0000001400,LowAPI: Create New conHandle [11788598]: Src SYNC(4060) Dst:180(0180)
20:57:10.000,20-10-30,0000001400,TI_NN_Activate_Callback: Activate callback conn srcport 4060 destport 0180

20:57:10.000,20-10-30,0000001400, service handler is STARTING now, ch=11788598
20:57:10.000,20-10-30,0000001400,SYNC MSG: HandleOperationCallback RQST_TO_SEND_VAR_CMD (0x3)
20:57:10.000,20-10-30,0000001400,HandlePut localOverridePath<null> ch<11788598>
20:57:10.000,20-10-30,0000001400,SYNC: HandlePut() locPath<null>
20:57:10.000,20-10-30,0000001400,NNINIT: syncOperationCallback() type[PUT]
20:57:10.000,20-10-30,0000001400,FileLog: PutFile: /documents/home/priz/Documents/Pacman.tns
20:57:10.000,20-10-30,0000001400,SYNC: SendRequestPacket() len=0, ret=1
20:57:10.000,20-10-30,0000001400,SYNC: ReceiveFileData() size=30709
20:57:10.330,20-10-30,0000001433,SYNC: forcedFileRename() /tmp/11790b48.tmp --> /documents/home/priz/Documents/Pacman.tns
20:57:10.330,20-10-30,0000001433,SYNC: RenameFileFolder() /tmp/11790b48.tmp --> /documents/home/priz/Documents/Pacman.tns
20:57:10.330,20-10-30,0000001433,RenameFileFolder: utf8rename: <errno=2> </tmp/11790b48.tmp> </documents/home/priz/Documents/Pacman.tns>
20:57:10.330,20-10-30,0000001433,RenameFileFolder: returning error: <-264> </tmp/11790b48.tmp> </documents/home/priz/Documents/Pacman.tns>
20:57:13.700,20-10-30,0000001670,refreshApList```
Vogtinator commented 4 years ago

What's the target folder set to? If it's /, it did not get the right file name.

VoxelPrismatic commented 4 years ago

/home/priz/Documents, which makes no sense if it's trying to write to

20:57:10.330,20-10-30,0000001433,RenameFileFolder: utf8rename: <errno=2> </tmp/11790b48.tmp> </documents/home/priz/Documents/Pacman.tns>
20:57:10.330,20-10-30,0000001433,RenameFileFolder: returning error: <-264> </tmp/11790b48.tmp> </documents/home/priz/Documents/Pacman.tns>
Vogtinator commented 4 years ago

Did you set that manually? It should be / by default.

VoxelPrismatic commented 4 years ago

i did set it manually

Vogtinator commented 4 years ago

Ok, why? It means that it tries to send it into the calculator's /home/priz/Documents, which doesn't exist.

VoxelPrismatic commented 4 years ago

its trying to send to /documents/home/priz/Documents, which does exist

and the default directory was /ndless

Vogtinator commented 4 years ago

The full path has to exist already, it does not create any path components.

VoxelPrismatic commented 4 years ago

just curious, why does it put /documents first then?

20:57:10.000,20-10-30,0000001400,FileLog: PutFile: /documents/home/priz/Documents/Pacman.tns
Vogtinator commented 4 years ago

That's where the calculator stores documents internally. In exam mode, it's /exammode/usr instead.

VoxelPrismatic commented 4 years ago

oh i see so i should try to set the directory to /documents on android and send the file

Vogtinator commented 4 years ago

No, that would fail as /documents/documents doesn't exist. Just set it to /, that is guaranteed to work.

VoxelPrismatic commented 4 years ago

still fails on android

Vogtinator commented 4 years ago

Android or PC? In any case, logs are needed.

VoxelPrismatic commented 4 years ago

says invalid path on PC in the serial log

21:58:15.520,20-10-30,0000002552,SYNC: HandlePut() locPath<null>  
21:58:15.520,20-10-30,0000002552, ParseVarRqst: Error: invalid path
21:58:15.520,20-10-30,0000002552, HandlePut: ParseVarRqst failed: <-276>
Vogtinator commented 4 years ago

What happens with an empty target directory?

VoxelPrismatic commented 4 years ago

that works on PC, not android

Vogtinator commented 4 years ago

Both on Android and PC?

VoxelPrismatic commented 4 years ago

just PC

Vogtinator commented 4 years ago

If it still fails on Android, please provide logs.

VoxelPrismatic commented 4 years ago

I'm using adb logcat --pid=1594, should I use GDB instead?

Vogtinator commented 4 years ago

Fortunately not (using gdb manually is painful). https://github.com/nspire-emus/firebird/issues/221#issuecomment-719786350:

To get logs from the device, please copy the flash image to a PC and run it, then download NspireLogs.zip.

There's currently no way to receive documents using the Mobile UI...

VoxelPrismatic commented 4 years ago

how do I run the flash and get NspireLogs.zip?, do I just run the flash in firebird? where is NspireLogs?

Vogtinator commented 4 years ago

do I just run the flash in firebird?

Yep. Make sure to save the flash in Android first, so that it contains the latest entries.

where is NspireLogs?

You'll see it when refreshing the browser in the file transfer window.

VoxelPrismatic commented 4 years ago

it isn't in the logs surprisingly

VoxelPrismatic commented 4 years ago

i have this when its blank:


18:31:11.320,20-10-18,0000128032, service handler is STARTING now, ch=11775f9c
18:31:11.320,20-10-18,0000128032,SYNC MSG: HandleOperationCallback RQST_TO_SEND_VAR_CMD (0x3)
18:31:11.320,20-10-18,0000128032,HandlePut localOverridePath<null> ch<11775F9C>
18:31:11.320,20-10-18,0000128032,SYNC: HandlePut() locPath<null>  
18:31:11.320,20-10-18,0000128032,ParseVarRqst: Error: invalid path
18:31:11.320,20-10-18,0000128032,HandlePut: ParseVarRqst failed: <-276>
VoxelPrismatic commented 4 years ago

or with the slash, im not sure. the test file Pacman.tns doesn't appear in the logs anywhere

Vogtinator commented 4 years ago

My suspicion is that the filename detection for files sent from Android is somehow broken. That's apparently not logged anywhere currently... Here's a build which logs a bit more (untested): https://owncloud.ritter-vogt.de/index.php/s/OaTBMlqPOkmXgyR

VoxelPrismatic commented 4 years ago

It stopped logging altogether now.

VoxelPrismatic commented 4 years ago

doesn't help that I cannot see the checkboxes for my options, i don't know if it's trying to log or not.

VoxelPrismatic commented 4 years ago

i should say that i dont think it was logging previously either

Vogtinator commented 4 years ago

It stopped logging altogether now.

That sounds odd, I only added calls to __android_log_write.

doesn't help that I cannot see the checkboxes for my options, i don't know if it's trying to log or not.

Which options?

VoxelPrismatic commented 4 years ago

Screenshot_20201031-122941

VoxelPrismatic commented 4 years ago

I can't see any on any screen

Vogtinator commented 4 years ago

That looks very broken, like it failed to load or generate the style. That's something for another issue though.

VoxelPrismatic commented 4 years ago

maybe its related in the way that it doesnt have permissions or something?

Vogtinator commented 4 years ago

No idea. I'd need to see logs.

LanHikari64 commented 2 years ago

I also have this issue, along with the checkboxes not appearing.

atticusrussell commented 2 years ago

I've got this issue as well.

Vogtinator commented 2 years ago

I was able to reproduce the styling issue with an Android 12 AVD. The fix is simple: Just increase targetSdkVersion to at least 28.

I was also able to reproduce the original issue here, sending files fails most of the time. Not sure why yet, needs some further debugging. It's surprisingly not related to the file access.

Vogtinator commented 2 years ago

I was also able to reproduce the original issue here, sending files fails most of the time. Not sure why yet, needs some further debugging. It's surprisingly not related to the file access.

That was unfortunately CX II specific, so not the same as the issue reported here.

At least the broken UI is fixed with #257 though.

TotallyNotSethP commented 1 year ago

I have the same issue on Android