Navigation

    全志在线开发者论坛

    • Register
    • Login
    • Search
    • Categories
    • Tags
    • 在线文档
    • 社区主页

    求助,触摸事件上报导致内核崩溃

    V Series
    2
    3
    1483
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      mysteryli LV 7 last edited by

      核心代码如下,内核报错内容晚点贴上,这么写看起来应该没啥问题吧

      	input_report_abs(ts_data->input_dev,ABS_X, 10);
      	input_report_abs(ts_data->input_dev,ABS_Y, 10);
      	input_report_abs(ts_data->input_dev,ABS_PRESSURE, 1);
      	input_report_key(ts_data->input_dev,BTN_TOUCH,1);
      
      	// //input_mt_sync_frame(ts_data->input_dev);
      	input_sync(ts_data->input_dev);
      	input_report_abs(ts_data->input_dev,ABS_PRESSURE, 0);
      	input_report_key(ts_data->input_dev,BTN_TOUCH,0);
      	input_sync(ts_data->input_dev);
      
      	INIT_DELAYED_WORK(&ts_data->poll_work, cst3xx_touch_report1);
      	//INIT_DELAYED_WORK(&poll_work, hyn_interrupt_handler);
      	schedule_delayed_work(&ts_data->poll_work,
      				msecs_to_jiffies(80));
      
      static void cst3xx_touch_report1(struct work_struct *work)
      {
      	u8 buf[5];
      	struct delayed_work *dw =
      		container_of(work, struct delayed_work, work);
      	struct hynitron_ts_data *ts_data =
      		container_of(dw, struct hynitron_ts_data, poll_work);
      	if( touch_flag ){
      		touch_flag = 0;
      		// int err = cst3xx_i2c_read_register(ts_data->client, 0x02,
      		// 	buf, 5);
      		// if ( err ){
      		// 	dev_err(&ts_data->client->dev, "cst3xx touch read failure %d\n",err);
      		// }
      		// printk("touch data is 0x%2x 0x%2x 0x%2x 0x%2x\r\n",buf[1],buf[2],buf[3],buf[4]);
      		cst3xx_touch_report(ts_data->client);
      	}
      	schedule_delayed_work(&ts_data->poll_work,
      			msecs_to_jiffies(80));
      }
      
      	input = devm_input_allocate_device(dev);
      	if (!input)
      		return -ENOMEM;
      
      	ts_data->input_dev = input;
      	input->name = client->name;
      	input->id.bustype = BUS_I2C;
      	set_bit(EV_ABS, input->evbit);
      	set_bit(EV_KEY, input->evbit);
      	set_bit(BTN_TOUCH, input->keybit);
      
      	input_set_abs_params(ts_data->input_dev, ABS_X,
      			     0, 240, 0, 0);
      	input_set_abs_params(ts_data->input_dev, ABS_Y,
      			     0, 280, 0, 0);
      	input_set_abs_params(ts_data->input_dev, ABS_PRESSURE,
      			     0, 1, 0, 0);
      
      	err = input_register_device(input);
      	if (err) {
      		dev_err(dev, "failed to register input device: %d\n", err);
      		return err;
      	}
      
      1 Reply Last reply Reply Quote Share 0
      • WhycanService
        WhycanService LV 8 last edited by

        崩溃的log有吗

        M 1 Reply Last reply Reply Quote Share 0
        • M
          mysteryli LV 7 @WhycanService last edited by

          @whycanservice 在 求助,触摸事件上报导致内核崩溃 中说:

          崩溃的log有吗

          我放弃了,因为我发现在中断中上报可以,在delay_work中调用上报就会有问题,不知道为什么

          1 Reply Last reply Reply Quote Share 0
          • 1 / 1
          • First post
            Last post

          Copyright © 2024 深圳全志在线有限公司 粤ICP备2021084185号 粤公网安备44030502007680号

          行为准则 | 用户协议 | 隐私权政策