Skip to content

Commit

Permalink
don't adjust the battery power reading, added description of the udev…
Browse files Browse the repository at this point in the history
… rule
  • Loading branch information
dkosmari committed Jul 12, 2023
1 parent da684b4 commit df1d6dd
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
23 changes: 12 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ PACKAGE := hid-wiimote-plus
# this is used to name the module file, so it must match the original to override it
MODULE := hid-wiimote

VERSION := 0.8.3
VERSION := 0.8.4

DISTDIR := $(PACKAGE)-$(VERSION)

Expand Down Expand Up @@ -37,27 +37,28 @@ default:


build:
make -C $(KDIR) M=$(SRCDIR)
make --directory=$(KDIR) M=$(SRCDIR)


clean:
$(info cleaning up)
make -C $(KDIR) M=$(SRCDIR) clean
$(RM) -r $(DISTDIR)
make --directory=$(KDIR) M=$(SRCDIR) clean
$(RM) --recursive $(DISTDIR)
$(RM) dkms.conf


dist:
mkdir -p $(DISTDIR)
cp $(DISTFILES) $(DISTDIR)/
mkdir $(DISTDIR)
cp --target-directory=$(DISTDIR) $(DISTFILES)
tar -c -z -f $(DISTDIR).tar.gz $(DISTDIR)
$(RM) -r $(DISTDIR)
$(RM) --recursive $(DISTDIR)


install: dkms.conf
$(RM) -rf $(SRCTREE)/$(PACKAGE)-$(VERSION)
cp -r $(SRCDIR) $(SRCTREE)/$(PACKAGE)-$(VERSION)
-cp -r 99-wiimote.rules /etc/udev/rules.d/
$(RM) --recursive $(SRCTREE)/$(DISTDIR)
mkdir --parents $(SRCTREE)/$(DISTDIR)
cp --target-directory=$(SRCTREE)/$(DISTDIR) $(DISTFILES) dkms.conf
-cp --target-directory=/etc/udev/rules.d 99-wiimote.rules
dkms add -m $(PACKAGE) -v $(VERSION)
dkms build -m $(PACKAGE) -v $(VERSION)
dkms install -m $(PACKAGE) -v $(VERSION)
Expand All @@ -66,7 +67,7 @@ install: dkms.conf
uninstall:
$(RM) /etc/udev/rules.d/99-wiimote.rules
-dkms remove -m $(PACKAGE) -v $(VERSION) --all
$(RM) -r /usr/src/$(PACKAGE)-$(VERSION)
$(RM) --recursive $(SRCTREE)/$(DISTDIR)


dkms.conf: dkms.conf.in
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,11 @@ If you just want to test it, without installing it, use these commands instead:
make build
sudo rmmod hid-wiimote
sudo insmod ./hid-wiimote.ko


Permission issues
-----------------

The script [99-wiimote.rules](99-wiimote.rules) is installed automatically to
`/etc/udev/rules.d`. If that script is not present, or conflicts with other scripts, you
may end up with devices missing the `ID_INPUT_JOYSTICK` tag, or with wrong permissions.
2 changes: 1 addition & 1 deletion hid-wiimote-modules.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ static int wiimod_battery_get_property(struct power_supply *psy,
state = wdata->state.cmd_battery;
spin_unlock_irqrestore(&wdata->state.lock, flags);

val->intval = state * 100 / 0xd0;
val->intval = state;
return ret;
}
case POWER_SUPPLY_PROP_STATUS:
Expand Down

0 comments on commit df1d6dd

Please sign in to comment.