I’ve been waiting and watching the eReader world for some time now, waiting for the price (for a half decent product) to drop below about £100. The Kindle 3, starting at £109, was close enough for me to preorder one – although I actually ended up being swayed by the allure of the 3G version at £149.
While waiting for it to arrive I installed the Calibre eBook manager on my Ubuntu 10.04 (Lucid Lynx) system from the repositories and went trotting off to download a bunch of out-of-copyright classics. The new Kindle arrived yesterday, so I plugged it into my machine, fired up Calibre, told it to send the eBooks to the reader… and got an error message.
The problem is that the Kindle 3 is supported on the latest version of Calibre (0.7.16) but of course the version in the Ubuntu repositories is far older than that (0.6.42). Even the version in the Maverick repository is too old (0.7.13). One obvious answer would be to download the source of the newest version from the Calibre site and build it myself, but where possible I prefer to stick to software from the official repositories so that I get automatic updates.
A bit of googling resulted in the answer in this forum thread: the changes to support a Kindle 3 are fairly trivial and only occur in one Python file, so it’s very easy to modify an installed 0.6.42 version. When Ubuntu pushes updates I’ll simply tell it to keep my modified file until they push a version >0.7.16, and which point I’ll let it get replaced with the official repository version.
So for anyone in a similar situation, here’s the step-by-step guide to getting the version of Calibre in the Ubuntu Lucid repositories to support a Kindle 3:
- Install Calibre from the Universe repository using your package manager of choice. You can click on this link and open with “apturl” to achieve the same effect: apt://calibre
- Press ALT-F2 to bring up a “Run Application” dialogue.
- Copy and paste the following line into that dialogue:
gksudo gedit /usr/lib/calibre/calibre/devices/kindle/driver.py
- Enter your password when prompted and you should see “gedit” (text editor) open with the file ready for editing.
- Scroll to the bottom of the file.
- Copy and paste the following code at the end of the file:
class KINDLE2(KINDLE): name = 'Kindle 2/3 Device Interface' description = _('Communicate with the Kindle 2/3 eBook reader.') FORMATS = KINDLE.FORMATS + ['pdf'] PRODUCT_ID = [0x0002,0x0004] BCD = [0x0100]
- Save the file and quit “gedit”.
- Launch Calibre from the Applications=>Office menu and start managing your eBook collection for your Kindle 3.
Note that I’m no Python programmer, but my reading of the code suggests that this change might stop Calibre working with a Kindle 2 as it appears to override the existing KINDLE2 class. So if you’ve got both a Kindle 2 and a Kindle 3 and want to use Calibre with both you’re probably better off downloading the latest version and building from the source.
[Edit: Kevin Philp has added a comment which contains the code to support both the Kindle 2 and 3; the code above has been updated accordingly. Note that as I only have a Kindle 3 I haven’t been able to test this, so please do comment if this does or doesn’t work for you]
Worked perfectly. Thank you.
If Ubuntu send Calibre updates will I be offered the option to keep the modified file?
I believe it should identify that you’ve modified the file and offer you the option to keep the existing version, install the package maintainer’s version, or look at the differences between the files. Until the new version is >0.7.16 (which I would guess/hope it will be by the time Maverick Meerkat ships) then keep the old version of the file, otherwise update to the package maintainer’s version.
If you pick the wrong option, or experience problems, you can always use Synaptic to completely reinstall the application and then re-apply this fix if necessary.
Thanks a lot!
Worked perfectly – thanks for taking the time to write this up.
thanks Mark!
thanks so much dude.
Thanks, just got my Kindle 3 today, calibre recognises it now, much easier than messing about copying files using nautilus or using email!
I can’t say thank you enough.. I have spent hours trying to update to the latest version with no luck.. Your workaround worked perfectly!
Thanks a lot!
For the record my new Kindle 3 works fine with the version of Calibre in the latest Ubuntu version (10.10) How to add books to a kindle using Calibre on Linux
Cool, thanks for the info. I loaded my Kindle with so many out-of-copyright books when I first received it that I haven’t needed to go anywhere near Calibre to load more since then, so haven’t tried it in 10.10 myself yet.
SO glad you wrote this guide. Easy to follow and to the point.
Thank you VERY much.
Thanks a lot, Mark! 🙂
Mille gracie!
Worked like a dream. Many thanks for having taken the time to sort this. I only received my K3 yesterday and this has helped tremendously.
Worked perfectly thanks very much!
Thank you, you may now call upon me at any time and I will fight in your honor to return the favour.
thanks !!
Thanks A LOT!!!!!
To get the Kindle 2 and three working together modify the KINDLE2 class as follows in the driver.py file. This is copied direct from 7.16 driver file and is the modification the developer applied to get kindle3 working.
class KINDLE2(KINDLE):
name = ‘Kindle 2/3 Device Interface’
description = _(‘Communicate with the Kindle 2/3 eBook reader.’)
FORMATS = KINDLE.FORMATS + [‘pdf’]
PRODUCT_ID = [0x0002, 0x0004]
BCD = [0x0100]
Thanks for that info – I’ve only got a K3 myself, but hopefully it might help someone else out so I’ve updated the original post with this code.
Thanks a lot for the simple and effective fix. I was installing Calibre in my daughter’s computer and your advice made my day.
Thanks!
Hi,
I’ve tried the mod of calibre config for kindle 3…
but when I upload the file there is the left margin yet.
Anyone can help me ?
thanks
Hi,
I’m read from another web sitewww.mobileread.com a way to fix the margin problem.
“It’s ok I just fixed it by converting to PDB and then To MOBI Miles easier than messing about with authoring software Came out perfect too.”
It works!
bye
I added the following instead and it works well:
class KINDLE3(KINDLE):
name = ‘Kindle 3 Device Interface’
description = _(‘Communicate with the Kindle 3 eBook reader.’)
FORMATS = KINDLE.FORMATS + [‘pdf’]
PRODUCT_ID = [0x0004]
BCD = [0x0100]
Thanks for the information. For most people I would still recommend the code in the article (taken from Kevin Philp’s comment), as this is how it’s implemented in later Calibre releases and I prefer to stay as close to the standard code as possible when making my own local edits.
sorry for the stupid question (i’m a linux newbie and i’m just seeing calibre for the first time too):
is there a way i can get calibre to show my kindle books the way the “kindle for pc” software shows it to me, i.e. directly taking them from my amazon account, without me having to connect the kindle reader to copy them locally to my pc?
Hey, thanks a lot !
Just edited the python file as indicated and worked for me.
ubuntu 10.04, python 2.6.5, Caliber 0.6.42, PC Intel CoreDuo 32bits
Thank you!
It is not hard at all to install the latest calibre on Ubtuntu 10.04. So there’s no need to ‘hack’ the old one.
I just installed it without any problems at all using these instructions:
http://ubuntuguide.net/calibre-install-the-ebook-management-in-ubuntu-linux
Just thought I’d share it here, since this is the first page I found on Kindle 3 + Ubuntu 10.04.
BTW: I did also first try the instruction to ‘hack’ the version that ships with 10.04 presented here. They do work so thanks for the info, but I think its still overall a better option to install a later version of Calibre proper.
” … is there a way i can get calibre to show my kindle books the way the “kindle for pc” software shows it to me, i.e. directly taking them from my amazon account, without me having to connect the kindle reader to copy them locally to my pc?”
I don’t think there is an easy way. But you can actually install Kindle for PC and run it in Linux using Wine (or so I heard :-). But I think that’s not as easy as you might want it to be.
If you want to give it a try google ‘Wine Kindle’
E.g. this one:
http://lifehacker.com/5406505/run-kindle-for-pc-in-linux-with-wine
Thanks for that link – hopefully it will help other people who find this page. My post pre-dates that one, which would explain why I didn’t find that solution when I was looking originally 😉
The one advantage that “hacking” the old one has is that it’s still essentially using the version from the Ubuntu repositories, so updating to a later Ubuntu release will also update Calibre. I don’t think either approach is technically any easier or harder, so it’s down to the individual user as to whether they want the latest Calibre, but it won’t auto-update, or to use the instructions here to modify the repository version which will then auto-update with future releases of Ubuntu. It’s always good to have more options though.
Thanks they works very well for me.
What a wonderful discovery. I have spent hours on this – you are so clever. Many thanks indeed, it works perfectly now.
Sallymc
Thank you SO MUCH for this 🙂
Thank you! I have the same OS (10.04 LucidLynx) than my brother and the same kindle, but my calibre didn’t detect the ebook. He provably installed the last version, but I didn’t notice ^^