2341
- 收藏
- 点赞
- 分享
- 举报
鼠标层该怎么使用?
各位大神,请问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
-
2016-12-16 09:45:34
-
2017-06-06 14:29:08
-
2019-01-04 09:46:46
-
2016-04-19 19:15:11
-
2014-11-05 10:27:28
-
2015-01-19 18:54:37
-
2020-08-27 17:43:25
-
2017-11-30 11:05:17
-
2024-07-16 14:03:30
-
2015-08-06 16:31:00
-
2021-01-06 15:42:52
-
2024-11-12 18:39:04
-
2015-09-21 15:45:59
-
2019-01-16 16:40:35
-
2020-10-27 10:19:30
无更多相似问答 去提问

点击登录
-- 积分
-- E币
提问
—
收益
—
被采纳
—
我要提问
切换马甲
上一页
下一页
悬赏问答
-
53519dv500接lvds的sensor mn34120,图像出现很多竖线,sensor板接以前的3519v101没问题
-
103403外接hdmi口1024*600显示屏报错
-
5SS928点DC camera的6946,全屏紫色
-
5hi3519 的 网络传输的MTU值可以修改到比1500大嘛?
-
10WS73V100星闪扫描不到设备sle
-
5SS928/SD3403 录像失败 venc stream time out, exit thread; venc 2 stream buffer is full
-
10Hi3516DV500无法运行PQTool软件
-
10君正T23+1084带TF卡插卡(给该主板适配TF卡驱动,电机驱动,适配GPIO)
-
5Hi3536A从vpss获取1080分辨率的yuv数据异常
-
10谁有RV1126 最新版本SDK卖吗?
举报反馈
举报类型
- 内容涉黄/赌/毒
- 内容侵权/抄袭
- 政治相关
- 涉嫌广告
- 侮辱谩骂
- 其他
详细说明
提醒
你的问题还没有最佳答案,是否结题,结题后将扣除20%的悬赏金
取消
确认
提醒
你的问题还没有最佳答案,是否结题,结题后将根据回答情况扣除相应悬赏金(1回答=1E币)
取消
确认