我的要求是每当我点击按钮时将进度条的颜色更改为红色.我不想注释掉Application.EnableVisualStyles().
所以我尝试使用SendMessage.我的代码:
[DllImport("user32.dll")]
private static extern bool SendMessage(IntPtr hWnd, Int32 msg, Int32 wParam, Int32 lParam);
private const Int32 WM_USER = 0x0400;
private const Int32 CCM_FIRST = 0x2000;
private const Int32 PBM_SETBARCOLOR = WM_USER + 9;
private const Int32 PBM_SETBKCOLOR = CCM_FIRST + 1;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
this.Invoke((MethodInvoker)delegate
{
SendMessage(this.progressBar1.Handle, PBM_SETBARCOLOR, 0, ColorTranslator.ToWin32(Color.Red));
SendMessage(this.progressBar1.Handle, PBM_SETBKCOLOR, 0, ColorTranslator.ToWin32(Color.Red));
progressBar1.Style = ProgressBarStyle.Continuous;
progressBar1.Value = progressBar1.Maximum;
});
}
Run Code Online (Sandbox Code Playgroud)
它不起作用.我不知道为什么.你可以帮忙吗?
在Yocto中维护映像版本的最佳方法是什么。
我的意思是假设我们构建了一个映像并将其提供给客户,以后我们会为客户提供错误修复。
我们如何才能知道客户使用的是哪个版本的yocto图像?是否有任何标准方法可以实现这一目标。
谢谢你的时间。感谢您的努力。
Yocto 中的 IMAGE_INSTALL 和 IMAGE_FEATURES 有什么区别。
我已经看到在 Yocto 中启用启动画面。我们需要将以下内容写入local.conf
IMAGE_FEATURES += "splash"
Run Code Online (Sandbox Code Playgroud)
为什么我不能在这里使用 IMAGE_INSTALL
IMAGE_INSTALL += "splash"
Run Code Online (Sandbox Code Playgroud)
谁能告诉我什么时候应该使用 IMAGE_FEATURES 和 IMAGE_INSTALL?
内核维护一个名为的全局变量jiffies,该变量保存系统启动时的滴答/定时器中断数。
每次发生定时器中断时,内部内核计数器的值都会增加。
在无滴答内核/动态滴答中,中断不会定期发生,jiffies增量的值如何?
我有一个通过 USB 接口的定制板。我正在编写 USB Linux 驱动程序。
当我在虚拟机上测试它时,一切都工作正常。但是当我切换到真实硬件并在硬件上使用 Yocto 并运行以下代码时。它失败并显示 -EAGAIN。
retval = usb_control_msg(serial->dev,
usb_rcvctrlpipe(serial->dev, 0),
CP210X_GET_MDMSTS,
USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
0,
i,
(void *)&modem_status,
1,
USB_CTRL_SET_TIMEOUT);
Run Code Online (Sandbox Code Playgroud)
retval 返回 -11。我不确定为什么虚拟机上没有发生这种情况,因为唯一的区别是 PIC 板连接到 X86 定制板并运行 Linux。
dmesg 输出:
transfer buffer not dma capable
------------[ cut here ]------------
WARNING: CPU: 1 PID: 754 at /usr/src/kernel/drivers/usb/core/hcd.c:1595 usb_hcd_map_urb_for_dma+0x3e6/0x5b0
Modules linked in: cp2108(O)
CPU: 1 PID: 754 Comm: test_quad Tainted: G O 4.14.68-intel-pk-standard #1
task: ffff9a33b7d4a4c0 task.stack: ffff9ce5c0130000
RIP: 0010:usb_hcd_map_urb_for_dma+0x3e6/0x5b0
RSP: 0018:ffff9ce5c0133b08 EFLAGS: 00010296
RAX: …Run Code Online (Sandbox Code Playgroud) kprobes 和 kretprobes 都允许您将探针放在内核地址中的特定指令上。
如果注册 kprobe,则 pre_handler 在实际函数之前执行,post_handler 在实际函数之后执行
使用kretprobes,您可以让entry_handler在实际函数之前执行,并让ret_handler在实际函数之后执行,并且它包含函数调用的返回值。
那么,使用 kprobes 相对于 kretprobes 的优势是什么,因为 kretprobes 具有 kprobes 的特性加上函数的返回值
我发现这kmalloc实际上返回了连续的内存。
我编写了一些代码来观察这种行为,但是只有物理内存似乎是连续的,而不是虚拟内存。我有什么错误吗?
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/moduleparam.h>
MODULE_LICENSE("GPL");
static char *ptr;
int alloc_size = 1024;
module_param(alloc_size, int, 0);
static int test_hello_init(void)
{
ptr = kmalloc(alloc_size,GFP_ATOMIC);
if(!ptr) {
/* handle error */
pr_err("memory allocation failed\n");
return -ENOMEM;
} else {
pr_info("Memory allocated successfully:%p\t%p\n", ptr, ptr+100);
pr_info("Physical address:%llx\t %llx\n", virt_to_phys(ptr), virt_to_phys(ptr+100));
}
return 0;
}
static void test_hello_exit(void)
{
kfree(ptr);
pr_info("Memory freed\n");
}
module_init(test_hello_init);
module_exit(test_hello_exit);
Run Code Online (Sandbox Code Playgroud)
dmesg 输出:
Memory allocated successfully:0000000083318b28 000000001fba1614
Physical address:1d5d09c00 1d5d09c64
Run Code Online (Sandbox Code Playgroud) 我试图了解 Linux 内核支持多少个处理器。
grep NR_CPUS /boot/config-`uname -r`
Run Code Online (Sandbox Code Playgroud)
将为我提供内核支持的最大处理器数量,我可以使用内核命令行参数 nr_cpus 覆盖该数量。
要查找在线 cpu 的数量,我可以使用 num_online_cpus() 函数
那么nr_cpu_ids是什么?
#include <linux/kernel.h>
#include <linux/module.h>
MODULE_LICENSE("GPL");
static int __init test_hello_init(void)
{
pr_info("%s: In init NR_CPUs=%d, nr_cpu_ids=%d\n", __func__, NR_CPUS, nr_cpu_ids);
pr_info("Number of cpus available:%d\n", num_online_cpus());
return -1;
}
static void __exit test_hello_exit(void)
{
pr_info("%s: In exit\n", __func__);
}
module_init(test_hello_init);
module_exit(test_hello_exit);
[11548.627338] test_hello_init: In init NR_CPUs=8192, nr_cpu_ids=128
[11548.627340] Number of cpus available:6
Run Code Online (Sandbox Code Playgroud)
NR_CPU 和 ncr_cpu_ids 之间有什么区别。它们不一样吗?
我试图学习如何gdb在核心转储上使用。
这是代码:
int main()
{
return 1/0;
}
Run Code Online (Sandbox Code Playgroud)
这是gdb我运行时的输出gdb a.out core:
warning: exec file is newer than core file.
[New LWP 3121]
Core was generated by `./crash'.
Program terminated with signal SIGFPE, Arithmetic exception.
#0 0x00000000004004fc in ?? ()
(gdb) bt
#0 0x00000000004004fc in ?? ()
#1 0x0000000000400500 in ?? ()
#2 0x00007f6ea0945b97 in ?? ()
#3 0x0000000000000000 in ?? ()
Run Code Online (Sandbox Code Playgroud)
??回溯中有什么?我该如何解决它们?
我的 git 存储库中有两个分支。当我指定分支时,它会给我错误。
Exception: bb.fetch2.MalformedUrl: The URL: 'branch=master;' is invalid and cannot be interpreted
Run Code Online (Sandbox Code Playgroud)
以下是我的食谱中的 SRC_URI
SRC_URI = "git://github.com/abc/abc.git; branch=master;"
Run Code Online (Sandbox Code Playgroud)
如果我不指定分支,则没有问题。
SRC_URI 有什么错误,我参考了其他配方的 SRC_URI,它们也遵循相同的语法
linux ×8
linux-kernel ×5
c ×4
yocto ×4
bitbake ×2
debugging ×2
c# ×1
gdb ×1
git ×1
progress-bar ×1
smp ×1
timer ×1
usb ×1
versioning ×1
winforms ×1