Page 1 of 1

TI_NN_NodeEnumInit

Unread postPosted: 09 Jun 2020, 14:42
by parisse
I probably misunderstood something, I'm trying to connect the nspire with some USB device using this code
Code: Select all
     
      nn_ch_t ch = NULL;
      nn_oh_t oh = NULL;
      nn_nh_t nh = NULL;
      oh = TI_NN_CreateOperationHandle();
      int ans=TI_NN_NodeEnumInit(oh);
      if (ans>=0){
   ans=TI_NN_NodeEnumNext(oh, &nh);
   if (ans>=0){
     TI_NN_NodeEnumDone(oh);
     TI_NN_DestroyOperationHandle(oh);
     ans=TI_NN_Connect(nh, 0x8001, &ch);
     if (ans>=0){
...

but the line int ans=TI_NN_NodeEnumInit(oh); fails to compile, while int ans=TI_NN_NodeEnumInit(ch); compiles.

The declaration of TI_NN_NodeEnumInit does not use the same argument type for the calc and for the device: for the calc it's nn_ch_t
Code: Select all
include/syscall-decls.h:int16_t TI_NN_NodeEnumInit(nn_ch_t p1);
libsyscalls/stubs.cpp:int16_t TI_NN_NodeEnumInit(nn_ch_t p1);

for the PC it's nn_oh_t
Code: Select all
NavNet/include/navnet.h:DLLDECL int16_t TI_NN_NodeEnumInit(nn_oh_t oh);

The PC declaration seems ok with the NavNet doc (https://hackspire.org/index.php?title=Syscalls#The_NavNet_API) while the calc declaration seems wrong:
nn_oh_t TI_NN_CreateOperationHandle(void): create an operation handle to be used with some NavNet functions.
int16_t TI_NN_DestroyOperationHandle(nn_oh_t oh): destroy an operation handle.
int16_t TI_NN_NodeEnumInit(nn_oh_t oh): initiates a node (computer or device) enumeration. Enumeration is required to find the partner computer or device.
...

Re: TI_NN_NodeEnumInit

Unread postPosted: 10 Jun 2020, 16:59
by Mumflr Fumperdink
I tried to figure out USB a while ago but kept getting stuck and confused. Can you show me your code if you get it working?

Re: TI_NN_NodeEnumInit

Unread postPosted: 10 Jun 2020, 17:36
by parisse
I'm not trying anymore. I found another way to detect that the calculator is connected to a computer (I was not really interested in USB communication, just wanted to know if there was a connection).

Re: TI_NN_NodeEnumInit

Unread postPosted: 10 Jun 2020, 17:53
by Adriweb
Well, sounds like a real prototype conflict/issue, can you open an issue here https://github.com/ndless-nspire/Ndless/issues/new and basically copy-paste your post ? :)

Re: TI_NN_NodeEnumInit

Unread postPosted: 13 Jun 2020, 17:45
by critor
parisse wrote:I'm not trying anymore. I found another way to detect that the calculator is connected to a computer (I was not really interested in USB communication, just wanted to know if there was a connection).

How ? ;)
Which port bit are you checking and for which value ?

Re: TI_NN_NodeEnumInit

Unread postPosted: 13 Jun 2020, 17:50
by Adriweb
Some details were given here: https://github.com/ndless-nspire/Ndless/issues/215 but not how it was found :P

Re: TI_NN_NodeEnumInit

Unread postPosted: 13 Jun 2020, 20:57
by parisse
Updated there.