@@ -146,13 +146,12 @@ void goodix_receive_reset(FpDevice *dev, guint8 *data, guint16 length,
146146 cb_info -> user_data , NULL );
147147}
148148
149- void goodix_receive_preset_psk_read_r (FpDevice * dev , guint8 * data ,
150- guint16 length , gpointer user_data ,
151- GError * error ) {
152- guint32 psk_r_len ;
149+ void goodix_receive_preset_psk_read (FpDevice * dev , guint8 * data , guint16 length ,
150+ gpointer user_data , GError * error ) {
151+ guint32 psk_len ;
153152 g_autofree GoodixCallbackInfo * cb_info = user_data ;
154- GoodixPresetPskReadRCallback callback =
155- (GoodixPresetPskReadRCallback )cb_info -> callback ;
153+ GoodixPresetPskReadCallback callback =
154+ (GoodixPresetPskReadCallback )cb_info -> callback ;
156155
157156 if (error ) {
158157 callback (dev , FALSE, 0x00000000 , NULL , 0 , cb_info -> user_data , error );
@@ -161,7 +160,7 @@ void goodix_receive_preset_psk_read_r(FpDevice *dev, guint8 *data,
161160
162161 if (length < sizeof (guint8 )) {
163162 g_set_error (& error , G_IO_ERROR , G_IO_ERROR_INVALID_DATA ,
164- "Invalid preset PSK read R reply length: %d" , length );
163+ "Invalid preset PSK read reply length: %d" , length );
165164 callback (dev , FALSE, 0x00000000 , NULL , 0 , cb_info -> user_data , error );
166165 return ;
167166 }
@@ -171,33 +170,32 @@ void goodix_receive_preset_psk_read_r(FpDevice *dev, guint8 *data,
171170 return ;
172171 }
173172
174- if (length < sizeof (guint8 ) + sizeof (GoodixPresetPskR )) {
173+ if (length < sizeof (guint8 ) + sizeof (GoodixPresetPsk )) {
175174 g_set_error (& error , G_IO_ERROR , G_IO_ERROR_INVALID_DATA ,
176- "Invalid preset PSK read R reply length: %d" , length );
175+ "Invalid preset PSK read reply length: %d" , length );
177176 callback (dev , FALSE, 0x00000000 , NULL , 0 , cb_info -> user_data , error );
178177 return ;
179178 }
180179
181- psk_r_len =
182- GUINT32_FROM_LE (((GoodixPresetPskR * )(data + sizeof (guint8 )))-> length );
180+ psk_len =
181+ GUINT32_FROM_LE (((GoodixPresetPsk * )(data + sizeof (guint8 )))-> length );
183182
184- if (length < psk_r_len + sizeof (guint8 ) + sizeof (GoodixPresetPskR )) {
183+ if (length < psk_len + sizeof (guint8 ) + sizeof (GoodixPresetPsk )) {
185184 g_set_error (& error , G_IO_ERROR , G_IO_ERROR_INVALID_DATA ,
186- "Invalid preset PSK read R reply length: %d" , length );
185+ "Invalid preset PSK read reply length: %d" , length );
187186 callback (dev , FALSE, 0x00000000 , NULL , 0 , cb_info -> user_data , error );
188187 return ;
189188 }
190189
191- callback (
192- dev , TRUE,
193- GUINT32_FROM_LE (((GoodixPresetPskR * )(data + sizeof (guint8 )))-> flags ),
194- data + sizeof (guint8 ) + sizeof (GoodixPresetPskR ), psk_r_len ,
195- cb_info -> user_data , NULL );
190+ callback (dev , TRUE,
191+ GUINT32_FROM_LE (((GoodixPresetPsk * )(data + sizeof (guint8 )))-> flags ),
192+ data + sizeof (guint8 ) + sizeof (GoodixPresetPsk ), psk_len ,
193+ cb_info -> user_data , NULL );
196194}
197195
198- void goodix_receive_preset_psk_write_r (FpDevice * dev , guint8 * data ,
199- guint16 length , gpointer user_data ,
200- GError * error ) {
196+ void goodix_receive_preset_psk_write (FpDevice * dev , guint8 * data ,
197+ guint16 length , gpointer user_data ,
198+ GError * error ) {
201199 g_autofree GoodixCallbackInfo * cb_info = user_data ;
202200 GoodixSuccessCallback callback = (GoodixSuccessCallback )cb_info -> callback ;
203201
@@ -208,7 +206,7 @@ void goodix_receive_preset_psk_write_r(FpDevice *dev, guint8 *data,
208206
209207 if (length < sizeof (guint8 )) {
210208 g_set_error (& error , G_IO_ERROR , G_IO_ERROR_INVALID_DATA ,
211- "Invalid preset PSK write R reply length: %d" , length );
209+ "Invalid preset PSK write reply length: %d" , length );
212210 callback (dev , FALSE, cb_info -> user_data , error );
213211 return ;
214212 }
@@ -873,43 +871,43 @@ void goodix_send_tls_successfully_established(FpDevice *dev,
873871 GOODIX_TIMEOUT , FALSE, NULL , NULL );
874872}
875873
876- void goodix_send_preset_psk_write_r (FpDevice * dev , guint32 flags , guint8 * psk_r ,
877- guint16 length , GDestroyNotify free_func ,
878- GoodixSuccessCallback callback ,
879- gpointer user_data ) {
874+ void goodix_send_preset_psk_write (FpDevice * dev , guint32 flags , guint8 * psk ,
875+ guint16 length , GDestroyNotify free_func ,
876+ GoodixSuccessCallback callback ,
877+ gpointer user_data ) {
880878 // Only support one flags, one payload and one length
881879
882- guint8 * payload = g_malloc (sizeof (GoodixPresetPskR ) + length );
883- GoodixPresetPskR * preset_psk_r = (GoodixPresetPskR * )payload ;
880+ guint8 * payload = g_malloc (sizeof (GoodixPresetPsk ) + length );
881+ GoodixPresetPsk * preset_psk = (GoodixPresetPsk * )payload ;
884882 GoodixCallbackInfo * cb_info ;
885883
886- preset_psk_r -> flags = GUINT32_TO_LE (flags );
887- preset_psk_r -> length = GUINT32_TO_LE (length );
888- memcpy (payload + sizeof (GoodixPresetPskR ), psk_r , length );
889- if (free_func ) free_func (psk_r );
884+ preset_psk -> flags = GUINT32_TO_LE (flags );
885+ preset_psk -> length = GUINT32_TO_LE (length );
886+ memcpy (payload + sizeof (GoodixPresetPsk ), psk , length );
887+ if (free_func ) free_func (psk );
890888
891889 if (callback ) {
892890 cb_info = malloc (sizeof (GoodixCallbackInfo ));
893891
894892 cb_info -> callback = G_CALLBACK (callback );
895893 cb_info -> user_data = user_data ;
896894
897- goodix_send_protocol (dev , GOODIX_CMD_PRESET_PSK_WRITE_R , payload ,
895+ goodix_send_protocol (dev , GOODIX_CMD_PRESET_PSK_WRITE , payload ,
898896 sizeof (payload ) + length , g_free , TRUE, GOODIX_TIMEOUT ,
899- TRUE, goodix_receive_preset_psk_write_r , cb_info );
897+ TRUE, goodix_receive_preset_psk_write , cb_info );
900898 return ;
901899 }
902900
903- goodix_send_protocol (dev , GOODIX_CMD_PRESET_PSK_WRITE_R , payload ,
901+ goodix_send_protocol (dev , GOODIX_CMD_PRESET_PSK_WRITE , payload ,
904902 sizeof (payload ) + length , g_free , TRUE, GOODIX_TIMEOUT ,
905903 TRUE, NULL , NULL );
906904}
907905
908- void goodix_send_preset_psk_read_r (FpDevice * dev , guint32 flags , guint16 length ,
909- GoodixPresetPskReadRCallback callback ,
910- gpointer user_data ) {
911- GoodixPresetPskR payload = {.flags = GUINT32_TO_LE (flags ),
912- .length = GUINT32_TO_LE (length )};
906+ void goodix_send_preset_psk_read (FpDevice * dev , guint32 flags , guint16 length ,
907+ GoodixPresetPskReadCallback callback ,
908+ gpointer user_data ) {
909+ GoodixPresetPsk payload = {.flags = GUINT32_TO_LE (flags ),
910+ .length = GUINT32_TO_LE (length )};
913911 GoodixCallbackInfo * cb_info ;
914912
915913 if (callback ) {
@@ -918,13 +916,13 @@ void goodix_send_preset_psk_read_r(FpDevice *dev, guint32 flags, guint16 length,
918916 cb_info -> callback = G_CALLBACK (callback );
919917 cb_info -> user_data = user_data ;
920918
921- goodix_send_protocol (dev , GOODIX_CMD_PRESET_PSK_READ_R , (guint8 * )& payload ,
919+ goodix_send_protocol (dev , GOODIX_CMD_PRESET_PSK_READ , (guint8 * )& payload ,
922920 sizeof (payload ), NULL , TRUE, GOODIX_TIMEOUT , TRUE,
923- goodix_receive_preset_psk_read_r , cb_info );
921+ goodix_receive_preset_psk_read , cb_info );
924922 return ;
925923 }
926924
927- goodix_send_protocol (dev , GOODIX_CMD_PRESET_PSK_READ_R , (guint8 * )& payload ,
925+ goodix_send_protocol (dev , GOODIX_CMD_PRESET_PSK_READ , (guint8 * )& payload ,
928926 sizeof (payload ), NULL , TRUE, GOODIX_TIMEOUT , TRUE, NULL ,
929927 NULL );
930928}
0 commit comments