Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre Companion

Notices

Reply
 
Thread Tools Search this Thread
Old 08-21-2017, 10:02 AM   #16
chaley
CC Android & calibre dev
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 8,489
Karma: 2568044
Join Date: Jan 2010
Location: France
Device: Many android devices
Quote:
Originally Posted by Wryhder View Post
Yes, an android update. Never had that problem until I updated.
Quote:
Originally Posted by Wryhder View Post
Stock version. There's no update available for my device.
Ahh, then in post 9 you meant a CC Android update. Sorry for my misunderstanding.
chaley is offline   Reply With Quote
Advert
Old 08-21-2017, 10:12 AM   #17
Wryhder
Member
Wryhder began at the beginning.
 
Posts: 19
Karma: 10
Join Date: Oct 2016
Device: Samsung Galaxy Note 10.1 (GT-N8013)
I didn't realize there was a misunderstanding on your part.
I should have been more specific. My apologies.
Wryhder is offline   Reply With Quote
Old 08-23-2017, 12:42 AM   #18
Wryhder
Member
Wryhder began at the beginning.
 
Posts: 19
Karma: 10
Join Date: Oct 2016
Device: Samsung Galaxy Note 10.1 (GT-N8013)
Hello.
I've got the files.
There's something about a 'port 54982'.
Attached Files
File Type: txt debug log.txt (10.0 KB, 23 views)
File Type: txt debug device detection.txt (2.0 KB, 19 views)
Wryhder is offline   Reply With Quote
Old 08-23-2017, 06:01 AM   #19
chaley
CC Android & calibre dev
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 8,489
Karma: 2568044
Join Date: Jan 2010
Location: France
Device: Many android devices
Quote:
Originally Posted by Wryhder View Post
Hello.
I've got the files.
There's something about a 'port 54982'.
The device debug log tells us what you already said, there isn't another device interfering with CC connecting.

The debug log tells us that CC is able to ask calibre if it is there. The sequence that CC uses is:
  • Broadcast on the network to see if there is an instance of calibre there.
  • Calibre answers (we hope)
  • CC connects to the IP address that calibre supplies
We see that calibre did see the broadcast and did (try to) answer. We know from the CC debug logs that CC receives that answer. The relevant lines in the log look like this:
Code:
SMART_DEV (  39.22: 37.046) run received broadcast ('localhost', ('192.168.0.101', 54982)) calibre wireless device client (on XXXXX);8080,9090
What we do not see is calibre accepting the connection from CC. That implies (strongly) that something on your laptop is blocking incoming connections on port 9090. It could be the wireless router, but that would require some strange firewall rules on the router. If you have set up any port forwarding rules on your router you might want to take a look at them to see if any of them apply to port 9090.

One way to test the above hypothesis - that something is blocking incoming connections - is to connect to calibre using a web browser. It would be 2-step test. The first step is to connect from the localhost -- the laptop itself -- to avoid the router and the incoming firewall. Open a web browser on the laptop and connect to 127.0.0.1:9090. When I do that on my laptop I get the following lines in the calibre debug log, which up to the last line are what should appear when CC connect.
Code:
SMART_DEV (  15.14: 13.011) run attempt to open device socket
SMART_DEV (  15.18:  0.034) open
SMART_DEV (  15.19:  0.001) _call_client GET_INITIALIZATION_INFO wfr True
SMART_DEV (  15.21:  0.006) _receive_from_client protocol error -- empty json string
SMART_DEV (  15.23:  0.000) _call_client other exception
If this doesn't work then the blockage is at the socket level. It could mean that something else has force-opened the port 9090, that the firewall blocks all connections regardless of whether they are local, or who-knows what.

Assuming that the first step works, the second step is to try the same thing from the web browser on your device. Open that browser and connect to 192.168.0.100:9090. You should see exactly the same messages in the debug log.

If connecting from your device using the web browser generates those lines then the only possibility left is that something in calibre is preventing the wireless device driver from "seeing" the connection request in the 5 seconds that CC is willing to wait. If this is the case I could give you a version of CC that waits for much longer, say 30 seconds, to see if the problem is simply one of time. We will cross this bridge when we come to it.

If the first step does not work then one possibility is to change CC's port to something way up in the not-normally-used range, for example 42876, then try the same steps. You change CC's port by stopping the wireless device driver (calibre / Connect/Share) then starting it again. You will see a dialog where you can set the port.

BTW: the Similar Stories plugin you have installed is broken. I is still using the old version of the graphic toolkit QT.

I wonder what all those XmbTextListToTextProperty result code -2 lines are, and what side effects, if any, the error might have.
chaley is offline   Reply With Quote
Old 08-23-2017, 09:59 AM   #20
Wryhder
Member
Wryhder began at the beginning.
 
Posts: 19
Karma: 10
Join Date: Oct 2016
Device: Samsung Galaxy Note 10.1 (GT-N8013)
First step didn't work. I changed the port too.
No port forwarding rules. My router's more 3g WiFi Dongle. Can be used as both a modem and router. Pretty basic settings on its webpage.

I don't think it's the firewall as it's turned off, but perhaps I should read up on it.

BTW, anything more than 32000 (port number) is invalid according to Calibre.
Also, removed the Similar Stories plugin.
Attached Files
File Type: txt debug log_port 9090.txt (5.9 KB, 26 views)
File Type: txt debug log_port 29158.txt (6.1 KB, 18 views)

Last edited by Wryhder; 08-23-2017 at 10:12 AM. Reason: added the last two lines
Wryhder is offline   Reply With Quote
Old 08-23-2017, 01:13 PM   #21
chaley
CC Android & calibre dev
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 8,489
Karma: 2568044
Join Date: Jan 2010
Location: France
Device: Many android devices
Quote:
Originally Posted by Wryhder View Post
First step didn't work. I changed the port too.
No port forwarding rules. My router's more 3g WiFi Dongle. Can be used as both a modem and router. Pretty basic settings on its webpage.
The first step, 127.0.0.1, won't go through the dongle.
Quote:
I don't think it's the firewall as it's turned off, but perhaps I should read up on it.
*Something* on the laptop is blocking TCP connections.
Quote:
BTW, anything more than 32000 (port number) is invalid according to Calibre.
I have no idea why I put that restriction in.

It is time to check some really basic things. The examples, when I can provide them, are from my debian VPS.

Open a terminal and run netstat. Verify that calibre is actually listening on the port and that the listening ip address is 0.0.0.0.
Code:
www:~# netstat -t -l -p -v
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
[...]
tcp        0      0 *:9192                  *:*                     LISTEN      14151/calibre-serve
tcp        0      0 localhost:mysql         *:*                     LISTEN      14735/mysqld    
[...]
Verify that the port isn't being blocked at a base level (iptables):
Code:
iptables -L -vn > aaaaa
Open the file aaaaa (or whatever you called it) and look through what you have. If iptables is being used then there should be rules like the following.
Code:
Chain net2fw (1 references)
 pkts bytes target     prot opt in     out     source               destination
 508K   29M ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:80 /* HTTP */
You are looking for rules that do something with 127.0.0.1 or dpt:9090

As far as I can tell, Ubuntu uses the firewall ufw. I don't use ufw so I can't provide any examples. ufw can do process-based filtering. Try the commend
Code:
ufw status
to get a general list of what the firewall is doing.

Try running the command
Code:
ufw app list
to see if calibre is one of the apps that is being managed.
chaley is offline   Reply With Quote
Old 08-23-2017, 03:32 PM   #22
chaley
CC Android & calibre dev
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 8,489
Karma: 2568044
Join Date: Jan 2010
Location: France
Device: Many android devices
Also, just to make sure that the web browser works the way we expect, start calibre then in the web browser try to open 127.0.0.1:8080. That should open the content server. CC can see that so it should be visible from the laptop.
chaley is offline   Reply With Quote
Old 08-30-2017, 09:54 PM   #23
Wryhder
Member
Wryhder began at the beginning.
 
Posts: 19
Karma: 10
Join Date: Oct 2016
Device: Samsung Galaxy Note 10.1 (GT-N8013)
Quote:
Originally Posted by chaley View Post
Also, just to make sure that the web browser works the way we expect, start calibre then in the web browser try to open 127.0.0.1:8080. That should open the content server. CC can see that so it should be visible from the laptop.
Sorry about my late reply. I've been away from my pc the past few days so I couldn't run those commands.

The web browser works as it should.
Attached Files
File Type: txt ufw commands_and_output.txt (33.1 KB, 21 views)
Wryhder is offline   Reply With Quote
Old 08-31-2017, 05:07 AM   #24
chaley
CC Android & calibre dev
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 8,489
Karma: 2568044
Join Date: Jan 2010
Location: France
Device: Many android devices
Quote:
Originally Posted by Wryhder View Post
Sorry about my late reply. I've been away from my pc the past few days so I couldn't run those commands.

The web browser works as it should.
OK, we know now that the UFW firewall is on. We also know that the calibre wireless device is listening on port 9090. I also note that you added some firewall rules, which might change things.

A few posts back you said that "the first step didn't work". I want to be sure that that means the same thing for both of us.

If on your laptop in a web browser you connect to 127.0.0.1:9090 you should see something like the following (I am using Chrome). Note the "invalid response".
Click image for larger version

Name:	Clipboard01.jpg
Views:	24
Size:	37.7 KB
ID:	158757

If you connect to 127.0.0.1:9091 (an invalid port) you should see something like this. Note that "site cannot be reached".
Click image for larger version

Name:	Clipboard02.jpg
Views:	23
Size:	46.1 KB
ID:	158758

If you get "site cannot be reached" with port 9090 then something on your laptop is blocking that port. That "something" is local to the machine because 127.0.0.1 addresses do not go through the external network.

If you get "invalid response" with port 9090 then try the same thing from your Android device, but using 192.168.... (the laptop's IP address) instead of 127.0.0.1. If you don't get "invalid response" then something on your network is blocking access to that port. That "something" can be your router, the dongle, or the firewall.

If you get "invalid response" then try CC. It should work.
chaley is offline   Reply With Quote
Old 08-31-2017, 07:02 AM   #25
Wryhder
Member
Wryhder began at the beginning.
 
Posts: 19
Karma: 10
Join Date: Oct 2016
Device: Samsung Galaxy Note 10.1 (GT-N8013)
Quote:
If you get "site cannot be reached" with port 9090 then something on your laptop is blocking that port. That "something" is local to the machine because 127.0.0.1 addresses do not go through the external network.
I'm getting "site cannot be reached". I tried a different port (8085, made sure it was free), still the same.
I'll stick with the new port.
I think this means the problem isn't with the port (I've tried various ports over the past few weeks) or firewall. Perhaps I should re-install Calibre.
Wryhder is offline   Reply With Quote
Old 08-31-2017, 07:54 AM   #26
chaley
CC Android & calibre dev
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 8,489
Karma: 2568044
Join Date: Jan 2010
Location: France
Device: Many android devices
Quote:
Originally Posted by Wryhder View Post
I'm getting "site cannot be reached". I tried a different port (8085, made sure it was free), still the same.
I'll stick with the new port.
I think this means the problem isn't with the port (I've tried various ports over the past few weeks) or firewall. Perhaps I should re-install Calibre.
I am 99% certain that the problem is not with calibre. The netstat command showed that calibre is listening on the port, just it is on port 8080, yet the browser cannot connect to it. That says that something running on your laptop is blocking connections from localhost (127.0.0.1:whatever) to localhost (127.0.0.1:9090 or whatever port).

An experiment you can try: turn off the content server, assign port 8080 to the wireless device, then see what happens. Do any experiments work? My guess is yes. If so, you can assign 8081 (or something) to the content server and see if that still works.
chaley is offline   Reply With Quote
Old 08-31-2017, 09:44 AM   #27
Wryhder
Member
Wryhder began at the beginning.
 
Posts: 19
Karma: 10
Join Date: Oct 2016
Device: Samsung Galaxy Note 10.1 (GT-N8013)
Quote:
An experiment you can try: turn off the content server, assign port 8080 to the wireless device, then see what happens. Do any experiments work? My guess is yes. If so, you can assign 8081 (or something) to the content server and see if that still works.
Okay, so I changed the port to 8085 for the content server and gave 8080 to the wireless device. This page (accessing wireless device, 127.0.0.1:8080) loaded like it was the content server, only that my books could not load.

Image 1
Spoiler:

Image 1
Spoiler:


I still couldn't access it from CC or my mobile web browser ("site cannot be reached").
I found these lines in /etc/services/, so that's probably normal?
Code:
http-alt	8080/tcp	webcache	# WWW caching service
http-alt	8080/udp
BTW, I could access the server just fine from 8085, from CC and pc web browser.

Last edited by chaley; 08-31-2017 at 11:12 AM.
Wryhder is offline   Reply With Quote
Old 08-31-2017, 11:33 AM   #28
chaley
CC Android & calibre dev
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 8,489
Karma: 2568044
Join Date: Jan 2010
Location: France
Device: Many android devices
Quote:
Originally Posted by Wryhder View Post
Okay, so I changed the port to 8085 for the content server and gave 8080 to the wireless device. This page (accessing wireless device, 127.0.0.1:8080) loaded like it was the content server, only that my books could not load.
The calibre content server stuff is probably in the browser's cache.

The second image says that the request timed out, so it failed to connect instead of connecting and getting "wrong" data.
Quote:
I still couldn't access it from CC or my mobile web browser ("site cannot be reached").
I found these lines in /etc/services/, so that's probably normal?
Code:
http-alt	8080/tcp	webcache	# WWW caching service
http-alt	8080/udp
BTW, I could access the server just fine from 8085, from CC and pc web browser.
I have only one more thing to suggest. Although I have no idea why this would be happening, it is possible that the WD connection "listen" is somehow getting confused in python or in linux. One possible fix: tell calibre to listen on a specific IP address, in your case the public IP address of the laptop 192.168.0.100. To do this, in calibre go to Preferences / Plugins. Search for SmartDevice. Click on "Customize Plugin". Paste the laptop's IP address into the "Use this IP address" box. Press OK until you are back to calibre, then stop and restart the wireless device. At this point connecting from a web browser on the laptop should not work. Connecting from your device might work.
chaley is offline   Reply With Quote
Old 09-01-2017, 01:58 AM   #29
Wryhder
Member
Wryhder began at the beginning.
 
Posts: 19
Karma: 10
Join Date: Oct 2016
Device: Samsung Galaxy Note 10.1 (GT-N8013)
Quote:
I have only one more thing to suggest. Although I have no idea why this would be happening, it is possible that the WD connection "listen" is somehow getting confused in python or in linux. One possible fix: tell calibre to listen on a specific IP address, in your case the public IP address of the laptop 192.168.0.100. To do this, in calibre go to Preferences / Plugins. Search for SmartDevice. Click on "Customize Plugin". Paste the laptop's IP address into the "Use this IP address" box. Press OK until you are back to calibre, then stop and restart the wireless device. At this point connecting from a web browser on the laptop should not work. Connecting from your device might work.
Didn't work, but thanks . I appreciate all the help.
I'll keep working on it. If I somehow stumble on a fix, I'll make sure to post it here.

Last edited by Wryhder; 09-01-2017 at 02:00 AM.
Wryhder is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Android] Calibre companion debug log waldoB Calibre Companion 4 12-27-2016 09:35 AM
[Android] CC Change Log chaley Calibre Companion 2 01-25-2013 06:27 AM
Log in from Android Tablet Quelch Android Devices 5 01-14-2013 11:29 PM
Is there a log reader TonyP123 Calibre 4 03-09-2012 08:44 PM


All times are GMT -4. The time now is 03:28 PM.


MobileRead.com is a privately owned, operated and funded community.