@@ -1112,6 +1112,41 @@ static int uclogic_params_parse_ugee_v2_desc(const __u8 *str_desc,
1112
1112
return 0 ;
1113
1113
}
1114
1114
1115
+ /**
1116
+ * uclogic_params_ugee_v2_init_frame_buttons() - initialize a UGEE v2 frame with
1117
+ * buttons.
1118
+ * @p: Parameters to fill in, cannot be NULL.
1119
+ * @desc_params: Device description params list.
1120
+ * @desc_params_size: Size of the description params list.
1121
+ *
1122
+ * Returns:
1123
+ * Zero, if successful. A negative errno code on error.
1124
+ */
1125
+ static int uclogic_params_ugee_v2_init_frame_buttons (struct uclogic_params * p ,
1126
+ const s32 * desc_params ,
1127
+ size_t desc_params_size )
1128
+ {
1129
+ __u8 * rdesc_frame = NULL ;
1130
+ int rc = 0 ;
1131
+
1132
+ if (!p || desc_params_size != UCLOGIC_RDESC_PH_ID_NUM )
1133
+ return - EINVAL ;
1134
+
1135
+ rdesc_frame = uclogic_rdesc_template_apply (
1136
+ uclogic_rdesc_ugee_v2_frame_btn_template_arr ,
1137
+ uclogic_rdesc_ugee_v2_frame_btn_template_size ,
1138
+ desc_params , UCLOGIC_RDESC_PH_ID_NUM );
1139
+ if (!rdesc_frame )
1140
+ return - ENOMEM ;
1141
+
1142
+ rc = uclogic_params_frame_init_with_desc (& p -> frame_list [0 ],
1143
+ rdesc_frame ,
1144
+ uclogic_rdesc_ugee_v2_frame_btn_template_size ,
1145
+ UCLOGIC_RDESC_V1_FRAME_ID );
1146
+ kfree (rdesc_frame );
1147
+ return rc ;
1148
+ }
1149
+
1115
1150
/**
1116
1151
* uclogic_params_ugee_v2_init() - initialize a UGEE graphics tablets by
1117
1152
* discovering their parameters.
@@ -1140,7 +1175,6 @@ static int uclogic_params_ugee_v2_init(struct uclogic_params *params,
1140
1175
const int str_desc_len = 12 ;
1141
1176
__u8 * str_desc = NULL ;
1142
1177
__u8 * rdesc_pen = NULL ;
1143
- __u8 * rdesc_frame = NULL ;
1144
1178
s32 desc_params [UCLOGIC_RDESC_PH_ID_NUM ];
1145
1179
__u8 magic_arr [] = {
1146
1180
0x02 , 0xb0 , 0x04 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00
@@ -1209,24 +1243,10 @@ static int uclogic_params_ugee_v2_init(struct uclogic_params *params,
1209
1243
p .pen .subreport_list [0 ].id = UCLOGIC_RDESC_V1_FRAME_ID ;
1210
1244
1211
1245
/* Initialize the frame interface */
1212
- rdesc_frame = uclogic_rdesc_template_apply (
1213
- uclogic_rdesc_ugee_v2_frame_btn_template_arr ,
1214
- uclogic_rdesc_ugee_v2_frame_btn_template_size ,
1215
- desc_params , ARRAY_SIZE (desc_params ));
1216
- if (!rdesc_frame ) {
1217
- rc = - ENOMEM ;
1246
+ rc = uclogic_params_ugee_v2_init_frame_buttons (& p , desc_params ,
1247
+ ARRAY_SIZE (desc_params ));
1248
+ if (rc )
1218
1249
goto cleanup ;
1219
- }
1220
-
1221
- rc = uclogic_params_frame_init_with_desc (& p .frame_list [0 ],
1222
- rdesc_frame ,
1223
- uclogic_rdesc_ugee_v2_frame_btn_template_size ,
1224
- UCLOGIC_RDESC_V1_FRAME_ID );
1225
- kfree (rdesc_frame );
1226
- if (rc ) {
1227
- uclogic_params_init_invalid (& p );
1228
- goto output ;
1229
- }
1230
1250
1231
1251
output :
1232
1252
/* Output parameters */
0 commit comments