Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 12-02-2023, 02:01 AM   #1
xxyzz
Evangelist
xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.
 
Posts: 413
Karma: 2666666
Join Date: Nov 2020
Device: none
How to upload file to Kindle Scribe?

I want to upload a file to path like `documents/book_name.sdr/LanguageLayer.en.asin.kll` and I'm using this code:

Code:
def upload_file_to_kindle_mtp(driver: Any, source_path: Path, dest_path: Path) -> None:
    storage = driver.filesystem_cache.storage(driver._main_id)
    parent = driver.ensure_parent(storage, dest_path.parts)
    with source_path.open("rb") as f:
        driver.put_file(parent, dest_path.parts[-1], f, source_path.stat().st_size)
    source_path.unlink()
the code works on Android device but can't upload files to scribe. Could someone point out why my code doesn't work?

Original code on GitHub: https://github.com/xxyzz/WordDumb/bl...e.py#L276-L284

Last edited by xxyzz; 12-02-2023 at 02:10 AM.
xxyzz is offline   Reply With Quote
Old 12-02-2023, 02:06 AM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
The scribe is an MTP device. I dont know of any reason it would work with an android mtp device and not the scribe.

Last edited by kovidgoyal; 12-02-2023 at 09:19 PM.
kovidgoyal is offline   Reply With Quote
Old 12-02-2023, 08:21 AM   #3
j.p.s
Grand Sorcerer
j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.
 
Posts: 5,285
Karma: 98804578
Join Date: Apr 2011
Device: pb360
I thought the scribe is a linux device.
j.p.s is offline   Reply With Quote
Old 12-02-2023, 01:50 PM   #4
Quoth
the rook, bossing Never.
Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.
 
Quoth's Avatar
 
Posts: 11,164
Karma: 85874891
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
Scribe is MTP and technically MTP is not do if the device is Android. It's a protocol MS developed for the Zune (from 2006 and Windows CE 6 embedded). I think up to Android 3 Google used Mass Storage and it's from 4.0 in 2011 that Android switched to MTP.

Perhaps Kovid meant MTP just like an Android device?

Quote:
In 2011, it became the standard method to transfer files to and from Android.
MTP is part of the "Windows Media" framework and thus closely related to Windows Media Player. Versions of the Microsoft Windows operating system from Windows XP SP2 support MTP. Windows XP requires Windows Media Player 10 or higher;[3] later Windows versions have built-in support. Microsoft has made an MTP Porting Kit available for older versions of Windows, back to Windows 98.
—Wikipedia https://en.wikipedia.org/wiki/Media_Transfer_Protocol

Last edited by Quoth; 12-02-2023 at 01:53 PM.
Quoth is offline   Reply With Quote
Old 12-02-2023, 07:19 PM   #5
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 35,464
Karma: 145525534
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Forma, Clara HD, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Quote:
Originally Posted by j.p.s View Post
I thought the scribe is a linux device.
A Scribe may be running a Linux OS but the USB connection was changed from USB mass storage to MTP in the last firmware update.
DNSB is offline   Reply With Quote
Old 12-03-2023, 11:51 AM   #6
j.p.s
Grand Sorcerer
j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.
 
Posts: 5,285
Karma: 98804578
Join Date: Apr 2011
Device: pb360
Quote:
Originally Posted by DNSB View Post
A Scribe may be running a Linux OS but the USB connection was changed from USB mass storage to MTP in the last firmware update.
That doesn't make it an android device.
j.p.s is offline   Reply With Quote
Old 12-03-2023, 12:33 PM   #7
Quoth
the rook, bossing Never.
Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.
 
Quoth's Avatar
 
Posts: 11,164
Karma: 85874891
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
Quote:
Originally Posted by j.p.s View Post
That doesn't make it an android device.
True, though means it behaves like Android since 4.x
Quoth is offline   Reply With Quote
Old 12-03-2023, 12:44 PM   #8
j.p.s
Grand Sorcerer
j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.
 
Posts: 5,285
Karma: 98804578
Join Date: Apr 2011
Device: pb360
Mischaracterizing a device can lead to confusion and other problems.
j.p.s is offline   Reply With Quote
Old 12-03-2023, 05:53 PM   #9
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 35,464
Karma: 145525534
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Forma, Clara HD, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Quote:
Originally Posted by DNSB View Post
A Scribe may be running a Linux OS but the USB connection was changed from USB mass storage to MTP in the last firmware update.
Quote:
Originally Posted by j.p.s View Post
That doesn't make it an android device.
Might I be so bold as to point that that I stated the Scribe as running a Linux OS? You don't need to be running Android for an MTP connection considering that the first time I ran into MTP was a Microsoft Zune music player back in 2008. This was a few years before 2011 when Android adopted MTP.
DNSB is offline   Reply With Quote
Old 12-03-2023, 11:52 PM   #10
xxyzz
Evangelist
xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.
 
Posts: 413
Karma: 2666666
Join Date: Nov 2020
Device: none
Could this have anything to do with the `@same_thread` decorator in the Windows MTP driver? But I don't find any `ThreadingViolation` exceptions in user posted logs.
xxyzz is offline   Reply With Quote
Old 12-04-2023, 12:52 AM   #11
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
My point was if its working for non-scribe mtp devices it should work the same for scribe they are identical as far as the mtp code is concerned. As for threading yes that's definitely a concern to upload a file you should relaly be submitting a job to the gui device manager rather than talking to the driver directly.
kovidgoyal is offline   Reply With Quote
Old 12-04-2023, 01:20 AM   #12
xxyzz
Evangelist
xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.
 
Posts: 413
Karma: 2666666
Join Date: Nov 2020
Device: none
I tested the code on Linux not Windows and the Linux MTP driver don't have this thread checking code, I guess this could be the culprit.
xxyzz is offline   Reply With Quote
Old 12-04-2023, 02:07 PM   #13
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 35,464
Karma: 145525534
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Forma, Clara HD, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Quote:
Originally Posted by xxyzz View Post
I tested the code on Linux not Windows and the Linux MTP driver don't have this thread checking code, I guess this could be the culprit.
One thing to remember is that unlike Windows, Linux and MacOS only allow a single connection to an MTP device. That seems to have bitten quite a few users of those OS when using an MTP device.
DNSB is offline   Reply With Quote
Old 12-04-2023, 07:53 PM   #14
xxyzz
Evangelist
xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.
 
Posts: 413
Karma: 2666666
Join Date: Nov 2020
Device: none
That's not a problem, the code only runs if calibre could connect to the device.
xxyzz is offline   Reply With Quote
Old 12-05-2023, 07:59 AM   #15
Quoth
the rook, bossing Never.
Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.
 
Quoth's Avatar
 
Posts: 11,164
Karma: 85874891
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
I have to stop (not kill as it will respawn) gvfs-mtp-volume-monitor on Linux Mint with Mate before I plug-in an MTP device. Setting MTP to not automount only seems to work (mostly) on Cinnamon, not Mate. Using "unmount" at GUI only works for some MTP devices, others won't communicate without cable re-plugged, which of course remounts it as a filesystem.
Quoth is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Troubleshooting cannot see highlights in book even if My Clippings file is intact [Kindle Scribe] dnn3 Amazon Kindle 3 06-07-2023 02:56 AM
Kindle fire webview camera file upload problem sluggo Kindle Fire 1 03-03-2016 01:29 PM
File Upload from WEbsite nbcauthor Related Tools 1 09-20-2013 07:57 AM
which file to upload dennis7450 Workshop 1 11-29-2011 02:20 PM
How to upload a eb1150 file? DaleDe Upload Help 11 09-01-2007 07:26 PM


All times are GMT -4. The time now is 09:17 AM.


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