lights0123 / n-link

Free, cross-platform, CX-II compatible computer linking program for the TI-Nspire.
https://lights0123.com/n-link/
GNU General Public License v3.0
129 stars 4 forks source link

"No calculators found" #9

Closed Theelx closed 3 years ago

Theelx commented 3 years ago

OS: Ubuntu 20.04 Calculator: Ti-nspire CX II Installation method: .deb file

Screenshot from 2021-03-30 14-01-07 Screenshot from 2021-03-30 14-01-24

As shown in the above pictures, N-link says no calculators found, even though I've clicked the refresh button many times, and lsusb shows that the calculator was found by the OS. The web version doesn't work either, as shown by the following screenshot.

Screenshot from 2021-03-30 14-04-37

Theelx commented 3 years ago

@lights0123 Apologies for the ping, but this feels like a big problem. Could the issue be with /dev/tty nodes, as TiLP couldn't use those for some reason even though they exist and work for other things?

lights0123 commented 3 years ago

TI Nspire calculators don't expose a serial port over USB, so it shouldn't even be created.

Both N-link (the standalone app) and Chrome itself use libusb, so there seems to be a problem with it detecting devices on your system.

On Apr 3, 2021, at 3:26 PM, Theelgirl @.***> wrote:

 @lights0123 Apologies for the ping, but this feels like a big problem. Could the issue be with /dev/tty nodes, as TiLP couldn't use those for some reason even though they exist and work for other things?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

adriweb commented 3 years ago

People have mentioned issues with USB3 ports before, and that it worked better with USB2 ports...

Theelx commented 3 years ago

I believe I'm using a USB2 port @adriweb. Libusb detects the calculator fine in terminal, as shown in my terminal screenshot @lights0123.

lights0123 commented 3 years ago

lsusb and libusb are completely different.

Theelx commented 3 years ago

Interesting, I could have sworn lsusb used libusb to detect devices.

Do you think the problem could be resolved by updating the rusb and libusb-sys dependencies to the newest versions? I tried doing that locally, but it breaks something and I don't have the rust expertise to figure out how to unbreak it.

lights0123 commented 3 years ago

It could, but I doubt it. If you're familiar with compiling (you should only need your distro's libusb-dev package installed), you can try running https://github.com/libusb/libusb/blob/master/examples/listdevs.c (compile with -lusb IIRC).

Theelx commented 3 years ago

Got it, I'll try that and report back what I find.

Theelx commented 3 years ago

Ok, well I've spent a while trying to figure some errors out, it turns out I need to compile with -lusb-1.0, not -lusb. Anyway, I get this as the output:

1d6b:0003 (bus 2, device 1)
2a94:5249 (bus 1, device 6) path: 8
8087:0a2a (bus 1, device 5) path: 7
0bda:0129 (bus 1, device 4) path: 6
1bcf:28c1 (bus 1, device 3) path: 5
0451:e022 (bus 1, device 9) path: 3
046d:c52b (bus 1, device 2) path: 2
1d6b:0002 (bus 1, device 1)

I'm not totally sure if that means anything to you, because it doesn't to me.

Edit: According to lsusb, the calculator is in bus 1 device 9 now (I've restarted the computer a few times since I originally posted this issue): Screenshot from 2021-04-04 20-33-58

adriweb commented 3 years ago

0451:e022 is the TI calculator.

Theelx commented 3 years ago

Ok, well if libusb can detect it, do you have any ideas as to why n-link can't?

lights0123 commented 3 years ago

When you clicked the refresh button in your browser, did you get a popup? Try it in Chrom(e|ium). If that didn't work, run navigator.usb.requestDevice({ filters: [] }) in the browser console and see if the calculator appears in the popup.

Theelx commented 3 years ago

Ok, so I did just get a popup in chrome when I ran that code snippet in the console, and I clicked the calculator to pair, so that's progress. Thanks! However, it's not totally solved yet, as there's a DOM Exception when it tries to load it. Screenshot from 2021-04-04 22-13-08 Screenshot from 2021-04-04 22-13-57

Theelx commented 3 years ago

Extra info/Bonus Screenshot: Screenshot from 2021-04-04 22-21-06

lights0123 commented 3 years ago

Ahah! The TiLP udev rules only cover the TI Nspire non-CX-II, so even if you installed them, it wouldn't cover it. Create a new file /lib/udev/rules.d/99-n-link.rules with these contents:

# TI-Nspire
SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="e012", ENV{ID_PDA}="1"
# TI-Nspire CX II
SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="e022", ENV{ID_PDA}="1"

If this works, I'll add it to the docs.

lights0123 commented 3 years ago

After you create that file, run udevadm control --reload-rules && udevadm trigger.

Theelx commented 3 years ago

I just did both of those, I still get access denied. Could the file go in lib32 or lib64 or libx32 instead of the lib folder?

Edit: Nope, definitely goes in the /lib thing Screenshot from 2021-04-04 22-31-29

lights0123 commented 3 years ago

And... the 99 actually has to be less than 70. Rename it to 69-n-link.rules.

Theelx commented 3 years ago

Ok, trying now.

Theelx commented 3 years ago

Oh my gosh! I think it worked! Thank you sooo much, I totally thought I would need to get an older calculator! Screenshot from 2021-04-04 22-35-31

Theelx commented 3 years ago

How did you figure this out by the way? As you can probably see from my profile, I do basically all my stuff in Python, so I'm not used to working with Rust, C, and TypeScript, and so these udev rule things seem magical to me.

lights0123 commented 3 years ago

I was thinking about permissions on Linux, and remembered that I've always had to install udev rules for other things, but not for the Nspire. However, I just realized that I had installed TiLP as an Arch Linux package, which took care of udev rules for me hence me not remembering them.

Theelx commented 3 years ago

Ohhhhh, well that's very interesting. Is there a way to make n-link automatically generate this file, or will it have to be done manually for any new installations with this problem?

lights0123 commented 3 years ago

I can probably make it happen if you install as a .deb, but for AppImages or from the web, it'll have to be manual. I can detect the problem, though, and show steps to resolve it.

lights0123 commented 3 years ago

Side note, what is that browser in your very first post here—Konquerer? I ask because IIRC it uses Chromium and shows that it supports the WebUSB API (otherwise everything would be grayed out and you'd get a warning), but you didn't see it do anything when you asked it to show devices.

Theelx commented 3 years ago

Got it. That would be much preferable to my alternative of forgetting this happened and having to re-google everything if my computer breaks.

My browser in the first post is brave, because you said it had to be chromium-based, and I thought brave was chromium-based. I generally use firefox though for daily browsing.

lights0123 commented 3 years ago

Hmm... It should work. You didn't get any sort of feedback from the button in Brave? Can you check the console error messages?

Theelx commented 3 years ago

Testing Brave now.

Edit: Huh, it works now, but I could have sworn it didn't work a few days ago. I wonder if I may have not yet downloaded libusb when I originally made this issue.

Edit 2: It would be nice to have a page on the website dedicated to required packages on the various distros/OSes. I'd totally be willing to contribute the instructions to it if you could set up the Vue stuff and the design. The Linux install instructions at https://lights0123.com/n-link/ are very bare-bones.

debrouxl commented 3 years ago

Er, Ben... why would TILP (more precisely, libticables) define udev rules - or install Windows drivers - for models whose protocol the libti* stack doesn't support yet ? ;)

Besides including a 69-* udev rules file in the Linux packages you provide, adding to N-Link's documentation a block of text about udev rules for those who compile N-Link themselves is a must. Bonus points for providing an install script which creates the udev rules file; I plan on doing it as part of the proper non-root compile / root install split of https://ti-pla.net/tilpinst .

lights0123 commented 3 years ago

@debrouxl of course it shouldn't—just that everyone who has tested this has either used a non-CX-II using TiLP's own rules, or a CX II using their own custom udev rules. Will add this to the docs probably today.

lights0123 commented 3 years ago

Website updated with that instruction. Waiting on tauri-apps/tauri#1428 to make this automatic for deb files.