Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CX II(-T) support #33

Open
PizzaFlavoured opened this issue Feb 9, 2020 · 14 comments
Open

CX II(-T) support #33

PizzaFlavoured opened this issue Feb 9, 2020 · 14 comments

Comments

@PizzaFlavoured
Copy link

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
Copy link
Owner

debrouxl commented Feb 9, 2020

Work has started but I didn't make much progress because I didn't work much on libti* since September 2019, see debrouxl/tilibs#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
Copy link
Author

PizzaFlavoured commented Feb 9, 2020

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
Copy link
Owner

debrouxl commented Feb 9, 2020

Thanks for proposing your help, though :)

@PizzaFlavoured
Copy link
Author

@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
Copy link
Owner

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
Copy link
Author

@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
Copy link

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

@PizzaFlavoured
Copy link
Author

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

@debrouxl
Copy link
Owner

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
Copy link

ribrdb commented Sep 10, 2023

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
Copy link
Owner

debrouxl commented Sep 10, 2023

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
Copy link
Contributor

adriweb commented Sep 10, 2023

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
Copy link
Owner

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
Copy link
Owner

debrouxl commented Sep 10, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants