datasheet 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733
  1. =================================================================================
  2. ================================ ATTENTION! =================================
  3. =================================================================================
  4. = =
  5. = 0483:2016 STMicroelectronics Biometric Coprocessor =
  6. = This driver was written to work on Sony VGN-UX1XRN. =
  7. = Testing and debugging was carried out only on this model. =
  8. = =
  9. =================================================================================
  10. This is a kind of datasheet. I tried to fill in all the necessary information here
  11. to work with the fingerprint scanner. Please note that the information was obtained
  12. mainly from the Wireshark program by intercepting and analyzing packets over the
  13. USB bus, which are transmitted by the original driver from under Windows.
  14. Therefore, the information may not be accurate. Some of the information was taken
  15. from the source code of the libfprint and thinkfinger projects.
  16. Apparently, even though the VID:PID matches of the fingerprint scanner, they have
  17. a different fingerprint coprocessor and scanner, so the driver may not work with
  18. all models.
  19. Also see:
  20. file> lsusb_output
  21. file> pgm.html
  22. site> http://netpbm.sourceforge.net/doc/pgm.html
  23. =================================================================================
  24. ============================= PROTOCOL OVERVIEW =============================
  25. =================================================================================
  26. The general model of communication between the host and the scanner resembles the
  27. usual OSI model:
  28. Commands and data are transmitted over the messages.
  29. Messages are transmitted over the packets.
  30. Packets are transmitted over the USB bulk transfers.
  31. Packets and messages have auxiliary fields, such as length, flags, etc. Big message
  32. may be spit into several packet and big packet may be split into several USB bulk
  33. transfers. I noticed that in the packet header the data is in big-endian byte order,
  34. while in the message headers and message body the data is in little-endian byte
  35. order. This is another similarity with a regular network.
  36. Communication between the host and the scanner takes place using USB bulk endpoints.
  37. Here is a description of USB endpoints:
  38. Endpoint Descriptor:
  39. bLength 7
  40. bDescriptorType 5
  41. bEndpointAddress 0x81 EP 1 IN
  42. bmAttributes 2
  43. Transfer Type Bulk
  44. Synch Type None
  45. Usage Type Data
  46. wMaxPacketSize 0x0040 1x 64 bytes
  47. bInterval 0
  48. Endpoint Descriptor:
  49. bLength 7
  50. bDescriptorType 5
  51. bEndpointAddress 0x02 EP 2 OUT
  52. bmAttributes 2
  53. Transfer Type Bulk
  54. Synch Type None
  55. Usage Type Data
  56. wMaxPacketSize 0x0040 1x 64 bytes
  57. bInterval 0
  58. Note that these endpoints has wMaxPacketSize is 64 bytes. Therefore, large packets
  59. must be received and transmitted in parts of 64 bytes.
  60. =================================================================================
  61. =============================== PACKET FORMAT ===============================
  62. =================================================================================
  63. <PREFIX> <HEADER>
  64. 0x43 0x69 0x61 0x6f 0xAB 0xCD 0xEF <MESSAGE> <CRC>
  65. ------------------- -------------- --------- -----
  66. | | | \
  67. ================= | ======================= ======================
  68. = "Ciao" prefix = | = Body of the message = = UDF-CRC16 checksum =
  69. = ( 4 bytes ) = | = ( <LENGTH> bytes ) = = ( 2 bytes ) =
  70. ================= | ======================= ======================
  71. |
  72. ===============================
  73. = 0xAB - <TYPE> ( 1 byte ) =
  74. = С - <COUNTER> ( 4 bits ) =
  75. = DEF - <LENGTH> ( 12 bits ) =
  76. ===============================
  77. <PREFIX>
  78. It is string "Ciao". All packages start with this prefix.
  79. Note that the prefix is not null-terminated.
  80. <TYPE>
  81. Indicates the type of packet. See "SERVICE MESSAGES" chapter.
  82. <COUNTER>
  83. When the host sends a command to the device, this field is used as a counter.
  84. It starts at 0 and increases by 1 with each new command. After reaching the
  85. value F, the counter is reset to zero and starts from 0. When the device responds
  86. to a host request, the value of this counter remains the same as in the request.
  87. An interesting fact: during the experiments, I tried to increase the counter
  88. value by more than 1. The sensor did not perceive this as an error. When I
  89. tried to send requests without changing the counter value, it led to an error.
  90. From my experiments, I conclude that with each request, the value of this field
  91. must be changed, the value of the field itself does not matter.
  92. Also see "SERVICE MESSAGES" chapter.
  93. <LENGTH>
  94. The length of the <MESSAGE> in bytes. Big-endian: D - MSB, F - LSB.
  95. It looks like the maximum packet length is 2043 bytes (this is not a typo).
  96. <MESSAGE>
  97. Message body <LENGTH> bytes long. The message format is described below.
  98. <CRC>
  99. UDF-CRC16 checksum. Calculated for the entire packet, excluding the prefix and CRC.
  100. After sending a command from the host, the device responds with another message
  101. indicating the completion of the command, including any requested data.
  102. =================================================================================
  103. ============================= MESSAGE FORMAT ===============================
  104. =================================================================================
  105. This section describes the format of messages when the <TYPE> field of the
  106. package = 0. When the driver is sending commands as above, and when the device
  107. is responding, the <MESSAGE> seems to follow this structure:
  108. <FLAG> L1 L2 <STATUS> <SUBCMD> <MSGDATA>
  109. ------ ----- -------- -------- ---------
  110. ( 1 byte ) | ( 2 bytes ) ( 1 byte ) data
  111. |
  112. <MSGLEN>
  113. ( 2 bytes )
  114. <FLAG>
  115. If the entire message fits into 1 packet, then this field will have the value 0x28.
  116. If the message is too large to fit into one packet, then it is split into several
  117. packets. In the first packet, this field will have the value 0x2c. If the packet
  118. is not the first and not the last, then this field will have the value 0x24. In
  119. the last packet, the value of this field will be 0x20. If the message is split
  120. into several packets, then to receive the next packet, the receiving side must
  121. send 1 byte with the value 0x30 as a response to the command.
  122. Note that the <MSGLEN>, <STATUS> and <SUBCMD> fields are only present in the
  123. first packet of the message. If the message is divided into several packets, then
  124. the remaining packets contain only <FLAG> and <MSGDATA>.
  125. <MSGLEN>
  126. Length of <STATUS> + <SUBCMD> + <MSGDATA> in bytes.
  127. Little-endian: L1 - LSB, L2 - MSB.
  128. <STATUS>
  129. If the request is executed without errors, then this field has the value 0x00 0x00.
  130. If an error occurs, then there will be a nonzero value.
  131. <SUBCMD>
  132. Subcommand. In the device's response to a command, the subcommand code will be
  133. unchanged. The description of most of the subcommands, the purpose of which I was
  134. able to understand, is given later in this document. Subcommand list:
  135. 0x01, 0x02 FLASH MEMORY ACCESS
  136. 0x0b, 0x0c RAM ACCESS
  137. 0x0e IMAGE CAPTURE
  138. 0x10 UNKNOWN ACTION 1
  139. 0x12 TOUCHPAD MODE
  140. 0x15 IMAGE QUALITY
  141. 0x16 IDLE MODE
  142. <First byte of MSGDATA>
  143. I noticed in this field a certain pattern that fits in most cases. When the
  144. host sends a request to the scanner, it usually sets the value here so that
  145. MSB = 0 and LSB != 0, for example 0x02. When the scanner responds to a request,
  146. it increments this field by 0x10. For example, for a 0x02 request, the scanner
  147. will return a 0x12 response.
  148. =================================================================================
  149. ============================== CONTROL REGISTER ==============================
  150. =================================================================================
  151. The control register is accessed via the USB control endpoint.
  152. Read control ( 8 bytes )
  153. bmRequestType 0xc0
  154. bRequest 4
  155. wValue 0
  156. wIndex 0
  157. wLength 8
  158. The control register is 8 bytes in size:
  159. <ZEROS> <STATE>
  160. <ZEROS>
  161. The first 4 bytes are always 0x00.
  162. At least, in my experiments, I did not see any other values here.
  163. <STATE>
  164. The last 4 bytes indicate the state the finger scanner is in. Here are some of
  165. the values that I was able to see and roughly understand their meaning:
  166. on power on:
  167. { 0x40 0xb0 0x00 0x30 }
  168. after init cmd 0x0400:
  169. { 0x40 0xa8 0x00 0x30 }
  170. in idle state:
  171. { 0x00 0x80 0x03 0x30 }
  172. on swiped in idle mode
  173. { 0x40 0xa8 0x02 0x30 }
  174. There are some other possible values, but I'm not 100% sure what they mean, so
  175. I'm not listing them here. Full list in the protocol.h.
  176. Write control ( 2 bytes )
  177. bmRequestType 0x40
  178. bRequest 12
  179. wValue 0x0100
  180. wIndex <CMD>
  181. wLength 1
  182. data { 0x00 }
  183. <CMD>
  184. 0x0400 reset and init
  185. 0x0601 wake up
  186. 0x0602 go to idle
  187. =================================================================================
  188. ================================= INTERRUPT =================================
  189. =================================================================================
  190. The fingerprint scanner has an interrupt IN endpoint, here is its description:
  191. bLength 7
  192. bDescriptorType 5
  193. bEndpointAddress 0x83 EP 3 IN
  194. bmAttributes 3
  195. wMaxPacketSize 0x0004 1x 4 bytes
  196. bInterval 20
  197. Thanks to this, host do not need to constantly poll the scanner, instead, host can
  198. send an interrupt request and wait for a response. I noticed that when an interrupt
  199. occurs, it returns the 4 low bytes from the control register. In some cases, this
  200. can eliminate the need to request data from the control register.
  201. When the scanner is in standby mode, it can detect touch. When this happens, the
  202. scanner will return an interrupt with the following data
  203. { 0x40 0xa8 0x02 0x30 }
  204. The scanner then automatically tries to scan the fingerprint. This interrupt must
  205. be handled. If this is not done, then after a few seconds the scanner will reset.
  206. =================================================================================
  207. ============================ SERVICE MESSAGES ===============================
  208. =================================================================================
  209. If packet has <TYPE> = 0, then it common packet, and <COUNTER> used as packet
  210. sequence counter. If packet has <TYPE> != 0, then it service packet, and <COUNTER>
  211. must be = 0.
  212. Types 0x03, 0x04 and 0x05 descibed int the "FINGERPRINT SCANNER INIT" chapter.
  213. Type 0x0b described in the "TOUCHPAD MODE" chapter.
  214. This chapter describes 0x08 and 0x09 types.
  215. Sometimes on read data from scanner he will answer with packet like this:
  216. <TYPE> - 0x08, <LENGTH> - 0
  217. Host must be answer this:
  218. <TYPE> - 0x09, <LENGTH> - 0
  219. In most cases, this happens before the scanner actually starts transmitting the
  220. finger image. I guess one should always be ready to handle packet type 0x08.
  221. In the course of my experiments, I had cases when the scanner hung up and
  222. constantly sent a packet with type 0x08. The host must take this into account and
  223. be prepared to act if the scanner freezes. For example, the host may initialize
  224. the scanner again.
  225. =================================================================================
  226. ======================== FINGERPRINT SCANNER INIT ===========================
  227. =================================================================================
  228. After power on or if something going wrong scanner need to be init.
  229. 1) Write 0x0400 to the control register. After that scanner will reset and control
  230. register have the value is { 0x40 0xa8 0x00 0x30 }.
  231. 2) Read packet from scanner. Packet has be like this:
  232. type - 0x03, data - { 0x01 0x62 0x30 0x2e 0x32 }
  233. 3) Send packet to scanner:
  234. type - 0x04, data - { 0x01 0x00 0xbc 0x02 0x00 0x00 0x00 0x00 }
  235. 4) Read packet from scanner:
  236. type - 0x05, data - { 0x01 }
  237. 5) After that basic init must be done. Then there are several packages, the purpose
  238. of which is not completely clear. I'm assuming it has something to do with data
  239. encryption, because the contents of these packages change each time. I haven't been
  240. able to figure this out, so I just send the packets that I was able to capture with
  241. Wireshark and it doesn't seem to throw any errors. This step cannot be skipped as
  242. without it, the scanner does not work correctly.
  243. See protocol.h "3-way challenge-response authentication" comment.
  244. 6) See RAM chapter.
  245. =================================================================================
  246. ============================ FLASH MEMORY ACCESS ============================
  247. ============================= subcmd 0x01, 0x02 =============================
  248. =================================================================================
  249. The fingerprint scanner has its own non-volatile memory that can be accessed for
  250. reading and writing. I have read several different datasheets for different Upek
  251. products. They mention memory of several hundred bytes and support for external
  252. memory chips up to 64 kilobytes. In our particular case, the scanner seems to have
  253. at least 349 bytes of internal memory and 8 kilobytes of external memory.
  254. In what follows, I will call the built-in memory FB-region, and the external -
  255. FC-region. I decided to call them that because it corresponds to the byte value
  256. in the command that accesses the memory. Here are the commands themselves:
  257. Flash write:
  258. request: 0x01 0x04 <RE> 0x58 0xc4 0x63 L1 L2 0x00 0x00 <DATA>
  259. answer: 0x01 0x14
  260. ---- ---------------------------------------------------
  261. <SUBCMD> <MSGDATA>
  262. Flash read:
  263. request: 0x02 0x04 <RE> 0x58 0xc4 0x63
  264. answer: 0x02 0x14 L1 L2 0x00 0x00 <DATA>
  265. ---- --------------------------------
  266. <SUBCMD> <MSGDATA>
  267. <RE>
  268. Region. 0xfb (small built-in) or 0xfc (big external 8kb).
  269. L1 L2
  270. Data length. Little-endian: L1 is LSB, L2 is MSB. I suspect that the next 2 zeros
  271. are L3 and L4, but I haven’t come across such large values in practice, so I
  272. don’t claim.
  273. Details
  274. Apparently, there is no way to specify a specific address in memory to perform
  275. read or write operations. A read operation returns all data in the specified region.
  276. The write operation overwrites the entire region. After a successful write, the
  277. region will contain only the data that was written by the write command. The region
  278. can be cleared by writing 0 bytes to it. Also way to clear the memory, which is
  279. given to me, is to go into the BIOS and clear the memory from there (yes, there
  280. is a corresponding menu item there). At least the original Windows driver writes
  281. in large blocks. For example, it overwrites the entire 0xFB region, even though
  282. it actually only changes two bytes there.
  283. 0xFB-region
  284. So far I have not figured out what is stored in this area. The intercepted packets
  285. show the word "TBXLITE". I didn’t go deep into the study of this format. I think
  286. I'll deal with it later. I can mention a few here. First: after clearing memory
  287. from BIOS, this region is not empty and contains data. Second: at the first boot
  288. into Windows, the driver reads this region and overwrites it, changing two bytes.
  289. Third, this memory always stores 349 bytes of data. I don’t know the exact size
  290. of this memory and didn’t check it. I am afraid of disrupting the operation of
  291. the scanner. I can also note that the data in this area does not change depending
  292. on the number of added fingerprints in Windows.
  293. 0xFC-region
  294. This region is about 8 kilobytes in size. This region is clean after clearing
  295. memory from the BIOS menu. Windows can store fingerprints here. Each fingerprint
  296. uses 372 bytes. Windows says it can store up to 21 prints. It is not yet clear if
  297. the scanner can use these fingerprints on its own. I think that any data can be
  298. stored in this area without fear of damaging the fingerprint scanner.
  299. =================================================================================
  300. ==================================== RAM ====================================
  301. ============================== subcmd 0x0b, 0x0c ============================
  302. =================================================================================
  303. I have every reason to believe that this memory is operational, so I decided to
  304. call it that. This memory always contains 96 bytes of data. The true meaning of
  305. all this data can only be guessed at. The only thing I managed to find out is the
  306. assignment of the penultimate byte in this data.
  307. Ram write
  308. request: 0x0b 0x04 0x03 0x00 0x00 0x00 0x60 0x00 0x00 0x00 <DATA>
  309. answer: 0x0b 0x14
  310. ---- ---------------------------------------------------
  311. <SUBCMD> <MSGDATA>
  312. Ram read
  313. request: 0x0c 0x04 0x03 0x00 0x00 0x00
  314. answer: 0x0c 0x14 0x60 0x00 0x00 0x00 <DATA>
  315. ---- -------------------------------
  316. <SUBCMD> <MSGDATA>
  317. <0x03 0x00 0x00 0x00>
  318. It is logical to assume that this is a region of memory, but this is not accurate.
  319. <0x60 0x00 0x00 0x00>
  320. Length of data - 96 bytes.
  321. <penultimate byte of DATA>
  322. This byte somehow affects the operation of the scanner when scanning a finger. If
  323. this byte has a value of 0x00, then during a finger scan (subcmd 0x0e), the
  324. scanner will report the full set of flags (see IMAGE CAPTURE chapter). The
  325. original Windows driver sets this byte to 0x00 only during the registration of a
  326. new finger. For the rest of the time this byte is set to 0x01.
  327. In general, the algorithm of actions is something like this:
  328. 1) During initialization, read all memory and save to buffer.
  329. 2) Change the penultimate byte to 0x01 and write the contents of the buffer to
  330. memory.
  331. 3) Before scanning a finger, if you need a full set of flags, set the
  332. penultimate byte to 0x00 and write it to memory.
  333. 4) After scanning, set the penultimate byte to 0x01 and write to memory.
  334. =================================================================================
  335. =============================== IMAGE CAPTURE ===============================
  336. ================================ subcmd 0x0e ================================
  337. =================================================================================
  338. The scanner can transmit fingerprints as a PGM image. Image size is 144x270,
  339. 38880 bytes, 1 byte per pixel. PGM format is described here:
  340. http://netpbm.sourceforge.net/doc/pgm.html
  341. Just in case, I saved that page as an HTML file. There are two ways to get an
  342. image from the scanner: wait for an interrupt or explicitly request a scan. Getting
  343. an image by interruption is described in the section idle mode. This section describes
  344. polling image acquisition.
  345. Switching the scanner to scanning mode is performed by the following command:
  346. 0x0e 0x02 0xc0 0xd4 0x01 0x00 0x02 <DETECT> 0x00
  347. ---- -------------------------------------------
  348. subcmd msgdata
  349. <DETECT>
  350. The scanner can handle situations where the user is not swiping the finger
  351. correctly over the scanner. This flag indicates the mode of operation. If the
  352. flag is set to 0x00, then this function is disabled. If the flag is set to
  353. 0x01, then this feature is enabled. Windows uses this when registering a new
  354. fingerprint.
  355. After switching to scan mode, the scanner will wait while the user swipes over
  356. the scanner. The response from the scanner will indicate the current status:
  357. 0x00 0x20 0x01 0x00 0x00 0x00 <FLAG> 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
  358. ---- -----------------------------------------------------------------------
  359. subcmd msgdata
  360. <FLAG>
  361. The value of this byte allows host to assess the situation and take appropriate
  362. action. For example, tell the user that he is doing something wrong. Note that
  363. the set of states returned will differ depending on which value of the <DETECT>
  364. byte was set when the scanner was put into scan mode. Also see RAM chapter.
  365. Known values:
  366. 0x00 - Get ready, next response will be with picture
  367. 0x07 - User slid their finger too far to the left
  368. 0x08 - User slid their finger too far to the right
  369. 0x0c - User has not swiped the scanner yet
  370. 0x0b - The quality of the fingerprint is poor
  371. 0x0f - User swiped the scanner incorrectly
  372. 0x1c - User swiped the scanner too quickly
  373. 0x1d - The finger slid strongly horizontally
  374. 0x1e - User swiped the scanner too short
  375. To continue polling the scanner, the host must send the command:
  376. 0x00 0x30 <CONTINUE>
  377. ---- ---------------
  378. subcmd msgdata
  379. <CONTINUE>
  380. This field indicates the intent of the host. If the host wants to continue
  381. polling, then the value in this field must be set to 0x01. If the host wants to
  382. stop polling and exit the scan mode, then this field must be set to 0x00.
  383. When something happens, the scanner will send a corresponding response to the request.
  384. When the user swiped the scanner correctly:
  385. 0x0e 0x12 0xe0 0x97 0x00 0x00 <picture>
  386. ---- ----------------------------------
  387. subcmd msgdata
  388. <0xe0 0x97>
  389. Length of picture in bytes. 0x97e0 = 38880 bytes.
  390. When the scan was canceled during polling:
  391. 0xe4 0xfb 0x0e 0x12
  392. --------- ---- ----
  393. status subcmd msgdata
  394. If the user does not swipe the finger correctly for 2 minutes (timeout):
  395. 0xe6 0xfb 0x0e 0x12
  396. --------- ---- ----
  397. status subcmd msgdata
  398. After receiving any of these three responses, the scanner is in normal mode and
  399. can process other commands as usual.
  400. =================================================================================
  401. ============================== UNKNOWN ACTION 1 =============================
  402. ================================ subcmd 0x10 ================================
  403. =================================================================================
  404. In some cases, after receiving the fingerprint image from the scanner, the
  405. original Windows driver fulfills this request. It is not clear what this does, but
  406. the scanner works fine without it.
  407. request: 0x10 0x02 0x64 0x00 0x00 0x00 0x00 0x00 0x00 0x00
  408. ---- --------------------------------------------
  409. <SUBCMD> <MSGDATA>
  410. answer: 0x00 0x00 0x10 0x12
  411. --------- ---- ----
  412. <STATUS> <SUBCMD> <MSGDATA>
  413. If success, then <STATUS> will be 0x00 0x00.
  414. On failed, <STATUS> will be 0xe6, 0xfb.
  415. Perhaps there are other values of failure, but I have not met.
  416. =================================================================================
  417. =============================== TOUCHPAD MODE ===============================
  418. ================================ subcmd 0x12 ================================
  419. =================================================================================
  420. The fingerprint scanner can work in touchpad mode. To activate the touchpad mode,
  421. send the subcmd 0x12 to the scanner.
  422. request: 0x12 0x02 0xff 0xff 0xff 0xff
  423. ---- ------------------------
  424. <SUBCMD> <MSGDATA>
  425. If everything went well, the scanner will go into touchpad mode and the next
  426. response from the scanner will correspond to the touchpad protocol ( protocol
  427. description below ), otherwise, something went wrong.
  428. Errors.
  429. In the course of my experiments, I had unsuccessful attempts to start the operation
  430. in touchpad mode. In those cases, I received the following response from the scanner:
  431. 0xea 0xfb 0x12 0x12
  432. --------- ---- ----
  433. <STATUS> <SUBCMD> <MSGDATA>
  434. Touchpad protocol:
  435. The response header is always the same:
  436. <TYPE> = 0x0b
  437. <COUNTER> = 0
  438. <LENGTH> = 6
  439. <MESSAGE> format is
  440. 0xAA 0x00 0xCC 0xDD 0xEE 0xFF
  441. ---- ---- --------- ---------
  442. <STATE> <??> <X AXIS> <Y AXIS>
  443. 1 byte 1 byte 2 bytes 2 bytes
  444. <STATE>
  445. This field is a finger detector. Possible values:
  446. No finger 0x00
  447. Finger is present 0x01
  448. Tap (as on touchpad) 0x02
  449. In some cases, the value 0x03 appears. I do not fully understand
  450. when this happens. Perhaps there may be other meanings here.
  451. <??>
  452. Unknown field. During my experimentation, I have always seen the value 0x00 here.
  453. <X AXIS> and <Y AXIS>
  454. Litle-endian signed short ( 0xCC and 0xEE is LSB, 0xDD and 0xFF is MSB ).
  455. Examples of values:
  456. <X AXIS> 0xCC 0xDD
  457. swipe left 0х23 0x00 (+)
  458. swipe right 0xf7 0xff (-)
  459. <Y AXIS> 0xEE 0xFF
  460. swipe up 0x0a 0x00 (+)
  461. swipe down 0xfa 0xff (-)
  462. Touchpad protocol: request
  463. The request header is always the same too:
  464. <TYPE> = 0x0b
  465. <COUNTER> = 0
  466. <LENGTH> = 1
  467. <MESSAGE> format is:
  468. <CONTINUE>
  469. 1 byte
  470. <CONTINUE>
  471. A flag that tells the scanner the intent of the host. If the host wishes to continue
  472. working in touchpad mode, then it sets the value of this flag to 0x01. In this case,
  473. the next response from the fingerprint reader will follow the format described above.
  474. If the host wishes to stop working in touchpad mode, then the value of this flag is
  475. set to 0x00. In this case, the fingerprint scanner will return a response to 0x12
  476. subcmd:
  477. answer: 0x12 0x12
  478. ---- ----
  479. <SUBCMD> <MSGDATA>
  480. =================================================================================
  481. =============================== IMAGE QUALITY ===============================
  482. ================================ subcmd 0x15 ================================
  483. =================================================================================
  484. After receiving fingerprint image from the fingerprint scanner, host can request
  485. quality of received image. Actually, I'm just assuming that the value indicate the
  486. quality of the picture.
  487. request: 0x15 0x02
  488. answer: 0x15 0x12 <QUALITY> 0x00 0x00 0x00
  489. ---- -----------------------------
  490. <SUBCMD> <MSGDATA>
  491. <QUALITY>
  492. 1 byte. values 0x00-0x64 (0-100).
  493. Seems little-endian int (4 bytes), but this is only an assumption. In practice, the
  494. remaining bytes are always zeros.
  495. =================================================================================
  496. ================================= IDLE MODE =================================
  497. ================================ subcmd 0x16 ================================
  498. =================================================================================
  499. If at the moment host do not need to work with the scanner, then host can send it
  500. to standby mode. In this mode, it does not need to be polled. It probably also
  501. consumes less power in this mode. In standby mode, the scanner can signal a touch
  502. with a USB interrupt. If such an interrupt occurs, then it must be processed,
  503. otherwise the scanner will reboot in a few seconds and go into an uninitialized
  504. state. The sequence of actions to put the scanner into standby mode:
  505. 1) Send the command:
  506. 0x16 0x02 0xf4 0x01 0x00 0x00 0x02 0x00 0x00
  507. ---- ---------------------------------------
  508. subcmd msgdata
  509. 2) Write command 0x0602 to control register.
  510. 3) Send USB interrupt transfer. Note that a response to an interrupt transfer
  511. may return immediately with the following data:
  512. { 0x00 0x80 0x03 0x30 }
  513. This is fine. In response to this, another interrupt transfer must be sent.
  514. The scanner should now be in standby mode. The scanner can exit the standby mode
  515. in two cases: the user touched the scanner, or a command to wake up was sent to
  516. the scanner. Here is the sequence of commands to wake up from standby:
  517. 1) Write 0x0601 to control register
  518. 2) Read standby command response:
  519. 0x16 0x12 0x00 0x00 0x00 0x00 0x01 0x00 0x00 0x00
  520. ---- --------------------------------------------
  521. subcmd msgdata
  522. In the process of waking up interrupt transfer will return one of the
  523. following states:
  524. { 0x40 0xa8 0x00 0x30 }
  525. { 0x40 0xb0 0x00 0x30 }
  526. There is no need to send the next interrupt transfer in response to this
  527. interrupt. The scanner can then receive and process other commands as usual.
  528. In the event that an interruption occurs, the sequence of actions is weaving:
  529. 1) Wait for interruption
  530. 2) If the interrupt returned data not { 0x40 0xa8 0x02 0x30 }, ignore it and
  531. send the new interrupt transfer and go to step 1.
  532. 3) If the interrupt returned data { 0x40 0xa8 0x02 0x30 }, this means that the
  533. user has swiped his finger over the scanner and he has data. In this case, the
  534. procedure is as follows:
  535. > Write 0x0601 to control register.
  536. > Read standby command response.
  537. If there was an error while scanning, then the answer may be like this:
  538. 0xef 0xfb 0x16 0x12
  539. 0xe6 0xfb 0x16 0x12
  540. --------- ---- ----
  541. status subcmd msgdata
  542. I have noticed that this happens if I touch the bezel without touching the
  543. scanner itself. If need to go to standby mode again, then follow the procedure
  544. that was indicated at the very beginning.
  545. If everything went well, then the answer will be:
  546. 0x16 0x12 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0e 0x97 0x00 0x00 <picture>
  547. ---- --------------------------------------------------------------------------
  548. subcmd msgdata
  549. <0x0e 0x97>
  550. Length of picture. Little-endian. 0x97e0 = 38880 bytes length.
  551. The image format and commands will be described in the corresponding section.
  552. Also see "IMAGE QUALITY" chapter. After receiving the image, the scanner is
  553. in working mode and can continue to execute commands as usual. If need to go
  554. to standby mode again, then follow the procedure that was indicated at the
  555. very beginning.