tilp_and_gfm icon indicating copy to clipboard operation
tilp_and_gfm copied to clipboard

CX II(-T) support

Open PizzaFlavoured opened this issue 4 years ago • 14 comments

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.

PizzaFlavoured avatar Feb 09 '20 11:02 PizzaFlavoured

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 :)

debrouxl avatar Feb 09 '20 12:02 debrouxl

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.

PizzaFlavoured avatar Feb 09 '20 13:02 PizzaFlavoured

Thanks for proposing your help, though :)

debrouxl avatar Feb 09 '20 16:02 debrouxl

@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.

PizzaFlavoured avatar Feb 16 '20 18:02 PizzaFlavoured

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 :)

debrouxl avatar Feb 17 '20 18:02 debrouxl

@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.

PizzaFlavoured avatar Feb 17 '20 21:02 PizzaFlavoured

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

Vogtinator avatar Feb 18 '20 06:02 Vogtinator

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

PizzaFlavoured avatar Feb 18 '20 17:02 PizzaFlavoured

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.

debrouxl avatar Feb 19 '20 07:02 debrouxl

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.

ribrdb avatar Sep 10 '23 15:09 ribrdb

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)

debrouxl avatar Sep 10 '23 16:09 debrouxl

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

adriweb avatar Sep 10 '23 20:09 adriweb

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 avatar Sep 10 '23 20:09 debrouxl

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.]

debrouxl avatar Sep 10 '23 21:09 debrouxl