Author Topic: USB driver / HIDn recompilation problems  (Read 5763 times)

0 Members and 1 Guest are viewing this topic.

Offline nspiredev500

  • LV0 Newcomer (Next: 5)
  • Posts: 4
  • Rating: +0/-0
    • View Profile
USB driver / HIDn recompilation problems
« on: September 16, 2019, 02:35:10 pm »
I'm trying to make a usb driver and started by looking at the code of HIDn.
I first tried to copy it to my own code and set breakpoints, but it gives compilation errors.
I then tried to recompile vanilla HIDn, but the errors persistet:
nspire-gcc -Os -Wall -W -marm -c ums.c
ums.c:33:24: error: field ‘sc_ibuf’ has incomplete type
  struct s_usb_pipe_buf sc_ibuf;
                        ^~~~~~~
ums.c: In function ‘attach’:
ums.c:134:44: warning: passing argument 7 of ‘usbd_open_pipe_intr’ makes pointer from integer without a cast [-Wint-conversion]
                            &sc->sc_ibuf, sc->sc_isize, ums_intr,
                                          ~~^~~~~~~~~~
In file included from /mnt/c/Users/usertemp/Desktop/TI/Ndless/ndless-sdk/bin/../include/os.h:30,
                 from ums.c:1:
/mnt/c/Users/usertemp/Desktop/TI/Ndless/ndless-sdk/bin/../include/syscall-decls.h:189:149: note: expected ‘uint32_t *’ {aka ‘long unsigned int *’} but argument is of type ‘int’
 erface_handle p1, uint8_t p2, uint8_t p3, usbd_pipe_handle *p4, usbd_private_handle p5, void *p6, uint32_t *p8, usbd_callback p9, int p10);
                                                                                                   ~~~~~~~~~~^~

ums.c: In function ‘ums_register’:
ums.c:158:2: warning: implicit declaration of function ‘nl_relocdata’; did you mean ‘e_nl_relocdatab’? [-Wimplicit-function-declaration]
  nl_relocdata((unsigned*)methods, sizeof(methods)/sizeof(methods[0]) - 1);
  ^~~~~~~~~~~~
  e_nl_relocdatab
make: *** [Makefile:24: ums.o] Error 1

I found the code on the nspiretools-history github: https://github.com/ndless-nspire/nsptools-history/tree/master/hidn/trunk
It's also on TI-Planet: https://tiplanet.org/forum/archives_voir.php?id=12928

Maybe the usb api in the ndless-sdk got changed, because the last changes to HIDn on github are 7 years old.
It seems as if nl_relocdata and struct s_usb_pipe_buf got removed.
The binary version works on my cx cas, so it's still possible to write usb drivers.
Also I'm using Windows Subsystem for Linux with debian to compile.
If anyone knows how to fix this, I'd be happy.
(this is my first post and I'm not a native speaker, please forgive me if I make spelling mistakes)

Offline Jonson26

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 118
  • Rating: +1/-0
  • Follow cat! Do what cat! Into tree! Now!
    • View Profile
Re: USB driver / HIDn recompilation problems
« Reply #1 on: September 20, 2019, 05:56:06 pm »
Did you try to compile anything else (like hello world, f.ex.)? From my experience, compiling the ndless sdk is a total mess, so maybe it's just your compiler... Congrats anyway for getting through the compilation of the compiler stage. (I failed :/ )

Offline nspiredev500

  • LV0 Newcomer (Next: 5)
  • Posts: 4
  • Rating: +0/-0
    • View Profile
Re: USB driver / HIDn recompilation problems
« Reply #2 on: September 21, 2019, 03:36:46 am »
Thanks, I can compile everything else, I even compiled another program I made and it ran flawlessly on both the calculator and the emulator.
So the compiler is working.
Maybe some ndless syscalls are deprecated and can be run, but they don't exist for compilation anymore?

Offline Jonson26

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 118
  • Rating: +1/-0
  • Follow cat! Do what cat! Into tree! Now!
    • View Profile
Re: USB driver / HIDn recompilation problems
« Reply #3 on: October 23, 2019, 04:52:58 am »
I'm honestly not sure...
One thing that comes to my mind, is to take the things, that you believe produce the error, and search for them in ndless changelogs. Maybe you can find somethind there. Also, one other thing you could do, is asking on other forums, since this one is no longer that big as it once was (but i heard that there's quite a lot of activity on cemetech.org You could also check codewalr.us for help).
Edit: Good luck, by the way. What is your end goal with this anyway?

Offline nspiredev500

  • LV0 Newcomer (Next: 5)
  • Posts: 4
  • Rating: +0/-0
    • View Profile
Re: USB driver / HIDn recompilation problems
« Reply #4 on: October 26, 2019, 02:40:43 pm »
In the end, I want to develop/adapt a usb driver for a usb wifi card I bought because I wanted to use linux to use a browser on the calculator, but it seems my hardware revision (AA) has a screen linux doesn't support.
I don't know enough about device trees and display drivers, or even what display exactly it is, so I looked into usb driver development for the nspire.

Offline Jonson26

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 118
  • Rating: +1/-0
  • Follow cat! Do what cat! Into tree! Now!
    • View Profile
Re: USB driver / HIDn recompilation problems
« Reply #5 on: November 10, 2019, 01:51:43 pm »
You know, you'll need to implement a whole TCP/IP stack to use it even for basic remote console applications though, right? The nspire OS never got a homebrew internet solution, so you won't find anything remotely similar to a browser.
If you have the skills and knowledge to pull this off, then I'm holding my thumbs for you, be warned though.