debrouxl / tilp_and_gfm

TILP (formerly GtkTiLink) can transfer data between Texas Instruments graphing calculators and a computer. It works with all link cables (parallel, serial, Black/Gray/Silver/Direct Link) and it supports the TI-Z80 series (73..86), the TI-eZ80 series (83PCE, 84+CE), the TI-68k series (89, 92, 92+, V200, 89T) and the Nspire series (Nspire Clickpad / Touchpad / CX, both CAS and non-CAS)
http://lpg.ticalc.org/prj_tilp
115 stars 17 forks source link

CX II(-T) support #33

Open PizzaFlavoured opened 4 years ago

PizzaFlavoured commented 4 years ago

Is support for these calculators planned, at least in a way to allow for file transfer and OS updates? What must be done to support them? I would like to help if possible but I lack C knowledge.

debrouxl commented 4 years ago

Work has started but I didn't make much progress because I didn't work much on libti* since September 2019, see https://github.com/debrouxl/tilibs/issues/33 :) I started refactoring nsp_cmd locally, and did exchange a couple NNSE packets with my CX II through test_ticalcs_2's scripting, but I have no proper implementation of the CX II protocol in libticalcs.

@Vogtinator added initial support for the CX II in his fork of libnspire; it's an incomplete implementation of TI's protocol, less unreliable than the original libnspire implementation after debugged and fixed multiple issues, but it's the only one you can use right now.

The main way to help is to gather dumps of the communication between TI's official software and the CX II calculator; however, at this stage, I'm not sure we need more dumps, as the dumps we already have enabled us to gain significant knowledge of the protocol, and should we need more, both Fabian and I can produce such dumps for ourselves using our own calculators, without having to bother users :)

PizzaFlavoured commented 4 years ago

It appears I won't be of much help then, sorry. Thanks a lot for telling me about that fork, though. I'm not sure how to use it, but I'll try to figure it out myself.

debrouxl commented 4 years ago

Thanks for proposing your help, though :)

PizzaFlavoured commented 4 years ago

@debrouxl I'm ashamed to admit, I have no clue how to use your suggestion. I realize that asking for help from you would be too much, but could you perhaps point me in the right direction? I'm sorry.

debrouxl commented 4 years ago

You need to build https://github.com/Vogtinator/libnspire as tersely described in the README, then build https://github.com/tangrs/fuse-nspire using make, which creates a "nspire" binary :)

PizzaFlavoured commented 4 years ago

@debrouxl had to ask for some help because libnspire wasn't building without running some extra commands and managed to compile and install it, but fuse-nspire appears to be OSX specific, and can't get it to compile on Linux.

Tried to use gcc, clang and changing the fuse directory in the Makefile to match my installation, to no avail.

I can't believe I offered help when I can't even do this haha. Sorry for bothering you even more asking for help.

Vogtinator commented 4 years ago

@DarkAlphaSete https://github.com/Vogtinator/fuse-nspire should builds and work fine on Linux.

PizzaFlavoured commented 4 years ago

All I had was try again.. It's now working really well, so thanks a lot for helping me out!

debrouxl commented 4 years ago

You're welcome :) In general, libnspire's functionality set is smaller than libticalcs' for the Nspire before the CX II, but libnspire is the only choice for the CX II right now, so it makes sense to help you. As I wrote, libnspire's lower reliability for file transfers, which I saw for myself back in the day, is (much ?) less of an issue after Vogtinator's fixes.

ribrdb commented 1 year ago

On my CX II, if I open usb configuration 2 it speaks the normal nspire protocol. that seems like an easy way to add support.

debrouxl commented 1 year ago

Well, that would be an interesting piece of news :) Which OS version are you using ? EDIT: also, could you provide a USB descriptor dump, e.g. the output of lsusb -v -d 0451:e022 ?

For reference, my CX II-T CAS running OS 5.0.0.1509 exposes the following USB descriptors:

Bus 001 Device 029: ID 0451:e022 Texas Instruments, Inc. Nspire CX II
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x0451 Texas Instruments, Inc.
  idProduct          0xe022 Nspire CX II
  bcdDevice            2.01
  iManufacturer           2 Texas Instruments Incorporated
  iProduct                1 TI-Nspire(tm) CX II Handheld
  iSerial                 0 
  bNumConfigurations      2
OTG Descriptor:
  bLength                 3
  bDescriptorType         9
  bmAttributes         0x03
    SRP (Session Request Protocol)
    HNP (Host Negotiation Protocol)
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x0023
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              500mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      2 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x0023
    bNumInterfaces          1
    bConfigurationValue     2
    iConfiguration          0 
    bmAttributes         0xc0
      Self Powered
    MaxPower                0mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      2 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
Device Qualifier (for other device speed):
  bLength                10
  bDescriptorType         6
  bcdUSB               2.00
  bDeviceClass            0 
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  bNumConfigurations      2
Device Status:     0x0000
  (Bus Powered)
adriweb commented 1 year ago

I can confirm that it does work on a CX II with OS 5.2, with configuration2 after fiddling with libticables :) What a find!

image image image

debrouxl commented 1 year ago

That's a great find indeed, thanks for both the discovery and the tests :) We'll have to determine the range of OS versions which provide this capability.

debrouxl commented 1 year ago

I've just pushed an update to the Nspire model split commit on the tilibs repository, which re-enables a number of code paths which I had previously commented out. I've successfully listed files from my CX II-T CAS running OS 5.0.0.1509, and transferred the available files to the computer. However, getting device info and therefore getting screenshots fail consistently.

[EDIT: the culprit for get device info failing was a pre-existing bug in nsp_cmd.cc::nsp_cmd_r_dev_infos(): it didn't set size, so the range check on size I added to calc_nsp.cc::get_version() started failing, by chance (dependent on memory contents). After fixing that bug, I can now get device info and screenshots.]