2565
- 收藏
- 点赞
- 分享
- 举报
鼠标层该怎么使用?
各位大神,请问hi3520d的鼠标该怎么用呢,现在要实现功能是在鼠标层显示鼠标,我的代码如下
[code]/* 1. open framebuffer device overlay 0 */
pstInfo->fd = open("/dev/fb3", O_RDWR, 0);
if(pstInfo->fd < 0)
{
printf("open %s failed!\n",file);
return HI_NULL;
}
bShow = HI_FALSE;
if (ioctl(pstInfo->fd, FBIOPUT_SHOW_HIFB, &bShow) < 0)
{
printf("FBIOPUT_SHOW_HIFB failed!\n");
return HI_NULL;
}
/* 2. set the screen original position */
stPoint.s32XPos = 150;
stPoint.s32YPos = 150;
if (ioctl(pstInfo->fd, FBIOPUT_SCREEN_ORIGIN_HIFB, &stPoint) < 0)
{
printf("set screen original show position failed!\n");
close(pstInfo->fd);
return HI_NULL;
}
#if 1
/* 3.set alpha */
stAlpha.bAlphaEnable = HI_FALSE;
stAlpha.bAlphaChannel = HI_FALSE;
stAlpha.u8Alpha0 = 0x0;
stAlpha.u8Alpha1 = 0xff;
stAlpha.u8GlobalAlpha = 0x80;
if (ioctl(pstInfo->fd, FBIOPUT_ALPHA_HIFB, &stAlpha) < 0)
{
printf("Set alpha failed!\n");
close(pstInfo->fd);
return HI_NULL;
}
#endif
/*all layer surport colorkey*/
stColorKey.bKeyEnable = HI_TRUE;
stColorKey.u32Key = 0x0;
if (ioctl(pstInfo->fd, FBIOPUT_COLORKEY_HIFB, &stColorKey) < 0)
{
printf("FBIOPUT_COLORKEY_HIFB!\n");
close(pstInfo->fd);
return HI_NULL;
}
/* 4. get the variable screen info */
if (ioctl(pstInfo->fd, FBIOGET_VSCREENINFO, &var) < 0)
{
printf("Get variable screen info failed!\n");
close(pstInfo->fd);
return HI_NULL;
}
/* 5. modify the variable screen info
the screen size: IMAGE_WIDTH*IMAGE_HEIGHT
the virtual screen size: VIR_SCREEN_WIDTH*VIR_SCREEN_HEIGHT
(which equals to VIR_SCREEN_WIDTH*(IMAGE_HEIGHT*2))
the pixel format: ARGB1555
*/
usleep(4*1000*1000);
#if 1
var.xres_virtual = 48;
var.yres_virtual = 48;
var.xres = 48;
var.yres = 48;
#else
var.xres_virtual = 1280;
var.yres_virtual = 720*2;
var.xres = 1280;
var.yres = 720;
#endif
var.transp= g_a16;
var.red = g_r16;
var.green = g_g16;
var.blue = g_b16;
var.bits_per_pixel = 16;
var.activate = FB_ACTIVATE_NOW;
#if 1
/* 6. set the variable screeninfo */
if (ioctl(pstInfo->fd, FBIOPUT_VSCREENINFO, &var) < 0)
{
printf("Put variable screen info failed!\n");
close(pstInfo->fd);
return HI_NULL;
}
#endif
/* 7. get the fix screen info */
if (ioctl(pstInfo->fd, FBIOGET_FSCREENINFO, &fix) < 0)
{
printf("Get fix screen info failed!\n");
close(pstInfo->fd);
return HI_NULL;
}
u32FixScreenStride = fix.line_length; /*fix screen stride*/
/* 8. map the physical video memory for user use */
pShowScreen = mmap(HI_NULL, fix.smem_len, PROT_READ|PROT_WRITE, MAP_SHARED, pstInfo->fd, 0);
if(MAP_FAILED == pShowScreen)
{
printf("mmap framebuffer failed!\n");
close(pstInfo->fd);
return HI_NULL;
}[/code]
fb3对应鼠标层,可是在设置可变参数时候出错了,提示:Put variable screen info failed!
我的用法是不是不对,思路就是直接操作鼠标层的显存。
[code]/* 1. open framebuffer device overlay 0 */
pstInfo->fd = open("/dev/fb3", O_RDWR, 0);
if(pstInfo->fd < 0)
{
printf("open %s failed!\n",file);
return HI_NULL;
}
bShow = HI_FALSE;
if (ioctl(pstInfo->fd, FBIOPUT_SHOW_HIFB, &bShow) < 0)
{
printf("FBIOPUT_SHOW_HIFB failed!\n");
return HI_NULL;
}
/* 2. set the screen original position */
stPoint.s32XPos = 150;
stPoint.s32YPos = 150;
if (ioctl(pstInfo->fd, FBIOPUT_SCREEN_ORIGIN_HIFB, &stPoint) < 0)
{
printf("set screen original show position failed!\n");
close(pstInfo->fd);
return HI_NULL;
}
#if 1
/* 3.set alpha */
stAlpha.bAlphaEnable = HI_FALSE;
stAlpha.bAlphaChannel = HI_FALSE;
stAlpha.u8Alpha0 = 0x0;
stAlpha.u8Alpha1 = 0xff;
stAlpha.u8GlobalAlpha = 0x80;
if (ioctl(pstInfo->fd, FBIOPUT_ALPHA_HIFB, &stAlpha) < 0)
{
printf("Set alpha failed!\n");
close(pstInfo->fd);
return HI_NULL;
}
#endif
/*all layer surport colorkey*/
stColorKey.bKeyEnable = HI_TRUE;
stColorKey.u32Key = 0x0;
if (ioctl(pstInfo->fd, FBIOPUT_COLORKEY_HIFB, &stColorKey) < 0)
{
printf("FBIOPUT_COLORKEY_HIFB!\n");
close(pstInfo->fd);
return HI_NULL;
}
/* 4. get the variable screen info */
if (ioctl(pstInfo->fd, FBIOGET_VSCREENINFO, &var) < 0)
{
printf("Get variable screen info failed!\n");
close(pstInfo->fd);
return HI_NULL;
}
/* 5. modify the variable screen info
the screen size: IMAGE_WIDTH*IMAGE_HEIGHT
the virtual screen size: VIR_SCREEN_WIDTH*VIR_SCREEN_HEIGHT
(which equals to VIR_SCREEN_WIDTH*(IMAGE_HEIGHT*2))
the pixel format: ARGB1555
*/
usleep(4*1000*1000);
#if 1
var.xres_virtual = 48;
var.yres_virtual = 48;
var.xres = 48;
var.yres = 48;
#else
var.xres_virtual = 1280;
var.yres_virtual = 720*2;
var.xres = 1280;
var.yres = 720;
#endif
var.transp= g_a16;
var.red = g_r16;
var.green = g_g16;
var.blue = g_b16;
var.bits_per_pixel = 16;
var.activate = FB_ACTIVATE_NOW;
#if 1
/* 6. set the variable screeninfo */
if (ioctl(pstInfo->fd, FBIOPUT_VSCREENINFO, &var) < 0)
{
printf("Put variable screen info failed!\n");
close(pstInfo->fd);
return HI_NULL;
}
#endif
/* 7. get the fix screen info */
if (ioctl(pstInfo->fd, FBIOGET_FSCREENINFO, &fix) < 0)
{
printf("Get fix screen info failed!\n");
close(pstInfo->fd);
return HI_NULL;
}
u32FixScreenStride = fix.line_length; /*fix screen stride*/
/* 8. map the physical video memory for user use */
pShowScreen = mmap(HI_NULL, fix.smem_len, PROT_READ|PROT_WRITE, MAP_SHARED, pstInfo->fd, 0);
if(MAP_FAILED == pShowScreen)
{
printf("mmap framebuffer failed!\n");
close(pstInfo->fd);
return HI_NULL;
}[/code]
fb3对应鼠标层,可是在设置可变参数时候出错了,提示:Put variable screen info failed!
我的用法是不是不对,思路就是直接操作鼠标层的显存。
我来回答
回答1个
时间排序
认可量排序
认可0
或将文件直接拖到这里
悬赏:
E币
网盘
* 网盘链接:
* 提取码:
悬赏:
E币
Markdown 语法
- 加粗**内容**
- 斜体*内容*
- 删除线~~内容~~
- 引用> 引用内容
- 代码`代码`
- 代码块```编程语言↵代码```
- 链接[链接标题](url)
- 无序列表- 内容
- 有序列表1. 内容
- 缩进内容
- 图片
相关问答
-
2016-04-18 15:54:15
-
2019-06-19 11:43:32
-
2018-11-16 10:49:36
-
2018-01-10 15:13:07
-
2025-04-28 13:14:20
-
2016-12-16 09:45:34
-
2017-06-06 14:29:08
-
2019-01-04 09:46:46
-
2014-11-05 10:27:28
-
2016-04-19 19:15:11
-
2015-01-19 18:54:37
-
2020-08-27 17:43:25
-
2024-07-16 14:03:30
-
2017-11-30 11:05:17
-
2021-01-06 15:42:52
-
2024-11-12 18:39:04
-
2015-08-06 16:31:00
-
2019-01-16 16:40:35
-
2015-09-21 15:45:59
无更多相似问答 去提问
点击登录
-- 积分
-- E币
提问
—
收益
—
被采纳
—
我要提问
切换马甲
上一页
下一页
悬赏问答
-
10hi35169dv500平台使用http协议推拉流UVC摄像头,帧率问题
-
10hi3516cv610关于YOLO优化和调优问题
-
10hi_mpi_vpss_get_chn_frame err:0xa0078016报错
-
5gk7205v200(hisi3516ev200)如何接入b656?
-
30pipe管道创建失败
-
10atc转换模型失败
-
20拍摄静止画面显示正常,拍摄运动的画面出现马赛克显示
-
100hi3516cv610 通过易百纳官方SDK中编译出的uboot env kernel,移植到自己的工程中,MPP初始化时出现内核拷贝数据到用户端时出现错误导致内核进入pain模式进而时内核重启
-
5hisi3519 gs2972 bt1120 转sdi 无法正常显示问题
-
5hisi3516cv610 + gc4336p 夜晚很模糊
举报反馈
举报类型
- 内容涉黄/赌/毒
- 内容侵权/抄袭
- 政治相关
- 涉嫌广告
- 侮辱谩骂
- 其他
详细说明
提醒
你的问题还没有最佳答案,是否结题,结题后将扣除20%的悬赏金
取消
确认
提醒
你的问题还没有最佳答案,是否结题,结题后将根据回答情况扣除相应悬赏金(1回答=1E币)
取消
确认

微信扫码分享
QQ好友