lykahb / neotools Goto Github PK
View Code? Open in Web Editor NEWCommand-line tools for AlphaSmart NEO
License: GNU General Public License v3.0
Command-line tools for AlphaSmart NEO
License: GNU General Public License v3.0
I tried lowering PROTOCOL_VERSION
to 0x0220, and neotools seems to work properly with the AS3000. I tried:
I could just open a PR for the change, but I'm not sure what the differences between protocol versions 0x0220 and 0x0230 are, so I am opening this issue for discussion. If needed, I can do packet captures of the AlphaSmart Manager 2.0 communications, or verify certain functions that could be expected to have a change or problem.
On my Fedora 38 system, if I run any command, e.g. neotools info
with my Neo connected, nothing happens, with it just appearing to hang.
If I then manually Ctrl-C
at the console, I get the following traceback:
sys.exit(cli())
^^^^^
File "/usr/lib/python3.11/site-packages/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/aren/.local/lib/python3.11/site-packages/neotools/cli.py", line 214, in system_info
info = commands.system_info()
^^^^^^^^^^^^^^^^^^^^^^
File "/home/aren/.local/lib/python3.11/site-packages/neotools/commands.py", line 20, in new_func
result = f(*args, **kwargs)
^^^^^^^^^^^^^^^^^^
File "/home/aren/.local/lib/python3.11/site-packages/neotools/commands.py", line 228, in system_info
with Device.connect() as device:
File "/usr/lib64/python3.11/contextlib.py", line 137, in __enter__
return next(self.gen)
^^^^^^^^^^^^^^
File "/home/aren/.local/lib/python3.11/site-packages/neotools/device.py", line 42, in connect
device.dispose()
File "/home/aren/.local/lib/python3.11/site-packages/neotools/device.py", line 88, in dispose
if self.original_product == HID_PRODUCT_ID and self.dev.idProduct == COM_PRODUCT_ID:
^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'idProduct'
Traceback (most recent call last):
File "/usr/lib64/python3.11/weakref.py", line 666, in _exitfunc
f()
File "/usr/lib64/python3.11/weakref.py", line 590, in __call__
return info.func(*info.args, **(info.kwargs or {}))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/aren/.local/lib/python3.11/site-packages/usb/_objfinalizer.py", line 106, in _do_finalize_object_ref
obj._do_finalize_object()
File "/home/aren/.local/lib/python3.11/site-packages/usb/_objfinalizer.py", line 73, in _do_finalize_object
self._finalize_object()
File "/home/aren/.local/lib/python3.11/site-packages/usb/backend/libusb1.py", line 613, in _finalize_object
_lib.libusb_unref_device(self.devid)
^^^^^^^^^^
AttributeError: '_Device' object has no attribute 'devid'
Exception ignored in: <function _AutoFinalizedObjectBase.__del__ at 0x7f07570a8540>
Traceback (most recent call last):
File "/home/aren/.local/lib/python3.11/site-packages/usb/_objfinalizer.py", line 86, in __del__
self.finalize()
File "/home/aren/.local/lib/python3.11/site-packages/usb/_objfinalizer.py", line 146, in finalize
self._finalizer()
^^^^^^^^^^^^^^^
AttributeError: '_Device' object has no attribute '_finalizer'
The crucial lines appears to be these ones:
if self.original_product == HID_PRODUCT_ID and self.dev.idProduct == COM_PRODUCT_ID:
^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'idProduct'
If I now run the command again, it works perfectly fine.
This has meant that I've had to create the following slightly ugly hack bash script as a workaround to just copy all of the files off the device (which is all I'm really interested in):
#!/bin/bash
# Get timestamp for postfix on directory name
TIMESTAMP="`date +%Y-%m-%d-%H_%M_%S`"
WRITEDIR=writing-${TIMESTAMP}
mkdir $WRITEDIR
neotools files read-all --path $WRITEDIR/ &
PID=$!
sleep 0.2
kill $PID
sleep 1.0
echo "Copying text files off Neo..."
neotools files read-all --path $WRITEDIR/
ls -lh $WRITEDIR
echo "Files copied into $WRITEDIR"
As you can see, I explicity run the command, tiny delay, kill it using its pid, small delay, then run the command again, and this works just fine and copies everything off my Neo...
Any idea what the fix/problem is? In any case, thanks for this project, is super handy being able to just dump the files off the Neo rather than having to send things one-by-one in keyboard mode...
What does that warning mean? Should I be worried?
I also got a bunch of similar ones. Here's the full log:
~/NeoStuff ❯❯❯ sudo neotools files read-all --path 15Jul2022/
ASAlphaWordText: possibly untrapped escape 177
ASAlphaWordText: possibly untrapped escape 177
ASAlphaWordText: possibly untrapped escape 178
ASAlphaWordText: possibly untrapped escape 178
ASAlphaWordText: possibly untrapped escape 177
ASAlphaWordText: possibly untrapped escape 177
ASAlphaWordText: possibly untrapped escape 178
ASAlphaWordText: possibly untrapped escape 178
ASAlphaWordText: possibly untrapped escape 188
ASAlphaWordText: possibly untrapped escape 188
ASAlphaWordText: possibly untrapped escape 182
ASAlphaWordText: possibly untrapped escape 182
ASAlphaWordText: possibly untrapped escape 188
ASAlphaWordText: possibly untrapped escape 188
ASAlphaWordText: possibly untrapped escape 175
ASAlphaWordText: possibly untrapped escape 175
ASAlphaWordText: possibly untrapped escape 181
ASAlphaWordText: possibly untrapped escape 188
ASAlphaWordText: possibly untrapped escape 188
ASAlphaWordText: possibly untrapped escape 182
ASAlphaWordText: possibly untrapped escape 182
ASAlphaWordText: possibly untrapped escape 188
ASAlphaWordText: possibly untrapped escape 188
ASAlphaWordText: possibly untrapped escape 175
ASAlphaWordText: possibly untrapped escape 175
ASAlphaWordText: possibly untrapped escape 181
ASAlphaWordText: possibly untrapped escape 168
(run with sudo not because permission denied, but because generator didn't yield
- i'm assuming the same root cause )
This may very well be an ID10T error as, like the folks posting in the Alphasmart forum, I am a Linux noob,, It just doesn't seem to work for me, either with the rules file. Without using sudo, I get the access denied error. With sudo I get a strange "module not there" error. I give you the screen dump for each below.
I am sure I have Python 3 (3,9,x...) and I am a member of the plugdev group. I copy and pasted the rules from github here, called the file 50-alphsmart.rules and put it in /lib/udev/rules.d, I have Neotools in lib/bin in my home directory. And, yes, the Neo is connected and showing the expected "Attached to PC..." message.
Here in my Linux setup:
Operating System: Manjaro Linux
KDE Plasma Version: 5.22.3
KDE Frameworks Version: 5.84.0
Qt Version: 5.15.2
Kernel Version: 5.10.52-1-MANJARO (64-bit)
Graphics Platform: X11
Processors: 4 × Intel® Core™ i5-3320M CPU @ 2.60GHz
Memory: 7.5 GiB of RAM
Graphics Processor: Mesa DRI Intel® HD Graphics 4000
When I type the cli command "neotools files read 1" I get:
neotools files read 1
Traceback (most recent call last):
File "/home/hook/.local/bin/neotools", line 8, in
sys.exit(cli())
File "/home/hook/.local/lib/python3.9/site-packages/click/core.py", line 1137, in call
return self.main(*args, **kwargs)
File "/home/hook/.local/lib/python3.9/site-packages/click/core.py", line 1062, in main
rv = self.invoke(ctx)
File "/home/hook/.local/lib/python3.9/site-packages/click/core.py", line 1668, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/hook/.local/lib/python3.9/site-packages/click/core.py", line 1668, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/hook/.local/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/hook/.local/lib/python3.9/site-packages/click/core.py", line 763, in invoke
return _callback(*args, **kwargs)
File "/home/hook/.local/lib/python3.9/site-packages/neotools/cli.py", line 120, in read_file
commands.read_file(applet_id, file_name_or_space, path, format)
File "/home/hook/.local/lib/python3.9/site-packages/neotools/commands.py", line 18, in new_func
result = f(*args, **kwargs)
File "/home/hook/.local/lib/python3.9/site-packages/neotools/commands.py", line 87, in read_file
with Device.connect() as device:
File "/usr/lib/python3.9/contextlib.py", line 117, in enter
return next(self.gen)
File "/home/hook/.local/lib/python3.9/site-packages/neotools/device.py", line 35, in connect
device.init(flip_to_comms)
File "/home/hook/.local/lib/python3.9/site-packages/neotools/device.py", line 54, in init
if self.dev.is_kernel_driver_active(0):
File "/home/hook/.local/lib/python3.9/site-packages/usb/core.py", line 1107, in is_kernel_driver_active
self._ctx.managed_open()
File "/home/hook/.local/lib/python3.9/site-packages/usb/core.py", line 113, in wrapper
return f(self, *args, **kwargs)
File "/home/hook/.local/lib/python3.9/site-packages/usb/core.py", line 131, in managed_open
self.handle = self.backend.open_device(self.dev)
File "/home/hook/.local/lib/python3.9/site-packages/usb/backend/libusb1.py", line 804, in open_device
return _DeviceHandle(dev)
File "/home/hook/.local/lib/python3.9/site-packages/usb/backend/libusb1.py", line 652, in init
_check(_lib.libusb_open(self.devid, byref(self.handle)))
File "/home/hook/.local/lib/python3.9/site-packages/usb/backend/libusb1.py", line 604, in _check
raise USBError(_strerror(ret), ret, _libusb_errno[ret])
usb.core.USBError: [Errno 13] Access denied (insufficient permissions)
When I type in my terminal "sudo neotools files read 1", after typing in my password, I get:
Traceback (most recent call last):
File "/home/hook/.local/bin/neotools", line 5, in
from neotools.cli import cli
ModuleNotFoundError: No module named 'neotools'
Any help would be greatly appreciated. Thanks.
Thanks so much for this tool! It seems like a much better solution than sending via the keyboard, which is quite slow.
However, I am finding that when attempting to read the text in file 8, I am getting an old version.
I'll look into the issue more, but I was curious if you had any ideas.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.