-
Posts
3 -
Joined
-
Last visited
-
I have move system to emmc, and want to use sdcard to storage videos from camera. So I want to sdcard can automount/umount after hotplug. I have try to use udev to fulfill it. But it seems not work. I add a rules for udev at /etc/udev/rules.d: ACTION=="add",KERNEL=="mmcblk2p1",RUN+="/etc/udev/sdcard_hotplug.sh add /home/opi/Videos/sdcard %k" ACTION=="remove",KERNEL=="mmcblk2p1",RUN+="/etc/udev/sdcard_hotplug.sh remove /home/opi/Videos/sdcard %k" And add a shell file at /etc/udev/sdcard_hotplug.sh #!/bin/bash case $1 in add) mkdir -p $2 mount -t exfat -o iocharset=utf8,rw,sync,umask=0000,dmask=0000,fmask=0000 /dev/$3 $2 ;; remove) umount $2 rm -rf $2 ;; esac Add chmod a+x for it. Test it ok. But udev seems not work! I have use udev monitor to test if remove and insert sdcard can generate event. It works. And use udevadm test, and it also ok. Anybody can help me?
-
Hi, Just as my last post. I want to know if it is possible to wakeup opi3 after I switch its state to "mem" or "disk" using gpio on CON12. I have doing some reasch but I don't know if it is right: PL/PM port can be used as wakeup source. PF/G/H/L/M port support interrupt event. PC/D didn't support interrupt. But when I try to write a device tree file, but it just report some error with error code -22. My device three is like this: /dts-v1/; /plugin/; / { compatible = "allwinner,sun50i-h6"; /* * This fragment is needed only for the internal pull-up activation, * external pull-up resistor is highly recommended if using long wires */ fragment@0 { target = <&r_pio>; __overlay__ { gpio_key_wakeup: gpio_key_wakeup { pins = "PL8"; function = "gpio_in"; bias-pull-up; }; }; }; fragment@1 { target-path = "/"; __overlay__ { gpio-keys-user { /* * Use "gpio-keys" for EINT capable pins, "gpio-keys-polled" for other pins * add "poll-interval" property if using "gpio-keys-polled" */ compatible = "gpio-keys"; autorepeat; pinctrl-names = "default"; pinctrl-0 = <&gpio_key_wakeup>; key_wakeup{ label = "GPIO KEY_WAKEUP"; linux,code = <143>; /* KEY_WAKEUP, see include/uapi/linux/input-event-codes.h */ gpios = <&r_pio 0 8 1>; /* PL8 GPIO_ACTIVE_LOW */ }; }; }; }; }; I am still a newbie and I don't know enough thing about how to write the right DTS file. Please give me some help. Thanks (I have tested KEY_POWER it seems everything OK. I don't know what is the error part about KEY_WAKEUP) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~` Finally, I fulfill it now. dts is like this: one pin for sleep: /dts-v1/; /plugin/; / { compatible = "allwinner,sun50i-h6"; /* * This fragment is needed only for the internal pull-up activation, * external pull-up resistor is highly recommended if using long wires */ fragment@0 { target = <&pio>; __overlay__ { gpio_but_sleep: gpio_but_sleep { pins = "PH3"; function = "gpio_in"; bias-pull-up; }; }; }; fragment@1 { target-path = "/"; __overlay__ { gpio-keys-user { /* * Use "gpio-keys" for EINT capable pins, "gpio-keys-polled" for other pins * add "poll-interval" property if using "gpio-keys-polled" */ compatible = "gpio-keys"; autorepeat; pinctrl-names = "default"; pinctrl-0 = <&gpio_but_sleep>; sleep_button { label = "KEY_SLEEP"; linux,code = <142>; /* KEY_SLEEP, see include/uapi/linux/input-event-codes.h */ linux,input-type = <1>; // EV_KEY gpios = <&pio 7 3 1>; /* PD15 GPIO_ACTIVE_LOW */ gpio-key; }; }; }; }; }; one pin for wakeup: /dts-v1/; /plugin/; / { compatible = "allwinner,sun8i-h3"; fragment@0 { target = <&pio>; __overlay__ { poweroff_pins:poweroff_pins { allwinner,pins = "PA13"; allwinner,function = "gpio_out"; }; }; }; fragment@1 { target-path = "/"; __overlay__ { poweroff: poweroff { compatible = "gpio-poweroff"; gpios = <&pio 0 13 1>; }; }; }; }; But some weird things happend: after I wakeup again. I can connect to opi3 via debug port(uart0). But can not connect it from ssh again. Even after I setup a new static ip for it. And when I test "who", I find it still connect with the old ssh. But when I try to ping gatway "ping 192.168.1.1": it show: From 192.168.1.108 icmp_seq=1 Destination Host Unreachable It is so wried.
-
Hi, I want to use a gpio in CON12 to wakeup orange pi 3. But I can not figure it out. I am using armbian 5.4.43. I have done some researh about this question. It seems the basic process shoule be: 1、choose the right pin to wakeup. Cause some pins can not support interrupt and wakeup event. But I can not find which gpio support wakeup event. It seems I should choose pin on PL or PM ports. But according the schmatic, lots of them have been used as other usages: PIN DEFINE CFG PL0 PMU-SCK 3 PL1 PMU-SDA 3 PL2 RECOVERY 2 PL3 LINK-LED 1 PL4 POW-LED 1 PL5 USB0-DRVVBUS 1 PL6 MUTE 1 PL7 STATUS-LED 1 PL8 PL9 IR-RX 2 PL10 BT-WIFI-ON 1 PM0 WL-WAKE-AP 0 PM1 BT-WAKE-AP 0 PM2 AP-WAKE-AP 1 PM3 WL-REG-ON 1 PM4 BT-REG-ON 1 It seems only PL8 isavailable, but PL8 is also used as PWM pin 2、 write a dts file and let it using gpio-keys driver. For examples choose KEY_WAKEUP. But There need more detail about how to write dts files even after I read some examples. I don't know if I should choose "&pio" or "&r_pio". I can not find any file descript this part. (I have found some descriptiion about PL port and others. &pio is used for PA~PK, &r_pio is used for PL port. And Only Pins on PL port can be used as wakeup source.) (I have test PL8 and PL10. All of them return -22 after reboot when i user dmesg | grep to search gpio. I don't know if I have made some mistake) /dts-v1/; /plugin/; / { compatible = "allwinner,sun50i-h6"; /* * This fragment is needed only for the internal pull-up activation, * external pull-up resistor is highly recommended if using long wires */ fragment@0 { target = <&r_pio>; __overlay__ { gpio_key_wakeup: gpio_key_wakeup { pins = "PL8"; function = "gpio_in"; bias-pull-up; }; }; }; fragment@1 { target-path = "/"; __overlay__ { gpio-keys-user { /* * Use "gpio-keys" for EINT capable pins, "gpio-keys-polled" for other pins * add "poll-interval" property if using "gpio-keys-polled" */ compatible = "gpio-keys"; pinctrl-names = "default"; pinctrl-0 = <&gpio_key_wakeup>; key_wakeup{ label = "GPIO KEY_WAKEUP"; linux,code = <143>; /* KEY_WAKEUP, see include/uapi/linux/input-event-codes.h */ gpios = <&r_pio 0 8 1>; /* PA10 GPIO_ACTIVE_LOW */ }; }; }; }; }; The error message is : opi@orangepi3:~$ dmesg | grep -i gpio [ 2.642632] sun50i-h6-r-pinctrl 7022000.pinctrl: pin PL8 already requested by gpio-keys-user; cannot claim for 7022000.pinctrl:360 [ 2.642646] gpio-keys gpio-keys-user: failed to get gpio: -22 [ 2.642662] gpio-keys: probe of gpio-keys-user failed with error -22 [ 3.343678] sunxi-mmc 4020000.mmc: Got CD GPIO 3、armbian describe we can use "armbian-add-ovelay" to add a custom dts to /boot/user_overlays. But if my dts file have some error if I can delete the relative file directly ? Or I need use other command? (armbian-add-overlay is unavailable for H6 chip. We need to use dtc compile dts file to dtbo and then move it to /boot/overlay-user) 4、add the right ovelay to user-overlays line in /boot/armbianEnv.txt I know it is a old question. But I am so sorry as a newbie can not draw s whole picture about how to use gpio-keys and device tree. Anybody can give me some instructions? Thanks so much!