15AH, San Francisco

California, United States.

Send Your Mail At:

tianyingkejishe@sina.cn

Working Hours

Mon-Sat: 9.30am To 7.00pm

分类标题

Autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et dolore feugait.

分类归档 操作系统

【Linux】打印机环境安装二

前言

传统USB打印机如何实现网络打印机转变,发挥打印机余热。目前好多不用的机顶盒,我们刷成Linux系统。把打印机的USB线插到机顶盒上,机顶盒通过网线或者wifi连接到路由器上,实现USB到网络转换。那路由器Linux到底需要做哪些操作呢,接下来咱们一起聊聊。

一、安装打印机驱动环境

CUPS是开源的打印机服务开源框架,已集成成千上万的各式打印机驱动,我们不用重复造轮子。

1、安装cups

登陆机顶盒调试,会Linux开发的大家都明白。

apt install cups

2、修改 CUPS 配置文件 /etc/cups/cupsd.conf

将 Listen 修改为 0.0.0.0:631

将 Browsing 修改为 Yes

对应位置加上 Allow all

# Only listen for connections from the local machine.
Listen localhost:631 // [!code --]
Listen 0.0.0.0:631 // [!code ++]
Listen /run/cups/cups.sock 
​
# Show shared printers on the local network.
Browsing Off // [!code --]
Browsing Yes // [!code ++]
BrowseLocalProtocols dnssd
​
# Restrict access to the server...

  Order allow,deny
  Allow all // [!code ++]

​
# Restrict access to the admin pages...

  Order allow,deny
  Allow all // [!code ++]

​
# Restrict access to configuration files...

  AuthType Default
  Require user @SYSTEM
  Order allow,deny
  Allow all // [!code ++]

​
# Restrict access to log files...

  AuthType Default
  Require user @SYSTEM
  Order allow,deny
  Allow all // [!code ++]

3、重启cups服务

systemctl restart cups

4、登陆服务器web,进行打印机添加

访问 https://ip:631 进入 CUPS 的 Web UI,点击添加 Add Printer

5、windows添加网络打印机

【Linux】打印机环境安装一

一、环境配置

 sudo apt-get update
 sudo apt-get upgrade
 sudo apt install cups  #公共UNIX打印系统

二、驱动安装

sudo apt-get install hplip

三、打印机安装

hp-setup -i #第一个选0,第二个按p
xiaobao@armbian:~/software/shareprint$ hp-setup -i

HP Linux Imaging and Printing System (ver. 3.23.12)
Printer/Fax Setup Utility ver. 9.0

Copyright (c) 2001-18 HP Development Company, LP
This software comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to distribute it
under certain conditions. See COPYING file for more details.

(Note: Defaults for each question are maked with a '*'. Press <enter> to accept the default.)


--------------------------------
| SELECT CONNECTION (I/O) TYPE |
--------------------------------

  Num       Connection  Description
            Type
  --------  ----------  ----------------------------------------------------------
  0*        usb         Universal Serial Bus (USB)
  1         net         Network/Ethernet/Wireless (direct connection or JetDirect)

Enter number 0...1 for connection type (q=quit, enter=usb*) ? 0

Using connection type: usb

Setting up device: hp:/usb/DeskJet_1110_series?serial=CN75J28090069Z



---------------------
| PRINT QUEUE SETUP |
---------------------


Please enter a name for this print queue (m=use model name:'DeskJet_1110'*, q=quit) ?
Using queue name: DeskJet_1110
Locating PPD file... Please wait.

Found PPD file: hplip:0/ppd/hplip/HP/hp-deskjet_1110_series.ppd
Description:

Note: The model number may vary slightly from the actual model number on the device.

Does this PPD file appear to be the correct one (y=yes*, n=no, q=quit) ?
Enter a location description for this printer (q=quit) ?
Enter additonal information or notes for this printer (q=quit) ?

Adding print queue to CUPS:
Device URI: hp:/usb/DeskJet_1110_series?serial=CN75J28090069Z
Queue name: DeskJet_1110
PPD file: hplip:0/ppd/hplip/HP/hp-deskjet_1110_series.ppd
Location:
Information:


You do not have permission to add a printer. You need authentication.
Username: root
Password:


---------------------
| PRINTER TEST PAGE |
---------------------


Would you like to print a test page (y=yes*, n=no, q=quit) ? y

HP Linux Imaging and Printing System (ver. 3.23.12)
Testpage Print Utility ver. 6.0

Copyright (c) 2001-18 HP Development Company, LP
This software comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to distribute it
under certain conditions. See COPYING file for more details.


HP Linux Imaging and Printing System (ver. 3.23.12)
System Tray Status Service ver. 2.0

Copyright (c) 2001-18 HP Development Company, LP
This software comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to distribute it
under certain conditions. See COPYING file for more details.

warning: No display found.
error: hp-systray requires Qt4 GUI and DBus support. Exiting.
warning: Unable to connect to dbus. Is hp-systray running?
Printing test page to printer DeskJet_1110...
请求 ID 为 DeskJet_1110-1 (1 个文件)
Test page has been sent to printer.

note: If an error occured, or the test page failed to print, refer to the HPLIP website
note: at: http://hplip.sourceforge.net for troubleshooting and support.


Done.

Done.

【Ubuntu】word转pdf

一、使用Unoconv工具

Unoconv是一个开源工具,用于将各种文档格式转换为PDF格式。可以使用以下命令安装:

$ sudo apt-get install unoconv

转换文件的命令如下:

$ unoconv -f pdf filename.doc

其中,filename.doc为待转换的Word文件名

使用Unoconv工具的优点是非常简单易用,但需要注意的是,该工具需要依赖OpenOffice或LibreOffice来实现转换,所以在使用前需要确保已经安装了相应的软件。

二、使用LibreOffice命令行工具

与Unoconv类似,LibreOffice也提供了一个命令行工具soffice,可以用于将各种文档格式转换为PDF格式。可以使用以下命令安装LibreOffice:

$ sudo apt-get install libreoffice

转换文件的命令如下:

$ soffice --convert-to pdf filename.doc

其中,filename.doc为待转换的Word文件名。

使用LibreOffice命令行工具的优点是它不依赖于其他软件,并且支持各种Office文档格式。但是转换速度可能会比其他工具慢一些。

三、使用Pandoc工具

Pandoc也是一个开源工具,可以将各种文档格式转换为PDF格式。可以使用以下命令安装Pandoc:

$ sudo apt-get install pandoc

转换文件的命令如下:

$ pandoc -s filename.doc -o filename.pdf

其中,filename.doc为待转换的Word文件名。

使用Pandoc工具的优点是它支持各种文档格式,并且可以自定义文档样式,转换后的PDF文件也会自动添加书签,方便查阅。但是需要注意的是,Pandoc工具并不是专门用于文档转换的,所以在转换复杂文档时可能会出现格式错误。

四、使用Liberation字体

在Word文件转换为PDF格式时,由于Linux和Windows系统的字体库不一样,可能导致PDF文档出现乱码或格式错误。为了解决这个问题,我们可以在Linux系统中安装Microsoft Office的字体Liberation字体,实现Linux和Windows字体的兼容。

安装Liberation字体的命令如下:

$ sudo apt-get install fonts-liberation

安装完毕后,我们就可以在Word文件转换成PDF文件时使用Liberation字体了。

五、小结

以上就是在Linux下实现Word文件转PDF的方法,我们可以根据需要选择不同的工具来实现转换,以满足我们的工作需求。同时,为了避免字体的兼容性问题,我们也可以安装Liberation字体来保证转换后的PDF文件格式正确。

linux 获取OS盘符的方法

在服务器测试中,对硬盘的测试有很多,有些测试用例需要我们写一下自动化的脚本,比如给服务器所有的盘施加压力,这个就需要我们把除了OS盘的所有盘遍历出来,下面介绍几种方法来筛选OS盘
我们知道,判断os 盘的方法一般是看其有没有boot分区,通常用两个指令来获取:lsblk和df -h 下面一次介绍一下这两种方法的写法

1、 lsblk 如图所示 带有boot 分区的就是OS盘

系统盘是sda

系统盘是nvme0n1

shell命令行:

lsblk -l  |grep -i boot -B 1 |grep -i disk |awk '{print $1}'

筛选除了OS外所有的盘符

lsblk -l  |grep -vw sda |grep -i disk |awk '{print $1}'
lsblk -l  |grep -vw nvme0n1 |grep -i disk |awk '{print $1}'

2、 df -h

系统盘是sda

shell命令行

df -h | awk '{print $1}' | grep -iE "/dev/sd" | sed 's/[0-9]//g' |sort -u |awk -F "/" {'print $NF'}

系统盘是nvme0n1

shell 命令行

 df -h | awk '{print $1}' | grep -iE "/dev/nvme" | sed 's/p[0-9]//g' |sort -u |awk -F "/" {'print $NF'}

对此可以写成一个小脚本来判断OS,代码如下:

#!/bin/bash
bootdisk=`df -h |grep -i boot | awk '{print $1}' | grep -iE "/dev/sd" | sed 's/[0-9]//g' |sort -u|awk -F "/" '{print $NF}'`
if  test -z "$bootdisk"
then
        bootdisk=`df -h |grep -i boot| awk '{print $1}' | grep -iE "/dev/nvme" | sed 's/p[0-9]*//g' |sort -u|awk -F "/" '{print $NF}'`
        echo "os disk os $bootdisk"
else
        echo "os disk is $bootdisk"
fi

运行结果如下图:

【ubuntu】sudo: error in /etc/sudo.conf, line 0 while loading plugin `sudoers_policy’ 解决方法

报错:

sudo: error in /etc/sudo.conf, line 0 while loading plugin ‘sudoers_policy’
sudo: /usr/lib/sudo/sudoers.so must only be writable by owner
sudo: fatal error, unable to load plugins

导致的原因

用ll查看了一下sudoer.so和sudo的用户权限,发现owner都是非root用户,所以才导致当前用户没有权限执行sudo命令,修改权限后,即可解决此问题。

解决方法:

chmod 644 /usr/lib/sudo/sudoers.so
su 输入密码进入su
chown -R root /usr/lib/sudo

【Android Studio】安装app报错Installation did not succeed. The application could not be installed: INSTALL

问题描述
安装app demo报错;app安装不上
Installation did not succeed.
The application could not be installed: INSTALL_FAILED_INSUFFICIENT_STORAGE
The device needs more free storage to install the application (extra space is needed in addition to APK size).

原因分析:
程序或手机内存空间不足

解决方案:
清理程序内存:Build -> Clean Project

清理手机内存:清理多余程序或空间
File -> Rest重启再运行

app安装成功

【ubuntu】升级GLIBC高版本方法,解决:version `GLIBC_2.34‘ not found

1.编辑源:打开源文件

sudo vi /etc/apt/sources.list

2.添加高版本的源:把此行源添加到最后一行

deb http://mirrors.aliyun.com/ubuntu/ jammy main

3.更新源

sudo apt update

4.安装高版本GLIBC

sudo apt install libc6

5.查看结果:如下图所示

strings /lib/x86_64-linux-gnu/libc.so.6 |grep GLIBC_

6.添加路径:打开环境配置文件

sudo gedit /etc/bash.bashrc或者sudo vim /etc/bash.bashrc

7.配置环境:把下方代码加到刚才打开的配置文件的最后一行

PATH=$PATH:/usr/local/host/bin

注意:/etc/bash.bashrc 这个路径要换成自己的路径

8.使环境变量生效

source ~/.bash.bashrc

【phy】yt8521 phy芯片驱动移植

1、准备驱动文件

2、添加到相应目录

把motorcomm.c、yt8614-phy.h放到Linux的linux-5.19.1/drivers/net/phy/

把motorcomm_phy.h放到Linux的linux-5.19.1/include/linux/

3、修改Makefile

增加:obj-$(CONFIG_MOTORCOMM_PHY) += motorcomm.o

4、修改Kconfig

增加:

config MOTORCOMM_PHY
        tristate "Motorcomm PHYs"
        help
          Enables support for Motorcomm network PHYs.
          Currently supports the YT8511 gigabit PHY.

【armbian】国内编译提高速度

一、更新dockers配置文件Dockerfile

修改文件:lib/functions/host/docker.sh

修改内容:修改容器内pip国内源

二、配置代码分支分支

修改文件:./config/boards/orangepizero2w.csc

修改内容:

三、修改代码源

修改文件:lib/functions/configuration/main-config.sh

修改内容:

四、编译配置参数

./compile.sh build BOARD=orangepizero2w BRANCH=current BUILD_DESKTOP=no BUILD_MINIMAL=no KERNEL_CONFIGURE=yes RELEASE=jammy UBOOT_MIRROR=gitee  DOWNLOAD_MIRROR=china REGIONAL_MIRROR=china MAINLINE_MIRROR=bfsu GHCR_MIRROR=dockerproxy GITHUB_MIRROR=ghproxy


五、内核配置快捷方式

 [ It still works, but please prefer the new way. First, run './compile.sh BOARD=orangepizero2w BRANCH=current kernel-config'; then commit your changes; then build the image as normal. This workflow ensures consistent hashing results. ]

六、内核定制

./compile.sh BOARD=orangepizero2w BRANCH=current kernel-config

七、uboot定制

./compile.sh BOARD=orangepizero2w BRANCH=current uboot-config