View Single Post
Old 10-17-2024, 08:53 AM   #7
elinkser
Addict
elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.
 
Posts: 242
Karma: 146236
Join Date: Oct 2022
Device: Kobo Clara HD
I'm no networking guru, but I would just try and see what happens step-by-step, then focus on where the first error is found. Can follow steps below or the ones in the NiLuJe package...


Assuming you already have NickelMenu entries:

# display IP Address of Kobo
menu_item :main :IP Address :cmd_output :500:/sbin/ifconfig | /usr/bin/awk '/inet addr/{print substr($2,6)}'

# Toggle Kobo's telnet server
menu_item :main :Telnet (toggle) :cmd_output :500:quiet :/usr/bin/pkill -f "^/usr/bin/tcpsvd -E 0.0.0.0 2023"
chain_success:skip:5
chain_failure :cmd_spawn :quiet :/bin/mount -t devpts | /bin/grep -q /dev/pts || { /bin/mkdir -p /dev/pts && /bin/mount -t devpts devpts /dev/pts; }
chain_success :cmd_spawn :quiet :exec /usr/bin/tcpsvd -E 0.0.0.0 2023 /usr/sbin/telnetd -i -l /bin/login
chain_success :dbg_toast :Started Telnet server on port 2023
chain_failure :dbg_toast :Error starting Telnet server on port 2023
chain_always:skip:-1
chain_success :dbg_toast :Stopped Telnet server on port 2023

# Toggle KOReader's ssh server - not needed if you installed NiLuJe's kobo-stuffs ( https://www.mobileread.com/forums/sh...d.php?t=254214 )
menu_item :main :Dropbear (toggle) :cmd_output :500:quiet :/usr/bin/pkill -f "dropbear"
chain_success:skip:5
chain_failure :cmd_spawn :quiet :/bin/mount -t devpts | /bin/grep -q /dev/pts || { /bin/mkdir -p /dev/pts && /bin/mount -t devpts devpts /dev/pts; }
chain_success :cmd_spawn :quiet :export HOME="/mnt/onboard/.adds/koreader/" && cd "$HOME" && /mnt/onboard/.adds/koreader/scripts/dropbear -E -R -p2222 >/mnt/onboard/.adds/koreader/DropbearLog.txt 2>&1
chain_success :dbg_toast :Started Dropbear server on port 2222
chain_failure :dbg_toast :Error starting Dropbear server on port 2222
chain_always:skip:-1
chain_success :dbg_toast :Stopped Dropbox server on port 2222



Connect PC and Kobo to WiFi hotspot.

On Kobo, toggle telnet and SSH and display IP Address.

From PC, telnet to your Kobo e.g.:

$ telnet 192.168.43.5 2023
Trying 192.168.43.5...
Connected to 192.168.43.5.
Escape character is '^]'.
kobo login: root
Password:



Now, following the instructions from here, except skipping the modules part...
Hacking the Kobo Clara HD – 4.1: Telnet over USB
https://www.yingtongli.me/blog/2018/...elnet-usb.html


On my Clara HD, I need to install modules or else I get the following result:

# ifconfig usb0 192.168.2.2
ifconfig: SIOCSIFADDR: No such device


If modules exist or your kernel has the built-in capability (CONFIG_USB_U_ETHER=y implies built-in, =m implies module) hopefully you get something like:

# ifconfig usb0 192.168.2.2
# ifconfig
eth0 Link encap:Ethernet HWaddr 58:B0:D4:9B:DF:9A
inet addr:192.168.43.5 Bcast:192.168.43.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:598 errors:0 dropped:45 overruns:0 frame:0
TX packets:248 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:87662 (85.6 KiB) TX bytes:54544 (53.2 KiB)

usb0 Link encap:Ethernet HWaddr CA:79:8D:D4:F8:14
inet addr:192.168.2.2 Bcast:192.168.2.255 Mask:255.255.255.0
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)


***

EDIT :
* right after I loaded the modules, but BEFORE the "ifconfig usb0 192.168.2.2" command, the USB interface on the Kobo was logged as follows:

# dmesg | grep usb0
usb0: MAC CA:79:8D:D4:F8:14

i.e. the MAC address was assigned to a usb0 port before any ifconfig command was issued.

***

Now connect the USB cable between Kobo and PC.
Now on my Linux PC, the network applet icon on the desktop (/usr/bin/nm-applet from the network-manager-gnome package) would be a spinning progress bar, like it's trying to connect on ethernet.

I click this icon and choose "disconnect".

On PC I enter "sudo ifconfig usb0 192.168.2.1" and I am connected.
Somewhere in the desktop log I see, e.g.:
$ dmesg | grep usb
[ 4338.148728] usb 1-5: new high-speed USB device number 8 using xhci_hcd
[ 4338.299352] usb 1-5: New USB device found, idVendor=0525, idProduct=a4a2, bcdDevice= 4.01
[ 4338.299358] usb 1-5: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 4338.299361] usb 1-5: Product: RNDIS/Ethernet Gadget
[ 4338.299364] usb 1-5: Manufacturer: Linux 4.1.15-00136-g12655eaaef89 with 2184000.usb
[ 4338.302048] cdc_ether 1-5:1.0 usb0: register 'cdc_ether' at usb-0000:00:14.0-5, CDC Ethernet Device, ca:4c:4d:b9:93:af

And in the ifconfig I see:
usb0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.2.1 netmask 255.255.255.0 broadcast 192.168.2.255
ether ca:4c:4d:b9:93:af txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 41 bytes 6307 (6.1 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0


Now, if I am running an SSH server on the Kobo, then I can connect from the PC over USB, e.g.:

$ ssh root@192.168.2.2 -p 2222
[root@kobo ~]# uname -a
Linux kobo 4.1.15-00136-g12655eaaef89 #68 SMP PREEMPT Fri May 6 14:04:51 CST 2022 armv7l GNU/Linux

Last edited by elinkser; 10-17-2024 at 01:41 PM. Reason: usb0 MAC,steps
elinkser is offline   Reply With Quote