kindle.device

Functions which can adjust specific device properties It also contains certain properties:

NameValueDescription
contactInfo'Your System Administrator'he who controls the sudo reports
eidBASE64 ENCODED DATAA piece base64 encoded data, unknown what purpose it serves
getRegistrationState'registered'Whether or not the Kindle is registered
hasScreenLighttrueWhether or not the Kindle has a screen light
hasKindleStoreAccesstrueWhether or not… the Kindle can… access the Kindle store? Seems to be used for parental controls?
isWirelessMenuEnabledtrueWhether the user has the wireless menu enabled or not
controlStatus0Whether the state is Parental/Device/No control - 1 if Device Control, 2 if Parental and 3 if No Control

kindle.device.setSensitivity

kindle.device.setSensitivity(useThreshold, threshold)

Sets the “sensitivity” of the eInk display according to a threshold. A threshold of 100 will cause the Kindle to refresh significantly more than a threshold of 0

Parameters:

NameTypeDescription
useThresholdBooleanWhether threshold should be used or whether to refresh like normal. If false, do not provide threshold
thresholdIntegerA number from 0-100 describing how often the eInk panel of the Kindle will “refresh”

kindle.device.setOrientation

kindle.device.setOrientation(orientation)

Sets the screen orientation of the device according to the provided orientation string. An invalid orientation will result in nothing happening. A list of valid strings can be found here

kindle.device.getDPI

kindle.device.getDPI()

Returns the DPI of the device

kindle.device.hasWirelessMenu

kindle.device.hasWirelessMenu()

Returns a boolean describing whether or not the device has a… wireless menu?

kindle.device.log

kindle.device.log(logServiceName, logString, logLevel)

Adds something to the Kindle’s log.

Parameters:

NameTypeDescription
logEventStringThe name of the “event” which is producing the log, ie: wafjs
logMsgStringThe data to be logged
logLevelStringThe log leve, valid values are: info, warn, error, debug, perf
Heads Up: Kindle logs **ARE** sent to Amazon, so be careful

kindle.device.getLab126SessionToken

kindle.device.getLab126SessionToken()

Returns the correct session token needed to access the internal DB API TBA

kindle.device.loadResource

kindle.device.loadResource(frameId, resourceId)

(taken from /opt/var/local/mesquite/shared/javascripts/userAgent.js)

Loads a local javascript file into any frame within the web application. It is used to override the xss security. The file that is loaded must be specified in the config.xml file of the application.

Parameters:

NameTypeDescription
frameIdStringThe DOM id of the frame in which the file will be loaded. The top level frame of the application can be specified via _self
resourceIdStringThe identifier of the JS File as specified in the application’s config.xml file, it must also reference a valid file on the local filesystem

kindle.device.addDomainToWhitelist

kindle.device.addDomainToWhitelist(uri, addSubDomains)

Adds a URI to the allowed domain list. It’s function is somewhat unknown…

Parameters:

NameTypeDescription
uriStringThe uri to add to the whitelist, ie: http://amazon.com
addSubDomainsStringA string, either 'true' or 'false' dictating whether or not subdomains of the specified uri should be whitelisted as well.

kindle.device.clearCookies

kindle.device.clearCookies()

Clears the application’s cookie jar

Using this function on Mesquito will clear **ALL** cookies accross **ALL** Mesquito apps and get your app **PERMANENTLY BLACKLISTED** by Mesquito. `You have been warned.`

kindle.device.clearApplicationCache

kindle.device.clearApplicationCache()

Clears the application’s HTML cache

Using this function on Mesquito has the chance of breaking `Mesquito` and will get your app **PERMANENTLY BLACKLISTED** by Mesquito. `You have been warned.`

kindle.device.clearCache

kindle.device.clearCache()

Clears any resources cached by the application in memory

Using this with a `Mesquito` app can cause bugs and be generally annoying, avoid its use when possible for `Mesquito` apps

kindle.device.getMPDomain

kindle.device.getMPDomain()

Gets the marketplace domain.

Fun fact, the firmware reffers to `".amazon.cn"` as the `CHINESE_OBFUSCATED_MARKETPLACE` when returned by this function

kindle.device.getBaiduSearchURL

kindle.device.getBaiduSearchURL()

Returns the Baidu Search URL I would assume… Returns the following string (at the time of writing):

https://www.baidu.com/s?tn=baiduhome_pg&ie=utf-8&rn=4&wd=

Example usage of format in firmware:

var dynUrlBaiduSearch = kindle.device.getBaiduSearchURL();
websiteUrl = dynUrlBaiduSearch ? dynUrlBaiduSearch + encodeURIComponent(args.label) : b.strings.goActions[args.domain].url + encodeURIComponent(args.label);

kindle.device.disableSecureApis

kindle.device.disableSecureApis()

Related to payment WAF, seems to disable “secure APIs” on non-Amazon URLs

kindle.device.isInDemoMode

kindle.device.isInDemoMode()

Returns a Boolean which is true if the device is in Demo mode.

kindle.device.getSoftwareVersionNumber

kindle.device.getSoftwareVersionNumber()

Returns an int representing the firmware’s version number. IE: 5.15.1.1 is 3924990005

kindle.device.getSoftwareVersionString

kindle.device.getSoftwareVersionString()

Returns the string representing the firmware’s version number. IE: "1.15.1.1"

kindle.device.getASRMode

kindle.device.getASRMode()

Returns a number. What it represents is currently unknown. Returns 0 on the Kindle it was tested on.

kindle.device.getCSSPixelsPerInch

kindle.device.getCSSPixelsPerInch()

Returns the number of CSS Pixels per Inch, presumably.

kindle.device.getBaiduSearchURL

kindle.device.getBaiduSearchURL()

Returns the Baidu Search URL I would assume… Returns the following string (at the time of writing):

https://www.baidu.com/s?tn=baiduhome_pg&ie=utf-8&rn=4&wd=

Example usage of format in firmware:

var dynUrlBaiduSearch = kindle.device.getBaiduSearchURL();
websiteUrl = dynUrlBaiduSearch ? dynUrlBaiduSearch + encodeURIComponent(args.label) : b.strings.goActions[args.domain].url + encodeURIComponent(args.label);