Linux驱动程序--自动创建设备文件


文章摘要:
本文主要描述了自动创建Linux设备文件的几种常用方法。


方法一:class(推荐)

#include <linux/device.h>
struct class *myclass;
dev_t devno; 

创建设备文件(模块加载时):

// 创建自定义类:字符串为类名称
myclass = class_create(THIS_MODULE,"myclass"); 
// 创建设备:字符串为设备名称
device_create(myclass,NULL,devno,"mydevice");   

移除自动创建的设备文件(模块移除时):

// 移除设备
device_destroy(myclass, devno); 
// 移除类
class_destroy(myclass);          

当驱动模块被加载时,udev(mdev)就会自动在/dev目录下创建"mydevice"设备文件

- 阅读全文 -

Five Hundred Miles


播放此段音频需要Adobe Flash Player, 请点击下载最新版本并确认浏览器已开启JavaScipt支持


If you miss the train I'm on,
You will know that I am gone,
You can hear the whistle blow a hundred miles.
A hundred miles, a hundred miles,
A hundred miles, a hundred miles,
You can hear the whistle blow a hundred miles.

- 阅读全文 -

Linux文件系统(二)--添加常用功能


文档摘要:
本文主要在最小文件系统的基础上添加常用的功能。

文档说明:
1.文件系统位于宿主机的/mnt/armlinux/rootfs目录下;
2.注意文件路径。


添加运行库
由于尚未添加库文件,所以还不能运行非静态编译的文件,需要将编译器目录下的库文件复制至文件系统的lib目录中。

# cp 4.3.3/arm-none-linux-gnueabi/libc/armv4t/lib/*  /mnt/armlinux/rootfs/lib

- 阅读全文 -

Windows注册表


解锁注册表
新建扩展名为.reg的文件,输入以下内容,保存并双击运行即可。

Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System]
"DisableRegistryTools"=dword:00000000

注意事项:
1.因为注册表被锁定时,修改后无法保存,只能通过此方法来解锁。
2.注册表修改都可以采用此方法来处理,采用批处理文件在处理多个注册表项时,比较方便。


注册表删除项

Windows Registry Editor Version 5.00
[-HKEY_CLASSES_ROOT\Directory\Background\shellex\ContextMenuHandlers\XXXX] 
"XXXX"=-

注册表删除值

Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Update]
"UpdateMode"=-

取消快捷方式文字
当前用户-->软件-->微软-->Windows/当前版本/浏览器
HKEY_CURRENT_USER/Software/Microsoft/Windows/CurrentVersion/Explorer
修改link键值为 00 00 00 00 即可;
如果不存在该键,则创建该键(二进制)

Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER/Software/Microsoft/Windows/CurrentVersion/Explorer]
"link"=dword:00000000

串口列表 本机-->硬件-->设备-->串口
HKEY_LOCAL_MACHINE/HARDWARE/DEVICEMAP/SERIALCOMM

删除安装在“我的电脑”下的盘符(百度云管家等)
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace
删除NameSpace下面的相关项。

本机-->软件-->微软-->Windows-->当前版本-->浏览器-->我的电脑-->命名空间


删除多余的右键菜单
HKEY_CLASSES_ROOT\Directory\Background\shellex\ContextMenuHandlers
根类-->目录-->背景-->扩展命令-->右键菜单
所有关于右键菜单的项目都在这里了,删除不需要的项即可。

Windows Registry Editor Version 5.00
[-HKEY_CLASSES_ROOT\Directory\Background\shellex\ContextMenuHandlers\XXXX] 
"XXXX"=-

注意事项:这里的-的位置,表示删除该项目。

添加右键打开方式

Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\shell\EmEditor]
@="EmEditor"
"Icon"="D:\\Editor\\EmEditor\\EmEditor.exe"
[HKEY_CLASSES_ROOT\*\shell\EmEditor\command]
@="\"D:\\Editor\\EmEditor\\EmEditor.exe\" \"%1\""

第1项是设置图标,可省略
第2项是设置执行动作,%1表示选定的文件


Win7文件夹不能自动刷新: 表现在复制或删除文件后要手动刷新才显示

Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Update]
"UpdateMode"=dword:00000000

指定用户不显示的登录列表中:

Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\SpecialAccounts\UserList]
"username"=dword:00000000

username为全名

关机延时: 单位为ms,字符串类型不加修饰

Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control]
"WaitToKillServiceTimeout"="5000"

- 阅读全文 -


Copyright©2025 春天花会开, All Rights Reserved. Email: webmaster@oroct.com