mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 02:38:53 +01:00
internal/gamepad: fix a typo that caused oddly cut off gamepad names. (#2300)
This change allows gamepad names up to 256 characters, which is usually enough. Before, names were cut off after 7 characters, matching the string "Unknown" that is used if querying the name fails. Closes #2300
This commit is contained in:
parent
7ca1ba2648
commit
9bc571af5e
@ -149,7 +149,7 @@ func (*nativeGamepadsImpl) openGamepad(gamepads *gamepads, path string) (err err
|
||||
cname := make([]byte, 256)
|
||||
name := "Unknown"
|
||||
// TODO: Is it OK to ignore the error here?
|
||||
if err := ioctl(fd, uint(_EVIOCGNAME(uint(len(name)))), unsafe.Pointer(&cname[0])); err == nil {
|
||||
if err := ioctl(fd, uint(_EVIOCGNAME(uint(len(cname)))), unsafe.Pointer(&cname[0])); err == nil {
|
||||
name = unix.ByteSliceToString(cname)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user